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