Author: aurel32
Date: 2010-01-15 15:47:15 +0000 (Fri, 15 Jan 2010)
New Revision: 4084

Modified:
   glibc-package/trunk/debian/patches/any/cvs-resolv-bindv6only.diff
   glibc-package/trunk/debian/patches/any/local-no-SOCK_NONBLOCK.diff
Log:
Update to upstream patch


Modified: glibc-package/trunk/debian/patches/any/cvs-resolv-bindv6only.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/cvs-resolv-bindv6only.diff   
2010-01-15 14:23:07 UTC (rev 4083)
+++ glibc-package/trunk/debian/patches/any/cvs-resolv-bindv6only.diff   
2010-01-15 15:47:15 UTC (rev 4084)
@@ -1,23 +1,40 @@
-2009-01-06  Aurelien Jarno <aurel...@aurel32.net>
+2010-01-14  Ulrich Drepper  <drep...@redhat.com>
+ 
+       [BZ #11141]
+       * resolv/res_send.c (reopen): Don't use IPv6 sockets for IPv4
+       addresses.
 
-        * resolv/res_send.c (reopen): Don't use IPv4-mapped addresses.
-       Create PF_INET sockets for IPv4 addresses and PF_INET6 sockets 
-       for IPv6 ones.
-
 diff --git a/resolv/res_send.c b/resolv/res_send.c
-index e2bbfcc..b2c9cf5 100644
+index e2bbfcc..28a47e4 100644
 --- a/resolv/res_send.c
 +++ b/resolv/res_send.c
-@@ -914,7 +914,7 @@ reopen (res_state statp, int *terrno, int ns)
-               struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+@@ -199,10 +199,6 @@ static void               Perror(const res_state, FILE *, 
const char *, int);
+ #endif
+ static int            sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *);
  
