svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd
Andrey V. Elsukov
bu7cher at yandex.ru
Sat Jun 30 08:25:57 UTC 2018
On 30.06.2018 01:07, Rick Macklem wrote:
> Author: rmacklem
> Date: Fri Jun 29 22:07:25 2018
> New Revision: 335806
> URL: https://svnweb.freebsd.org/changeset/base/335806
>
> Log:
> Add support for IPv6 addresses to the "-p" option for the pNFS server DS
> specifications.
>
> + char *mdspath, *mdsp, ip6[INET6_ADDRSTRLEN];
> + const char *ad;
> int ecode;
> + hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
> + hints.ai_family = PF_UNSPEC;
> hints.ai_socktype = SOCK_STREAM;
> hints.ai_protocol = IPPROTO_TCP;
> ecode = getaddrinfo(cp, NULL, &hints, &ai_tcp);
> if (ecode != 0)
> err(1, "getaddrinfo pnfs: %s %s", cp,
> gai_strerror(ecode));
> + memcpy(&sin6, res->ai_addr, sizeof(sin6));
> + ad = inet_ntop(AF_INET6, &sin6.sin6_addr, ip6,
> + sizeof(ip6));
Hi,
I'm unaware of applicability of IPv6 addresses with restricted scope in
this area, but when you use inet_ntop() to get IPv6 address text
representation, you can lost IPv6 scope zone id. getaddrinfo() can
return sockaddr structure with properly filled sin6_scope_id field. It
is better to use getnameinfo() with NI_NUMERICHOST flag. Also the size
of ip6 buffer should be enough to keep scope specifier.
--
WBR, Andrey V. Elsukov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 553 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-projects/attachments/20180630/201d9385/attachment.sig>
More information about the svn-src-projects
mailing list