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:

2018-02-12 Thread Adam Goode
This should be fixed upstream. See
https://github.com/lathiat/nss-mdns/blob/master/NEWS.md

Please update this in Debian, and file bugs if there are problems:
https://github.com/lathiat/nss-mdns/issues/new


Thank you!



Bug#644912: Unable to deliver your item, #762465378929

2016-11-14 Thread FedEx 2Day A.M.
Hello,
Courier was unable to deliver the parcel to you. Shipment Label is attached to 
this email.
Wylma Devit - Area Manager FedEx , CA
Thanks and best regards


FedEx.doc
Description: MS-Word document


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: works for getaddrinfo but not if AF_INET6 specified

2015-08-23 Thread Jens B. Jorgensen
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
---BeginMessage---
I just built this with my previously-submitted patch and I did get
scope_id in when address family was unspecified as well as when I
specified it as AF_INET6. Not sure why my results are different. It'd
still be great to get this patch applied...

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



signature.asc
Description: OpenPGP digital signature
---End Message---


Bug#644912: works for getaddrinfo but not if AF_INET6 specified

2015-01-03 Thread chrysn
hello,

i've tested the patch on 0.10-6, it applies with small offsets, and
things work as described in the patch mail.

with explicitly specified AF instead of looking through the list to
find the v6 addresses, however, the interface index is zero as before
the patch:

$ python -c 'import socket; print socket.getaddrinfo(hephaistos.local, None)'
[(10, 1, 6, '', ('fe80::800:27ff:fe00:0%vboxnet0', 0, 0, 8)),
(10, 2, 17, '', ('fe80::800:27ff:fe00:0%vboxnet0', 0, 0, 8)),
(10, 3, 0, '', ('fe80::800:27ff:fe00:0%vboxnet0', 0, 0, 8)),
(2, 1, 6, '', ('10.13.13.131', 0)),
(2, 2, 17, '', ('10.13.13.131', 0)),
(2, 3, 0, '', ('10.13.13.131', 0))]
$ python -c 'import socket; print socket.getaddrinfo(hephaistos.local, None, 
socket.AF_INET6)'
[(10, 1, 6, '', ('fe80::800:27ff:fe00:0', 0, 0, 0)),
(10, 2, 17, '', ('fe80::800:27ff:fe00:0', 0, 0, 0)),
(10, 3, 0, '', ('fe80::800:27ff:fe00:0', 0, 0, 0))]

my testing may be faulty due to any stale caches -- i've installed the
patched version using dpkg and restarted avahi-daemon, anything else i
should have flushed?

best regards
chrysn

-- 
Ceterum censeo https://bugs.debian.org/466014 esse resolvendum.


signature.asc
Description: Digital signature


Bug#644912: Confirming

2013-02-18 Thread Loïc Minier
tag 644912 + confirmed
stop

I confirm the symptoms mentioned in this bug report; after changing my
nsswitch.conf from:
hosts:  files mdns_minimal4 [NOTFOUND=return] dns mdns4
to:
hosts:  files mdns_minimal [NOTFOUND=return] dns mdns

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.

This patch shouldn't definitely be (tested, reviewed and) included to
fix handling of IPv6 .local addresses, but it's not clear the default
should be changed from IPv4-only lookups to IPv4 + IPv6 lookups.

Cheers,
-- 
Loïc Minier


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



Bug#644912: a fix for this problem

2013-01-07 Thread Jens Jorgensen
Hello,

I too was greatly annoyed to find that getaddrinfo can never return
scope id for .local addresses. I finally knuckled down and did the work
to figure out how to make this happen. In short it requires that the
libnss-mdns implement _nss_gethostbyname4_r. I've done this in the
attached patch. I'm using it on my box right now and things seem to be
good. You can see that it's (not) working like this:

python -c 'import socket ; print
socket.getaddrinfo(yourhostnamehere.local, None)'

--
Jens B. Jorgensen
jorgen...@getcollc.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.



GETCO Asia PTE Limited is a wholly-owned subsidiary of GETCO Holding Company, 
and is a company incorporated in Singapore with Company Registration Number 
200716929N.
diff -u src/avahi.c src/avahi.c
--- src/avahi.c 2006-04-29 05:14:09.0 +0800
+++ src/avahi.c 2013-01-04 10:00:05.025558790 +0800
@@ -26,6 +26,7 @@
 #include sys/socket.h
 #include string.h
 #include stdio.h
