public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/5475] New: Please support fe80::[...]%eth0-like nameservers in /etc/resolv.conf
@ 2007-12-12  7:09 linkfanel at yahoo dot fr
  2007-12-12  7:11 ` [Bug libc/5475] " linkfanel at yahoo dot fr
  2008-04-07 17:23 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: linkfanel at yahoo dot fr @ 2007-12-12  7:09 UTC (permalink / raw)
  To: glibc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4401 bytes --]

It seems that glibc's resolver does not support IPv6 link-local
addresses with an explicit scope (like fe80::[...]%eth0), in the
nameserver options in /etc/resolv.conf. Currently, nameservers with a
scope fail to be parsed. Nameservers with a link-local address (without
scope) are parsed and used, but obviously do not work (connect() fails
with EINVAL because a sin6_scope_id of 0 is used with the link-local
address).

With the apparition of the new RDNSS option (RFC5006), which allows
for DNS configuration through stateless autoconf, we expect that IPv6
link-local resolvers may be used, and set into /etc/resolv.conf.
Kernel-side support is included in Linux 2.6.24, and the corresponding
userland RDNSS daemon is currently under development and will be shipped
in the next release of Rémi Denis-Courmont's ndisc6 tool suite. We would
need glibc to support this feature to integrate our work.

I use Debian sid's glibc 2.7-4, under Linux 2.6.23.9-grsec, on i686 hardware.
Debian's glibc maintainers referred me to you regarding this issue (please see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=455671).

Please review this patch, made against upstream sources shipped in the Debian
package and compiled using Debian's build system, and consider it for application.

--- resolv/res_init.c	2007-12-09 17:30:57.000000000 +0100
+++ resolv/res_init.c	2007-12-09 18:19:40.000000000 +0100
@@ -74,11 +74,14 @@ static const char rcsid[] = "$BINDId: re
 #include <sys/socket.h>
 #include <sys/time.h>
 
+#include <net/if.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 
+#include <assert.h>
 #include <ctype.h>
+#include <netdb.h>
 #include <resolv.h>
 #include <stdio.h>
 #include <stdio_ext.h>
@@ -327,6 +330,8 @@ __res_vinit(res_state statp, int preinit
 
                         if ((el = strchr(cp, '\n')) != NULL)
                             *el = '\0';
+                        if ((el = strchr(cp, SCOPE_DELIMITER)) != NULL)
+                            *el = '\0';
                         if ((*cp != '\0') &&
                             (inet_pton(AF_INET6, cp, &a6) > 0)) {
                             struct sockaddr_in6 *sa6;
@@ -336,6 +341,27 @@ __res_vinit(res_state statp, int preinit
                                 sa6->sin6_addr = a6;
                                 sa6->sin6_family = AF_INET6;
                                 sa6->sin6_port = htons(NAMESERVER_PORT);
+
+                                if (el != NULL) {
+                                    int try_numericscope = 0;
+                                    if (IN6_IS_ADDR_LINKLOCAL(&a6)
+                                        || IN6_IS_ADDR_MC_LINKLOCAL(&a6)) {
+                                        sa6->sin6_scope_id = if_nametoindex(el
+ 1);
+                                        if (sa6->sin6_scope_id == 0)
+                                            try_numericscope = 1;
+                                    } else
+                                        try_numericscope = 1;
+
+                                        if (try_numericscope != 0) {
+                                            char *end;
+                                            assert(sizeof(uint32_t) <=
sizeof(unsigned long));
+                                            sa6->sin6_scope_id = (uint32_t)
strtoul(el + 1, &end, 10);
+                                            if (*end != '\0')
+                                                sa6->sin6_scope_id = 0;
+                                    }
+                                } else
+                                    sa6->sin6_scope_id = 0;
+
 				statp->_u._ext.nsaddrs[nservall] = sa6;
 				statp->_u._ext.nssocks[nservall] = -1;
 				statp->_u._ext.nsmap[nservall] = MAXNS + 1;

Regards,

-- 
Pierre Ynard

-- 
           Summary: Please support fe80::[...]%eth0-like nameservers in
                    /etc/resolv.conf
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: linkfanel at yahoo dot fr
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5475

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/5475] Please support fe80::[...]%eth0-like nameservers in /etc/resolv.conf
  2007-12-12  7:09 [Bug libc/5475] New: Please support fe80::[...]%eth0-like nameservers in /etc/resolv.conf linkfanel at yahoo dot fr
@ 2007-12-12  7:11 ` linkfanel at yahoo dot fr
  2008-04-07 17:23 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: linkfanel at yahoo dot fr @ 2007-12-12  7:11 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From linkfanel at yahoo dot fr  2007-12-12 07:11 -------
Created an attachment (id=2132)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2132&action=view)
Unmangled version of the patch


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5475

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/5475] Please support fe80::[...]%eth0-like nameservers in /etc/resolv.conf
  2007-12-12  7:09 [Bug libc/5475] New: Please support fe80::[...]%eth0-like nameservers in /etc/resolv.conf linkfanel at yahoo dot fr
  2007-12-12  7:11 ` [Bug libc/5475] " linkfanel at yahoo dot fr
@ 2008-04-07 17:23 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2008-04-07 17:23 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2008-04-07 17:22 -------
I've added the code to cvs.  You should have said that you took the code
sequence from getaddrinfo.c.  And the formatting was throwing me off at first
before I realized it's wrong and the code is copied.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=5475

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-07 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-12  7:09 [Bug libc/5475] New: Please support fe80::[...]%eth0-like nameservers in /etc/resolv.conf linkfanel at yahoo dot fr
2007-12-12  7:11 ` [Bug libc/5475] " linkfanel at yahoo dot fr
2008-04-07 17:23 ` drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).