From a3924d410680562ccbc32bfc9d2877fe03e87fec Mon Sep 17 00:00:00 2001 From: aquerubin Date: Tue, 28 Jan 2014 14:50:06 -1000 Subject: [PATCH] Restore the name resolver query order to their relative position in /etc/resolv.conf (the IPv6 resolver patch I submitted earlier broke this normal, expected behaviour). Ie. currently, IPv6 resolvers are always queried before IPv4 resolvers regardless of their position in resolv.conf. Update my email address in AUTHORS. --- AUTHORS | 2 +- dns.c | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/AUTHORS b/AUTHORS index a86abc0f..c3ec5aff 100644 --- a/AUTHORS +++ b/AUTHORS @@ -25,7 +25,7 @@ Mike Simons Aaron Scarisbrick Craig Milo Rogers - Antonio Querubin + Antonio Querubin Russell Nelson Davin Milun Josh Martin diff --git a/dns.c b/dns.c index 4076b71d..32b83c2b 100644 --- a/dns.c +++ b/dns.c @@ -57,10 +57,8 @@ #ifdef ENABLE_IPV6 #ifdef __GLIBC__ -#define NSCOUNT6 myres._u._ext.nscount6 #define NSSOCKADDR6(i) (myres._u._ext.nsaddrs[i]) #else -#define NSCOUNT6 myres.nscount #define NSSOCKADDR6(i) (&(myres._u._ext.ext->nsaddrs[i].sin6)) #endif #endif @@ -937,21 +935,19 @@ void dorequest(char *s,int type,word id) } hp = (packetheader *)buf; hp->id = id; /* htons() deliberately left out (redundant) */ + for (i = 0;i < myres.nscount;i++) + if (myres.nsaddr_list[i].sin_family == AF_INET) + (void)sendto(resfd,buf,r,0,(struct sockaddr *)&myres.nsaddr_list[i], + sizeof(struct sockaddr)); #ifdef ENABLE_IPV6 - if (resfd6 > 0) { - for (i = 0;i < myres.nscount;i++) { + else if (resfd6 > 0) { if (!NSSOCKADDR6(i)) continue; if (NSSOCKADDR6(i)->sin6_family == AF_INET6) (void)sendto(resfd6,buf,r,0,(struct sockaddr *) NSSOCKADDR6(i), sizeof(struct sockaddr_in6)); } - } #endif - for (i = 0;i < myres.nscount;i++) - if (myres.nsaddr_list[i].sin_family == AF_INET) - (void)sendto(resfd,buf,r,0,(struct sockaddr *)&myres.nsaddr_list[i], - sizeof(struct sockaddr)); } void resendrequest(struct resolve *rp,int type)