+#include stdlib.h
 #include sys/types.h
 #include arpa/inet.h
 #include sys/un.h
@@ -34,6 +35,7 @@
 
 #include avahi.h
 #include util.h
+#include query.h
 
 #define WHITESPACE  \t
 
@@ -93,7 +95,8 @@
 p = ln+1;
 p += strspn(p, WHITESPACE);
 
-/* Skip interface */
+/* Parse interface */
+if (af == AF_INET6) ((ipv6_address_t*)data)-if_idx = strtoul(p, 0, 10);
 p += strcspn(p, WHITESPACE);
 p += strspn(p, WHITESPACE);
 
diff -u src/avahi-test.c src/avahi-test.c
--- src/avahi-test.c2007-02-09 00:42:23.0 +0800
+++ src/avahi-test.c2013-01-04 09:59:06.174017729 +0800
@@ -24,6 +24,7 @@
 #include stdio.h
 
 #include avahi.h
+#include query.h
 
 int main(int argc, char *argv[]) {
 uint8_t data[64];
@@ -35,15 +36,20 @@
 else
 printf(AF_INET: failed (%i).\n, r);
 
-/* if ((r = avahi_resolve_name(AF_INET6, argc = 2 ? argv[1] : 
cocaine.local, data)) == 0) */
-/* printf(AF_INET6: %s\n, inet_ntop(AF_INET6, data, t, sizeof(t))); 
*/
-/* else */
-/* printf(AF_INET6: failed (%i).\n, r); */
-
 if ((r = avahi_resolve_address(AF_INET, data, t, sizeof(t))) == 0)
 printf(REVERSE: %s\n, t);
 else
 printf(REVERSE: failed (%i).\n, r);
+
+ if ((r = avahi_resolve_name(AF_INET6, argc = 2 ? argv[1] : 
cocaine.local, data)) == 0)
+ printf(AF_INET6: %s, %u\n, inet_ntop(AF_INET6, data, t, sizeof(t)), 
((ipv6_address_t*)data)-if_idx);
+ else
+ printf(AF_INET6: failed (%i).\n, r);
+
+if ((r = avahi_resolve_address(AF_INET6, data, t, sizeof(t))) == 0)
+printf(REVERSE: %s\n, t);
+else
+printf(REVERSE: failed (%i).\n, r);
 
 return 0;
 }
diff -u src/bsdnss.c src/bsdnss.c
--- src/bsdnss.c2007-02-09 00:42:23.0 +0800
+++ src/bsdnss.c2013-01-04 09:49:45.566389491 +0800
@@ -258,6 +258,8 @@
ai-ai_addrlen = sizeof(struct sockaddr_in6);
memcpy(((struct sockaddr_in6 *)psa)-sin6_addr, hap,
ai-ai_addrlen);
+   if (((struct sockaddr_in6 *)psa)-sin6_addr[0] == 0xfe 
 ((struct sockaddr_in6 *)psa)-sin6_addr[0] == 0x80)
+   ((struct sockaddr_in6 *)psa)-sin6_scope_id = 
((struct ipv6_address_t*) hap)-if_idx;
break;
default:
ai-ai_addrlen = sizeof(struct sockaddr_storage);
diff -u src/map-file src/map-file
--- src/map-file2007-01-02 02:36:21.0 +0800
+++ src/map-file2013-01-07 08:56:56.406478774 +0800
@@ -18,6 +18,12 @@
 _nss_mdns_minimal_gethostbyname2_r; 
 _nss_mdns4_minimal_gethostbyname2_r;
 _nss_mdns6_minimal_gethostbyname2_r;
+_nss_mdns_gethostbyname4_r; 
+_nss_mdns4_gethostbyname4_r;
+_nss_mdns6_gethostbyname4_r;
+_nss_mdns_minimal_gethostbyname4_r; 
+_nss_mdns4_minimal_gethostbyname4_r;
+_nss_mdns6_minimal_gethostbyname4_r;
 local: 
 *;
 };
diff -u src/nss.c src/nss.c
--- src/nss.c   2013-01-07 15:14:23.0 +0800
+++ src/nss.c   2013-01-07 16:52:38.399842517 +0800
@@ -41,22 +41,27 @@
 
 #if defined(NSS_IPV4_ONLY)  ! defined(MDNS_MINIMAL)
 #define _nss_mdns_gethostbyname2_r _nss_mdns4_gethostbyname2_r
+#define _nss_mdns_gethostbyname4_r _nss_mdns4_gethostbyname4_r
 #define 

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