[PATCH] resolv: add IPv6 support to inet_net_pton()

Florian Weimer fweimer@redhat.com
Thu Dec 22 18:21:24 GMT 2022


* Job Snijders via Libc-alpha:

> +	strncpy(buf, src, sizeof(buf) - 1);
> +	buf[sizeof(buf) - 1] = '\0';
> +
> +	sep = strchr(buf, '/');
> +	if (sep != NULL)
> +		*sep++ = '\0';
> +
> +	if (inet_pton(AF_INET6, buf, &in6) != 1) {
> +		__set_errno (ENOENT);
> +		return (-1);
> +	}

Thanks for the patch.

We have __inet_pton_length for internal use.  You can use it to avoid
the copy.  Would you be interested in reworking your patch based on it?

Florian



More information about the Libc-alpha mailing list