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 AAAA 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, 0851 tmpbuflen, &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