fa3bfd
Related upstream commit (this bug has been fixed upstream in a
fa3bfd
different way):
fa3bfd
fa3bfd
commit 2212c1420c92a33b0e0bd9a34938c9814a56c0f7
fa3bfd
Author: Andreas Schwab <schwab@suse.de>
fa3bfd
Date:   Thu Feb 19 15:52:08 2015 +0100
fa3bfd
fa3bfd
    Simplify handling of nameserver configuration in resolver
fa3bfd
    
fa3bfd
    Remove use of ext.nsmap member of struct __res_state and always use
fa3bfd
    an identity mapping betwen the nsaddr_list array and the ext.nsaddrs
fa3bfd
    array.  The fact that a nameserver has an IPv6 address is signalled by
fa3bfd
    setting nsaddr_list[].sin_family to zero.
fa3bfd
12745e
diff -rup glibc-2.17-c758a686/resolv/res_init.c glibc-2.17-c758a686/resolv/res_init.c
12745e
--- glibc-2.17-c758a686/resolv/res_init.c	2012-07-26 15:10:45.655638776 -0600
12745e
+++ glibc-2.17-c758a686/resolv/res_init.c	2012-07-26 15:11:27.731423002 -0600
29e444
@@ -314,9 +314,9 @@ __res_vinit(res_state statp, int preinit
29e444
 			cp++;
29e444
 		    if ((*cp != '\0') && (*cp != '\n')
29e444
 			&& __inet_aton(cp, &a)) {
29e444
-			statp->nsaddr_list[nservall].sin_addr = a;
29e444
-			statp->nsaddr_list[nservall].sin_family = AF_INET;
29e444
-			statp->nsaddr_list[nservall].sin_port =
29e444
+			statp->nsaddr_list[nserv].sin_addr = a;
29e444
+			statp->nsaddr_list[nserv].sin_family = AF_INET;
29e444
+			statp->nsaddr_list[nserv].sin_port =
29e444
 				htons(NAMESERVER_PORT);
29e444
 			nserv++;
29e444
 #ifdef _LIBC
12745e
diff -rup glibc-2.17-c758a686/resolv/res_send.c glibc-2.17-c758a686/resolv/res_send.c
12745e
--- glibc-2.17-c758a686/resolv/res_send.c	2010-05-04 05:27:23.000000000 -0600
12745e
+++ glibc-2.17-c758a686/resolv/res_send.c	2012-07-26 15:34:58.398261659 -0600
29e444
@@ -421,10 +421,10 @@ __libc_res_nsend(res_state statp, const
29e444
 				EXT(statp).nsmap[n] = MAXNS;
29e444
 			}
29e444
 		}
29e444
-		n = statp->nscount;
29e444
-		if (statp->nscount > EXT(statp).nscount)
29e444
+		n = statp->nscount - EXT(statp).nscount6;
29e444
+		if (n > EXT(statp).nscount)
29e444
 			for (n = EXT(statp).nscount, ns = 0;
29e444
-			     n < statp->nscount; n++) {
29e444
+			     n < statp->nscount - EXT(statp).nscount6; n++) {
29e444
 				while (ns < MAXNS
29e444
 				       && EXT(statp).nsmap[ns] != MAXNS)
29e444
 					ns++;
29e444
@@ -441,7 +441,7 @@ __libc_res_nsend(res_state statp, const
29e444
 				    malloc(sizeof (struct sockaddr_in6));
29e444
 			if (EXT(statp).nsaddrs[n] != NULL) {
29e444
 				memset (mempcpy(EXT(statp).nsaddrs[n],
29e444
-						&statp->nsaddr_list[n],
29e444
+						&statp->nsaddr_list[ns],
29e444
 						sizeof (struct sockaddr_in)),
29e444
 					'\0',
29e444
 					sizeof (struct sockaddr_in6)