From 70f281edd0097e2c4c7e42b15b6e3368a6d5fcd2 Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Tue, 1 Oct 2013 14:33:10 +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 Resolves: #966174 --- mtr-query-all-ipv6-nameservers.patch | 57 ++++++++++++++++++++++++++++ mtr.spec | 3 ++ 2 files changed, 60 insertions(+) create mode 100644 mtr-query-all-ipv6-nameservers.patch diff --git a/mtr-query-all-ipv6-nameservers.patch b/mtr-query-all-ipv6-nameservers.patch new file mode 100644 index 0000000..c5f11c1 --- /dev/null +++ b/mtr-query-all-ipv6-nameservers.patch @@ -0,0 +1,57 @@ +From eae1b58c5a9f074f79a0edfaeb1cf7a4e77a34cb Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +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 +--- + 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 + diff --git a/mtr.spec b/mtr.spec index 14d26f1..f434f3c 100644 --- a/mtr.spec +++ b/mtr.spec @@ -20,6 +20,7 @@ Patch2: mtr-xml-format-fixes.patch Patch3: mtr-default-hostname.patch Patch4: mtr-ipv6-on-ipv4-only.patch Patch5: mtr-introduce-grace-period.patch +Patch6: mtr-query-all-ipv6-nameservers.patch BuildRequires: ncurses-devel gtk2-devel desktop-file-utils BuildRequires: autoconf automake libtool @@ -47,6 +48,7 @@ diagnostic tool. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build export CFLAGS="%{optflags} -fPIE" @@ -95,6 +97,7 @@ desktop-file-install \ - migrate from consolehelper to policykit (#502750) - specfile cleanup - introduce grace period (#1009051) +- query all ipv6 nameservers (#966174) * Sat Sep 14 2013 Michal Sekletar - 2:0.85-3 - enable hardened build