+-/* Reachover. */
+-
+-static void convaddr4to6(struct sockaddr_in6 *sa);
+-
+ /* Public. */
+ 
+ /* int
+@@ -911,10 +907,12 @@ static int
+ reopen (res_state statp, int *terrno, int ns)
+ {
+       if (EXT(statp).nssocks[ns] == -1) {
+-              struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
++              struct sockaddr *nsap
++                = (struct sockaddr *) EXT(statp).nsaddrs[ns];
++              socklen_t slen;
+ 
                /* only try IPv6 if IPv6 NS and if not failed before */
 -              if ((EXT(statp).nscount6 > 0) && !statp->ipv6_unavail) {
-+              if (nsap->sin6_family == AF_INET6 && !statp->ipv6_unavail) {
++              if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) {
                        if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
                                EXT(statp).nssocks[ns] =
                                  socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
-@@ -931,12 +931,7 @@ reopen (res_state statp, int *terrno, int ns)
+@@ -931,12 +929,8 @@ reopen (res_state statp, int *terrno, int ns)
                                  socket(PF_INET6, SOCK_DGRAM, 0);
                        if (EXT(statp).nssocks[ns] < 0)
                            statp->ipv6_unavail = errno == EAFNOSUPPORT;
@@ -27,7 +44,52 @@
 -                          convaddr4to6(nsap);
 -              }
 -              if (EXT(statp).nssocks[ns] < 0) {
-+              } else if (nsap->sin6_family == AF_INET) {
++                      slen = sizeof (struct sockaddr_in6);
++              } else if (nsap->sa_family == AF_INET) {
                        if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
                                EXT(statp).nssocks[ns]
                                  = socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
+@@ -951,6 +945,7 @@ reopen (res_state statp, int *terrno, int ns)
+                       if (__builtin_expect (__have_o_nonblock < 0, 0))
+                               EXT(statp).nssocks[ns]
+                                 = socket(PF_INET, SOCK_DGRAM, 0);
++                      slen = sizeof (struct sockaddr_in);
+               }
+               if (EXT(statp).nssocks[ns] < 0) {
+                       *terrno = errno;
+@@ -969,10 +964,8 @@ reopen (res_state statp, int *terrno, int ns)
+                * error message is received.  We can thus detect
+                * the absence of a nameserver without timing out.
+                */
+-              if (connect(EXT(statp).nssocks[ns], (struct sockaddr *)nsap,
+-                          sizeof *nsap) < 0) {
+-                      Aerror(statp, stderr, "connect(dg)", errno,
+-                             (struct sockaddr *) nsap);
++              if (connect(EXT(statp).nssocks[ns], nsap, slen) < 0) {
++                      Aerror(statp, stderr, "connect(dg)", errno, nsap);
+                       __res_iclose(statp, false);
+                       return (0);
+               }
+@@ -1415,22 +1408,3 @@ sock_eq(struct sockaddr_in6 *a1, struct sockaddr_in6 
*a2) {
+               (a1->sin6_addr.s6_addr32[3] ==
+                ((struct sockaddr_in *)a2)->sin_addr.s_addr));
+ }
+-
+-/*
+- * Converts IPv4 family, address and port to
+- * IPv6 family, IPv4-mapped IPv6 address and port.
+- */
+-static void
+-convaddr4to6(struct sockaddr_in6 *sa)
+-{
+-    struct sockaddr_in *sa4p = (struct sockaddr_in *) sa;
+-    in_port_t port = sa4p->sin_port;
+-    in_addr_t addr = sa4p->sin_addr.s_addr;
+-
+-    sa->sin6_family = AF_INET6;
+-    sa->sin6_port = port;
+-    sa->sin6_addr.s6_addr32[0] = 0;
+-    sa->sin6_addr.s6_addr32[1] = 0;
+-    sa->sin6_addr.s6_addr32[2] = htonl(0xFFFF);
+-    sa->sin6_addr.s6_addr32[3] = addr;
+-}

Modified: glibc-package/trunk/debian/patches/any/local-no-SOCK_NONBLOCK.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/local-no-SOCK_NONBLOCK.diff  
2010-01-15 14:23:07 UTC (rev 4083)
+++ glibc-package/trunk/debian/patches/any/local-no-SOCK_NONBLOCK.diff  
2010-01-15 15:47:15 UTC (rev 4084)
@@ -16,15 +16,15 @@
  
  /* From ev_streams.c.  */
  
-@@ -915,6 +915,7 @@
+@@ -913,6 +913,7 @@
  
                /* only try IPv6 if IPv6 NS and if not failed before */
-               if (nsap->sin6_family == AF_INET6 && !statp->ipv6_unavail) {
+               if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) {
 +#ifdef SOCK_NONBLOCK
                        if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
                                EXT(statp).nssocks[ns] =
                                  socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
-@@ -927,11 +928,13 @@
+@@ -925,12 +926,14 @@
  #endif
                        }
                        if (__builtin_expect (__have_o_nonblock < 0, 0))
@@ -33,20 +33,21 @@
                                  socket(PF_INET6, SOCK_DGRAM, 0);
                        if (EXT(statp).nssocks[ns] < 0)
                            statp->ipv6_unavail = errno == EAFNOSUPPORT;
-               } else if (nsap->sin6_family == AF_INET) {
+                       slen = sizeof (struct sockaddr_in6);
+               } else if (nsap->sa_family == AF_INET) {
 +#ifdef SOCK_NONBLOCK
                        if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
                                EXT(statp).nssocks[ns]
                                  = socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
-@@ -944,6 +947,7 @@
+@@ -943,6 +946,7 @@
  #endif
                        }
                        if (__builtin_expect (__have_o_nonblock < 0, 0))
 +#endif
                                EXT(statp).nssocks[ns]
                                  = socket(PF_INET, SOCK_DGRAM, 0);
-               }
-@@ -971,7 +975,11 @@
+                       slen = sizeof (struct sockaddr_in);
+@@ -969,7 +973,11 @@
                        __res_iclose(statp, false);
                        return (0);
                }


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

Reply via email to