Bug#644912: ipv6 link-local doesn't work as lookup doesn't set scope id

2018-04-26 Thread Simon McVittie
On Mon, 10 Oct 2011 at 19:04:41 +0200, Stefan Bühler wrote:
> libnss-mdns doesn't set the scope-id for link-local addresses, so something
> like
> 
> $ ping6 example.local
> gives
> connect: Invalid argument

This specific use-case (ping6) unfortunately still doesn't work, but I
don't think there's anything that nss-mdns can do to fix this. However,
programs that use AF_UNSPEC rather than AF_INET6 now work if a system is
reconfigured from the default mdns4_minimal to mdns_minimal. For example,
telnet now sees a scope ID as expected:

% grep hosts: /etc/nsswitch.conf
hosts:  files mymachines gw_name myhostname mdns_minimal 
[NOTFOUND=return] resolve [!UNAVAIL=return] dns
% telnet .local
Trying fe80:::::%wlp4s0...
Trying xxx.xxx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused
% telnet .local 80
Trying fe80:::::%wlp4s0...
Connected to .local.
Escape character is '^]'.

On Mon, 24 Aug 2015 at 14:28:38 +0800, Jens B. Jorgensen wrote:
> Incidentally even /with/ my patch ping6 doesn't work. This is because
> due to the innards of how libnss works only when _nss_X_gethostbyname4_r
> is called is it possible to return the scope id--the outputs of the
> _nss_X_gethostbyname2_r and _nss_X_gethostbyname_r do not include this
> data--_nss_X_gethostbyname2 returns data through a struct hostent as
> does _nss_X_gethostbyname_r and unfortunately libnss doesn't call
> _nss_X_gethostbyname4_r unless address family is UNSPEC.

I don't think nss-mdns can fix this.

Loïc Minier  wrote:
> I could witness IPv6 addresses returned by "getent hosts foo.local" on
> various hosts on my network.  One of the arguments in the past was that
> IPv6 was uncommon on local networks but at least iOS 6.1, MacOS X 10.6.8
> and Windows 8 respond with IPv6 link-local addresses to .local mDNS
> queries.  However a couple of devices from my ISP (router and TV STB)
> and a HP C5190 printer didn't, which resulted in ~5 seconds timeouts
> when connecting to them which I hadn't with the IPv4-only setup.

These 5 second delays (when using an application that resolves AF_INET6
and AF_INET separately, rather than using AF_UNSPEC) are why we only use
mdns4_minimal and not mdns_minimal by default.

A better argument than "IPv6 is uncommon on local networks" is "IPv4 is
good enough for local networks". The problem with IPv4 is that globally
routable address space is running out, but local networks don't normally
use globally routable address space anyway, and the RFC1918 and RFC3927
address ranges are large enough for individual LANs.

smcv



Bug#644912: ipv6 link-local doesn't work as lookup doesn't set scope id

2015-08-24 Thread Jens B. Jorgensen
Incidentally even /with/ my patch ping6 doesn't work. This is because
due to the innards of how libnss works only when _nss_X_gethostbyname4_r
is called is it possible to return the scope id--the outputs of the
_nss_X_gethostbyname2_r and _nss_X_gethostbyname_r do not include this
data--_nss_X_gethostbyname2 returns data through a struct hostent as
does _nss_X_gethostbyname_r and unfortunately libnss doesn't call
_nss_X_gethostbyname4_r unless address family is UNSPEC. Now... despite
this you can see from my previous email that I was able to get different
behavior, ie. I could pass AF_INET6 and still get back scopeid. I
believe this is because the previous result was cached, though I didn't
step through the code to verify this. If you're curious you should take
a look at http://osxr.org/glibc/source/sysdeps/posix/getaddrinfo.c.
You'll see there:

0838   /* gethostbyname4_r sends out parallel A and  queries and
0839  is thus only suitable for PF_UNSPEC.  */
0840   if (req-ai_family == PF_UNSPEC)
0841 fct4 = __nss_lookup_function (nip, gethostbyname4_r);
0842
0843   if (fct4 != NULL)
0844 {
0845   int herrno;
0846
0847   while (1)
0848 {
0849   rc = 0;
0850   status = DL_CALL_FCT (fct4, (name, pat, tmpbuf,
0851tmpbuflen, rc, herrno,

Seems to me it should try to use gethostbyname4 if address is family is
UNSPEC or INET6. I presume there was a reason but I certainly don't know
what it is. The code falls back on gethostbyname2 in any case if the
gethostbyname4 isn't available. This is all a bit messy because if at
the top level you call getaddrinfo you should get the resolution
functions that can return the data you asked for but... that's not the
way it is. glibc needs a fix but the code is pretty complex so I didn't
want to try to tackle that (getaddrinfo.c itself is 2664 lines)--plus
it's a bit more nasty to test ;-).

On Mon, 10 Oct 2011 19:04:41 +0200 =?UTF-8?B?U3RlZmFuIELDvGhsZXI=?=
stbueh...@lighttpd.net wrote:
 Package: libnss-mdns
 Tags: ipv6
 Version: 0.10-3.2

 Hi,

 libnss-mdns doesn't set the scope-id for link-local addresses, so
 something like

 $ ping6 example.local
 gives
 connect: Invalid argument

 while
 $ getent host example.local
 returns a valid link-local IPv6 address (fe80::...) and
 $ ping6 fe80::...%eth0
 works fine.


 I sent this nearly 2 years ago upstream per mail, but never got a
 response, and i couldn't find an upstream bug tracker.




--
Jens B. Jorgensen /jorgen...@kcg.com mailto:jorgen...@kcg.com/


This e-mail and its attachments are intended only for the individual or entity 
to whom it is addressed and may contain information that is confidential, 
privileged, inside information, or subject to other restrictions on use or 
disclosure. Any unauthorized use, dissemination or copying of this transmission 
or the information in it is prohibited and may be unlawful. If you have 
received this transmission in error, please notify the sender immediately by 
return e-mail, and permanently delete or destroy this e-mail, any attachments, 
and all copies (digital or paper). Unless expressly stated in this e-mail, 
nothing in this message should be construed as a digital or electronic 
signature. For additional important disclaimers and disclosures regarding KCG’s 
products and services, please click on the following link:

http://www.kcg.com/legal/global-disclosures



Bug#644912: ipv6 link-local doesn't work as lookup doesn't set scope id

2011-10-10 Thread Stefan Bühler

Package: libnss-mdns
Tags: ipv6
Version: 0.10-3.2

Hi,

libnss-mdns doesn't set the scope-id for link-local addresses, so 
something like


$ ping6 example.local
gives
connect: Invalid argument

while
$ getent host example.local
returns a valid link-local IPv6 address (fe80::...) and
$ ping6 fe80::...%eth0
works fine.


I sent this nearly 2 years ago upstream per mail, but never got a 
response, and i couldn't find an upstream bug tracker.




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org