e38f15
From eae1b58c5a9f074f79a0edfaeb1cf7a4e77a34cb Mon Sep 17 00:00:00 2001
e38f15
From: Michal Sekletar <sekletar.m@gmail.com>
e38f15
Date: Tue, 24 Sep 2013 12:56:11 +0200
e38f15
Subject: [PATCH] dns: iterate over all configured nameservers
e38f15
e38f15
Previously if there were three nameservers configured and third one was
e38f15
reachable via IPv6 we didn't sent query to it, since NSCOUNT6 was equal to
e38f15
one. Clearly it was the original intention to sent query to all IPv6
e38f15
nameservers.
e38f15
e38f15
Reported-by: Benedikt Gollatz <benedikt@gollatz.net>
e38f15
---
e38f15
 dns.c | 8 ++++----
e38f15
 1 file changed, 4 insertions(+), 4 deletions(-)
e38f15
e38f15
diff --git a/dns.c b/dns.c
e38f15
index 221665d..e89fd4b 100644
e38f15
--- a/dns.c
e38f15
+++ b/dns.c
e38f15
@@ -938,7 +938,7 @@ void dorequest(char *s,int type,word id)
e38f15
   hp->id = id;	/* htons() deliberately left out (redundant) */
e38f15
 #ifdef ENABLE_IPV6
e38f15
   if (resfd6 > 0) {
e38f15
-    for (i = 0;i < NSCOUNT6;i++) {
e38f15
+    for (i = 0;i < myres.nscount;i++) {
e38f15
       if (!NSSOCKADDR6(i))
e38f15
 	continue;
e38f15
       if (NSSOCKADDR6(i)->sin6_family == AF_INET6)
e38f15
@@ -1342,7 +1342,7 @@ void dns_ack6(void)
e38f15
     /* Check to see if this server is actually one we sent to */
e38f15
     if ( addrcmp( (void *) &(from6->sin6_addr), (void *) &localhost6,
e38f15
                   (int) AF_INET6 ) == 0 ) {
e38f15
-      for (i = 0;i < NSCOUNT6;i++) {
e38f15
+      for (i = 0;i < myres.nscount;i++) {
e38f15
         if (!NSSOCKADDR6(i))
e38f15
           continue;
e38f15
 
e38f15
@@ -1353,14 +1353,14 @@ void dns_ack6(void)
e38f15
 	  break;
e38f15
       }
e38f15
     } else
e38f15
-      for (i = 0;i < NSCOUNT6;i++) {
e38f15
+      for (i = 0;i < myres.nscount;i++) {
e38f15
         if (!NSSOCKADDR6(i))
e38f15
           continue;
e38f15
 	if ( addrcmp( (void *) &(NSSOCKADDR6(i)->sin6_addr),
e38f15
 		      (void *) &(from6->sin6_addr), AF_INET6 ) == 0 )
e38f15
 	  break;
e38f15
       }
e38f15
-    if (i == NSCOUNT6) {
e38f15
+    if (i == myres.nscount) {
e38f15
       snprintf(tempstring, sizeof(tempstring), 
e38f15
 	       "Resolver error: Received reply from unknown source: %s",
e38f15
 	       inet_ntop( AF_INET6, &(from6->sin6_addr), addrstr,
e38f15
-- 
e38f15
1.8.3.1
e38f15