Date: Sun, 1 Jul 2018 17:25:40 +0000 From: Rick Macklem <rmacklem@uoguelph.ca> To: "Andrey V. Elsukov" <bu7cher@yandex.ru>, Rick Macklem <rmacklem@FreeBSD.org>, FreeBSD Net <freebsd-net@freebsd.org> Subject: Re: IPv6 scope handling, was Re: svn commit: r335806 - projects/pnfs-planb-server/usr.sbin/nfsd Message-ID: <YTOPR0101MB0953BF738D1887D72050819FDD4C0@YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM> In-Reply-To: <1e62847a-fe06-9190-ac98-ce120e96f325@yandex.ru> References: <201806292207.w5TM7QX9052770@repo.freebsd.org> <0c85d229-3b8f-3b4c-ba3c-34ec06728455@yandex.ru> <YTOPR0101MB09532F60F2905ECA610DF86DDD4D0@YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM> <048d1b79-f263-506c-210e-21d9e4437c3e@yandex.ru> <YTOPR0101MB09536FD714DA6AEB25D35DFCDD4C0@YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM>, <1e62847a-fe06-9190-ac98-ce120e96f325@yandex.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Andrey V. Elsukov wrote: [stuff snipped] >> >> I think what you are saying above is that a Link-local address won't wor= k >> and that the address must be a global one? >> Should the code check for "fe8" at the start and skip over those ones? > >It is possible that all hosts are in the same scope zone, e.g. they are >connected in the one broadcast domain through the switch. >In this case it is possible to use link-local addresses and they all >will be reachable. > >> The "on-the-wire" address sent to HostC is specified in standard string = form >> (can't remember the RFC#, but it is referenced by RFC5661), so I can't s= end >> any more than that to HostC. > >So if I understand correctly, after formatting you are sending this >address string to the some foreign host? Yes, that is what happens. >The scope zone id specifier is only does matter for the host where it is >used. I.e. there is no sense to send "%ifname" to the foreign host, >because it can have different ifname for the link and that address >specification won't work. That is what I thought. >I think for now we can leave the code as is (put some XXX with comment >here), and then in the future, if it will be needed, add better handling >for that :) How about this patch? (Basically use the link local address if it is the on= ly one returned by getaddrinfo().) --- nfsd.c 2018-06-30 08:16:51.771742000 -0400 +++ /tmp/nfsd.c 2018-07-01 13:01:30.243285000 -0400 @@ -1309,7 +1309,17 @@ parse_dsserver(const char *optionarg, st memcpy(&sin6, res->ai_addr, sizeof(sin6)); ad =3D inet_ntop(AF_INET6, &sin6.sin6_addr, ip6, sizeof(ip6)); - break; + + /* + * XXX + * Since a link local address will only + * work if the client and DS are in the + * same scope zone, only use it if it is + * the only address. + */ + if (ad !=3D NULL && + !IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) + break; } } if (ad =3D=3D NULL) [more stuff snipped] Thanks for the comments, rick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YTOPR0101MB0953BF738D1887D72050819FDD4C0>