dns: iterate over all configured nameservers

Previously if there were three nameservers configured and third one was
reachable via IPv6 we didn't sent query to it, since NSCOUNT6 was equal to
one. Clearly it was the original intention to sent query to all IPv6
nameservers.

Reported-by: Benedikt Gollatz <benedikt@gollatz.net>

Resolves: #966174
This commit is contained in:
Michal Sekletar 2013-10-01 14:33:10 +02:00
parent 2e311d4e97
commit 70f281edd0
2 changed files with 60 additions and 0 deletions

View File

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

View File

@ -20,6 +20,7 @@ Patch2: mtr-xml-format-fixes.patch
Patch3: mtr-default-hostname.patch Patch3: mtr-default-hostname.patch
Patch4: mtr-ipv6-on-ipv4-only.patch Patch4: mtr-ipv6-on-ipv4-only.patch
Patch5: mtr-introduce-grace-period.patch Patch5: mtr-introduce-grace-period.patch
Patch6: mtr-query-all-ipv6-nameservers.patch
BuildRequires: ncurses-devel gtk2-devel desktop-file-utils BuildRequires: ncurses-devel gtk2-devel desktop-file-utils
BuildRequires: autoconf automake libtool BuildRequires: autoconf automake libtool
@ -47,6 +48,7 @@ diagnostic tool.
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1
%build %build
export CFLAGS="%{optflags} -fPIE" export CFLAGS="%{optflags} -fPIE"
@ -95,6 +97,7 @@ desktop-file-install \
- migrate from consolehelper to policykit (#502750) - migrate from consolehelper to policykit (#502750)
- specfile cleanup - specfile cleanup
- introduce grace period (#1009051) - introduce grace period (#1009051)
- query all ipv6 nameservers (#966174)
* Sat Sep 14 2013 Michal Sekletar <msekleta@redhat.com> - 2:0.85-3 * Sat Sep 14 2013 Michal Sekletar <msekleta@redhat.com> - 2:0.85-3
- enable hardened build - enable hardened build