Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 315735 Details for
Bug 459756
DNS resolver library doesn't seem to be working reliably
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Proof-of-concept patch
1.patch (text/plain), 11.98 KB, created by
Denys Vlasenko
on 2008-09-04 11:01:34 UTC
(
hide
)
Description:
Proof-of-concept patch
Filename:
MIME Type:
Creator:
Denys Vlasenko
Created:
2008-09-04 11:01:34 UTC
Size:
11.98 KB
patch
obsolete
>diff -urp glibc-2.8.org/include/ifaddrs.h glibc-2.8/include/ifaddrs.h >--- glibc-2.8.org/include/ifaddrs.h 2008-04-16 20:55:33.000000000 +0200 >+++ glibc-2.8/include/ifaddrs.h 2008-09-04 10:41:50.000000000 +0200 >@@ -18,7 +18,7 @@ struct in6addrinfo > uint32_t addr[4]; > }; > >-extern void __check_pf (bool *seen_ipv4, bool *seen_ipv6, >+extern void __check_pf (int *seen_ipv4, int *seen_ipv6, > struct in6addrinfo **in6ai, size_t *in6ailen) > attribute_hidden; > extern void __check_native (uint32_t a1_index, int *a1_native, >diff -urp glibc-2.8.org/include/resolv.h glibc-2.8/include/resolv.h >--- glibc-2.8.org/include/resolv.h 2007-05-20 11:57:47.000000000 +0200 >+++ glibc-2.8/include/resolv.h 2008-09-04 10:49:54.000000000 +0200 >@@ -30,6 +30,13 @@ extern struct __res_state _res; > # endif > # endif > >+#define SEEN_IPVx_NONE 0 /* no IPVx addresses configured at all */ >+#define SEEN_IPVx_HOST 1 /* only 127.0.0.1 / ::1 */ >+#define SEEN_IPVx_LINK 2 /* only link-local addresses (mainly for IPv6) */ >+#define SEEN_IPVx_ROUTABLE 3 /* none of the above */ >+extern int __vda_seen_ipv4; >+extern int __vda_seen_ipv6; >+ > /* Now define the internal interfaces. */ > extern int __res_vinit (res_state, int); > extern int __res_maybe_init (res_state, int); >diff -urp glibc-2.8.org/inet/check_pf.c glibc-2.8/inet/check_pf.c >--- glibc-2.8.org/inet/check_pf.c 2006-04-16 23:26:26.000000000 +0200 >+++ glibc-2.8/inet/check_pf.c 2008-09-04 10:45:43.000000000 +0200 >@@ -23,7 +23,7 @@ > > void > attribute_hidden >-__check_pf (bool *seen_ipv4, bool *seen_ipv6, >+__check_pf (int *seen_ipv4, int *seen_ipv6, > struct in6addrinfo **in6ai, size_t *in6ailen) > { > /* By default we have no way to determine information about >@@ -37,20 +37,20 @@ __check_pf (bool *seen_ipv4, bool *seen_ > { > /* We cannot determine what interfaces are available. Be > pessimistic. */ >- *seen_ipv4 = true; >- *seen_ipv6 = true; >+ *seen_ipv4 = SEEN_IPVx_ROUTABLE; >+ *seen_ipv6 = SEEN_IPVx_ROUTABLE; > return; > } > >- *seen_ipv4 = false; >- *seen_ipv6 = false; >+ *seen_ipv4 = SEEN_IPVx_NONE; >+ *seen_ipv6 = SEEN_IPVx_NONE; > > struct ifaddrs *runp; > for (runp = ifa; runp != NULL; runp = runp->ifa_next) > if (runp->ifa_addr->sa_family == PF_INET) >- *seen_ipv4 = true; >+ *seen_ipv4 = SEEN_IPVx_ROUTABLE; > else if (runp->ifa_addr->sa_family == PF_INET6) >- *seen_ipv6 = true; >+ *seen_ipv6 = SEEN_IPVx_ROUTABLE; > > (void) freeifaddrs (ifa); > } >diff -urp glibc-2.8.org/posix/tst-rfc3484-2.c glibc-2.8/posix/tst-rfc3484-2.c >--- glibc-2.8.org/posix/tst-rfc3484-2.c 2008-04-16 20:56:10.000000000 +0200 >+++ glibc-2.8/posix/tst-rfc3484-2.c 2008-09-04 10:41:50.000000000 +0200 >@@ -12,9 +12,9 @@ > > void > attribute_hidden >-__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen) >+__check_pf (int *p1, int *p2, struct in6addrinfo **in6ai, size_t *in6ailen) > { >- *p1 = *p2 = true; >+ *p1 = *p2 = 2; > *in6ai = NULL; > *in6ailen = 0; > } >diff -urp glibc-2.8.org/posix/tst-rfc3484-3.c glibc-2.8/posix/tst-rfc3484-3.c >--- glibc-2.8.org/posix/tst-rfc3484-3.c 2008-01-10 21:00:37.000000000 +0100 >+++ glibc-2.8/posix/tst-rfc3484-3.c 2008-09-04 10:41:50.000000000 +0200 >@@ -12,9 +12,9 @@ > > void > attribute_hidden >-__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen) >+__check_pf (int *p1, int *p2, struct in6addrinfo **in6ai, size_t *in6ailen) > { >- *p1 = *p2 = true; >+ *p1 = *p2 = 2; > *in6ai = NULL; > *in6ailen = 0; > } >diff -urp glibc-2.8.org/posix/tst-rfc3484.c glibc-2.8/posix/tst-rfc3484.c >--- glibc-2.8.org/posix/tst-rfc3484.c 2008-04-16 20:56:10.000000000 +0200 >+++ glibc-2.8/posix/tst-rfc3484.c 2008-09-04 10:41:50.000000000 +0200 >@@ -12,9 +12,9 @@ > > void > attribute_hidden >-__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen) >+__check_pf (int *p1, int *p2, struct in6addrinfo **in6ai, size_t *in6ailen) > { >- *p1 = *p2 = true; >+ *p1 = *p2 = 2; > *in6ai = NULL; > *in6ailen = 0; > } >diff -urp glibc-2.8.org/resolv/res_data.c glibc-2.8/resolv/res_data.c >--- glibc-2.8.org/resolv/res_data.c 2005-11-01 01:04:00.000000000 +0100 >+++ glibc-2.8/resolv/res_data.c 2008-09-04 10:46:32.000000000 +0200 >@@ -150,6 +150,9 @@ fp_nquery(const u_char *msg, int len, FI > } > libresolv_hidden_def (fp_nquery) > >+extern int __vda_seen_ipv4; >+extern int __vda_seen_ipv6; >+ > int > res_mkquery(int op, /* opcode of query */ > const char *dname, /* domain name */ >@@ -160,6 +163,11 @@ res_mkquery(int op, /* opcode of query > u_char *buf, /* buffer to put query */ > int buflen) /* size of buffer */ > { >+ if (type == T_AAAA && __vda_seen_ipv6 < SEEN_IPVx_ROUTABLE) { >+puts("__vda_seen_ipv6 < SEEN_IPVx_ROUTABLE in res_mkquery"); >+ return -1; >+ } >+ > if (__res_maybe_init (&_res, 1) == -1) { > RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); > return (-1); >diff -urp glibc-2.8.org/resolv/res_libc.c glibc-2.8/resolv/res_libc.c >--- glibc-2.8.org/resolv/res_libc.c 2007-05-20 11:58:48.000000000 +0200 >+++ glibc-2.8/resolv/res_libc.c 2008-09-04 10:41:50.000000000 +0200 >@@ -124,6 +124,8 @@ libc_hidden_def (__res_maybe_init) > create a common definition, but a plain symbol that resides in .bss, > which can have an alias. */ > struct __res_state _res __attribute__((section (".bss"))); >+int __vda_seen_ipv4 __attribute__((section (".bss"))); >+int __vda_seen_ipv6 __attribute__((section (".bss"))); > > #include <tls.h> > >diff -urp glibc-2.8.org/resolv/res_query.c glibc-2.8/resolv/res_query.c >--- glibc-2.8.org/resolv/res_query.c 2007-05-20 11:58:48.000000000 +0200 >+++ glibc-2.8/resolv/res_query.c 2008-09-04 10:46:15.000000000 +0200 >@@ -109,6 +109,9 @@ __libc_res_nquerydomain(res_state statp, > * > * Caller must parse answer and determine whether it answers the question. > */ >+extern int __vda_seen_ipv4; >+extern int __vda_seen_ipv6; >+ > int > __libc_res_nquery(res_state statp, > const char *name, /* domain name */ >@@ -122,6 +125,14 @@ __libc_res_nquery(res_state statp, > int n, use_malloc = 0; > u_int oflags = statp->_flags; > >+printf("__libc_res_nquery: __vda_seen_ipv6:%d\n", __vda_seen_ipv6); >+ >+ if (type == T_AAAA && __vda_seen_ipv6 < SEEN_IPVx_ROUTABLE) { >+puts("__vda_seen_ipv6 < SEEN_IPVx_ROUTABLE in __libc_res_nquery"); >+RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); >+ return -1; >+ } >+ > size_t bufsize = QUERYSIZE; > buf = alloca (bufsize); > >diff -urp glibc-2.8.org/resolv/Versions glibc-2.8/resolv/Versions >--- glibc-2.8.org/resolv/Versions 2008-04-16 20:56:14.000000000 +0200 >+++ glibc-2.8/resolv/Versions 2008-09-04 12:36:12.000000000 +0200 >@@ -8,6 +8,8 @@ libc { > %endif > > _res; >+ __vda_seen_ipv4; >+ __vda_seen_ipv6; > > # helper functions > __h_errno_location; >diff -urp glibc-2.8.org/sysdeps/posix/getaddrinfo.c glibc-2.8/sysdeps/posix/getaddrinfo.c >--- glibc-2.8.org/sysdeps/posix/getaddrinfo.c 2008-04-16 20:56:36.000000000 +0200 >+++ glibc-2.8/sysdeps/posix/getaddrinfo.c 2008-09-04 12:14:59.000000000 +0200 >@@ -1999,6 +1999,8 @@ gaiconf_reload (void) > gaiconf_init (); > } > >+extern int __vda_seen_ipv4; >+extern int __vda_seen_ipv6; > > int > getaddrinfo (const char *name, const char *service, >@@ -2036,30 +2038,42 @@ getaddrinfo (const char *name, const cha > > struct in6addrinfo *in6ai = NULL; > size_t in6ailen = 0; >- bool seen_ipv4 = false; >- bool seen_ipv6 = false; >+ int seen_ipv4 = 0; >+ int seen_ipv6 = 0; >+puts("getaddrinfo"); >+ > /* We might need information about what interfaces are available. > Also determine whether we have IPv4 or IPv6 interfaces or both. We > cannot cache the results since new interfaces could be added at > any time. */ > __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen); >+ __vda_seen_ipv4 = seen_ipv4; >+ __vda_seen_ipv6 = seen_ipv6; >+printf("seen_ipv6:%d\n", seen_ipv6); > > if (hints->ai_flags & AI_ADDRCONFIG) > { > /* Now make a decision on what we return, if anything. */ >- if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6)) >+ /* <= SEEN_IPVx_HOST means no addresses of this kind, or only loopback */ >+ if (seen_ipv4 <= SEEN_IPVx_HOST && seen_ipv6 <= SEEN_IPVx_HOST) >+ { >+ /* We cannot possibly return a valid answer. */ >+ free (in6ai); >+ return EAI_NONAME; >+ } >+ else if (hints->ai_family == PF_UNSPEC) > { > /* If we haven't seen both IPv4 and IPv6 interfaces we can > narrow down the search. */ >- if (! seen_ipv4 || ! seen_ipv6) >+ if (seen_ipv4 <= SEEN_IPVx_HOST || seen_ipv6 <= SEEN_IPVx_HOST) > { > local_hints = *hints; >- local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6; >+ local_hints.ai_family = (seen_ipv6 <= SEEN_IPVx_HOST) ? PF_INET : PF_INET6; > hints = &local_hints; > } > } >- else if ((hints->ai_family == PF_INET && ! seen_ipv4) >- || (hints->ai_family == PF_INET6 && ! seen_ipv6)) >+ else if ((hints->ai_family == PF_INET && seen_ipv4 <= SEEN_IPVx_HOST) >+ || (hints->ai_family == PF_INET6 && seen_ipv6 <= SEEN_IPVx_HOST)) > { > /* We cannot possibly return a valid answer. */ > free (in6ai); >diff -urp glibc-2.8.org/sysdeps/unix/sysv/linux/check_pf.c glibc-2.8/sysdeps/unix/sysv/linux/check_pf.c >--- glibc-2.8.org/sysdeps/unix/sysv/linux/check_pf.c 2008-04-16 20:56:54.000000000 +0200 >+++ glibc-2.8/sysdeps/unix/sysv/linux/check_pf.c 2008-09-04 12:56:16.000000000 +0200 >@@ -44,7 +44,7 @@ > > > static int >-make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6, >+make_request (int fd, pid_t pid, int *seen_ipv4, int *seen_ipv6, > struct in6addrinfo **in6ai, size_t *in6ailen) > { > struct req >@@ -99,8 +99,9 @@ make_request (int fd, pid_t pid, bool *s > sizeof (nladdr))) < 0) > goto out_fail; > >- *seen_ipv4 = false; >- *seen_ipv6 = false; >+puts("seen_ipv4 = seen_ipv6 = 0"); >+ *seen_ipv4 = SEEN_IPVx_NONE; >+ *seen_ipv6 = SEEN_IPVx_NONE; > > bool done = false; > struct in6ailist >@@ -170,14 +171,29 @@ make_request (int fd, pid_t pid, bool *s > out: > if (ifam->ifa_family == AF_INET) > { >- if (*(const in_addr_t *) address >- != htonl (INADDR_LOOPBACK)) >- *seen_ipv4 = true; >+ if (*seen_ipv4 < SEEN_IPVx_HOST) >+ *seen_ipv4 = SEEN_IPVx_HOST; >+ if (ifam->ifa_scope != RT_SCOPE_HOST) /* *(const in_addr_t *) address != htonl (INADDR_LOOPBACK) - wrong */ >+ { >+ if (*seen_ipv4 < SEEN_IPVx_LINK) >+ *seen_ipv4 = SEEN_IPVx_LINK; >+ if (ifam->ifa_scope != RT_SCOPE_LINK) >+ *seen_ipv4 = SEEN_IPVx_ROUTABLE; >+ } >+printf("seen_ipv4 = %d\n", *seen_ipv4); > } >- else >+ else if (ifam->ifa_family == AF_INET6) > { >- if (!IN6_IS_ADDR_LOOPBACK (address)) >- *seen_ipv6 = true; >+ if (*seen_ipv6 < SEEN_IPVx_HOST) >+ *seen_ipv6 = SEEN_IPVx_HOST; >+ if (ifam->ifa_scope != RT_SCOPE_HOST) /* !IN6_IS_ADDR_LOOPBACK (address) - wrong */ >+ { >+ if (*seen_ipv6 < SEEN_IPVx_LINK) >+ *seen_ipv6 = SEEN_IPVx_LINK; >+ if (ifam->ifa_scope != RT_SCOPE_LINK) >+ *seen_ipv6 = SEEN_IPVx_ROUTABLE; >+ } >+printf("seen_ipv6 = %d\n", *seen_ipv6); > } > } > >@@ -252,7 +268,7 @@ extern int __no_netlink_support attribut > > void > attribute_hidden >-__check_pf (bool *seen_ipv4, bool *seen_ipv6, >+__check_pf (int *seen_ipv4, int *seen_ipv6, > struct in6addrinfo **in6ai, size_t *in6ailen) > { > *in6ai = NULL; >@@ -285,8 +301,8 @@ __check_pf (bool *seen_ipv4, bool *seen_ > #else > /* We cannot determine what interfaces are available. Be > pessimistic. */ >- *seen_ipv4 = true; >- *seen_ipv6 = true; >+ *seen_ipv4 = SEEN_IPVx_ROUTABLE; >+ *seen_ipv6 = SEEN_IPVx_ROUTABLE; > #endif > } > >@@ -297,17 +313,17 @@ __check_pf (bool *seen_ipv4, bool *seen_ > { > /* We cannot determine what interfaces are available. Be > pessimistic. */ >- *seen_ipv4 = true; >- *seen_ipv6 = true; >+ *seen_ipv4 = SEEN_IPVx_ROUTABLE; >+ *seen_ipv6 = SEEN_IPVx_ROUTABLE; > return; > } > > struct ifaddrs *runp; > for (runp = ifa; runp != NULL; runp = runp->ifa_next) > if (runp->ifa_addr->sa_family == PF_INET) >- *seen_ipv4 = true; >+ *seen_ipv4 = SEEN_IPVx_ROUTABLE; > else if (runp->ifa_addr->sa_family == PF_INET6) >- *seen_ipv6 = true; >+ *seen_ipv6 = SEEN_IPVx_ROUTABLE; > > (void) freeifaddrs (ifa); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 459756
:
315304
|
315305
|
315374
|
315375
|
315376
|
315377
|
315378
|
315555
| 315735 |
315736
|
325068
|
325069
|
325070
|
325071
|
325104
|
327953