[arch-commits] Commit in mtr/trunk (5 files)

Evangelos Foutras foutrelis at archlinux.org
Wed Dec 3 19:30:59 UTC 2014


    Date: Wednesday, December 3, 2014 @ 20:30:59
  Author: foutrelis
Revision: 227274

upgpkg: mtr 0.85-3

Fix FS#42931: Name lookup failure with ipv6 stack disabled

Added:
  mtr/trunk/0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch
  mtr/trunk/0001-core-introduce-grace-period.patch
  mtr/trunk/0001-dns-iterate-over-all-configured-nameservers.patch
Modified:
  mtr/trunk/PKGBUILD
Deleted:
  mtr/trunk/mtr-0.85-grace-period.patch

-----------------------------------------------------------------+
 0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch |  118 ++++++++++
 0001-core-introduce-grace-period.patch                          |   74 ++++++
 0001-dns-iterate-over-all-configured-nameservers.patch          |   57 ++++
 PKGBUILD                                                        |   14 -
 mtr-0.85-grace-period.patch                                     |   71 ------
 5 files changed, 259 insertions(+), 75 deletions(-)

Added: 0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch
===================================================================
--- 0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch	                        (rev 0)
+++ 0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch	2014-12-03 19:30:59 UTC (rev 227274)
@@ -0,0 +1,118 @@
+From 12c53f98e44598b87d3f2308e0d892f49d7af8e4 Mon Sep 17 00:00:00 2001
+From: Roger Wolff <R.E.Wolff at BitWizard.nl>
+Date: Tue, 16 Jul 2013 13:59:52 +0200
+Subject: [PATCH] Fix bombout with ipv6 enabled binary on ipv4 only system.
+
+---
+ dns.c    | 33 +++++++++++++++++++++------------
+ gtk.c    |  6 ++++--
+ select.c |  8 ++++++--
+ 3 files changed, 31 insertions(+), 16 deletions(-)
+
+diff --git a/dns.c b/dns.c
+index 371934f..221665d 100644
+--- a/dns.c
++++ b/dns.c
+@@ -529,10 +529,12 @@ void dns_open(void)
+ #ifdef ENABLE_IPV6
+   resfd6 = socket(AF_INET6, SOCK_DGRAM, 0);
+   if (resfd6 == -1) {
++    // consider making removing this warning. For now leave it in to see 
++    // new code activated. -- REW
+     fprintf(stderr,
+             "Unable to allocate IPv6 socket for nameserver communication: %s\n",
+ 	    strerror(errno));
+-    exit(-1);
++    //    exit(-1);
+   }
+ #endif
+   option = 1;
+@@ -543,11 +545,13 @@ void dns_open(void)
+     exit(-1);
+   }
+ #ifdef ENABLE_IPV6
+-  if (setsockopt(resfd6,SOL_SOCKET,SO_BROADCAST,(char *)&option,sizeof(option))) {
+-    fprintf(stderr,
+-            "Unable to setsockopt() on IPv6 nameserver communication socket: %s\n",
+-	    strerror(errno));
+-    exit(-1);
++  if (resfd6 > 0) {
++    if (setsockopt(resfd6,SOL_SOCKET,SO_BROADCAST,(char *)&option,sizeof(option))) {
++      fprintf(stderr,
++	      "Unable to setsockopt() on IPv6 nameserver communication socket: %s\n",
++	      strerror(errno));
++      exit(-1);
++    }
+   }
+ #endif
+   longipstr( "127.0.0.1", &localhost, AF_INET );
+@@ -933,12 +937,14 @@ void dorequest(char *s,int type,word id)
+   hp = (packetheader *)buf;
+   hp->id = id;	/* htons() deliberately left out (redundant) */
+ #ifdef ENABLE_IPV6
+-  for (i = 0;i < NSCOUNT6;i++) {
+-    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));
++  if (resfd6 > 0) {
++    for (i = 0;i < NSCOUNT6;i++) {
++      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++)
+@@ -1327,6 +1333,9 @@ void dns_ack6(void)
+   int r,i;
+   static char addrstr[INET6_ADDRSTRLEN];
+ 
++  // Probably not necessary. -- REW
++  if (resfd6 < 0) return; 
++
+   r = recvfrom(resfd6,(byte *)resrecvbuf,MaxPacketsize,0,
+                from, &fromlen);
+   if (r > 0) {
+diff --git a/gtk.c b/gtk.c
+index d00f769..38ed507 100644
+--- a/gtk.c
++++ b/gtk.c
+@@ -615,8 +615,10 @@ void gtk_loop(void)
+   net_iochannel = g_io_channel_unix_new(net_waitfd());
+   g_io_add_watch(net_iochannel, G_IO_IN, gtk_net_data, NULL);
+ #ifdef ENABLE_IPV6
+-  dns_iochannel = g_io_channel_unix_new(dns_waitfd6());
+-  g_io_add_watch(dns_iochannel, G_IO_IN, gtk_dns_data6, NULL);
++  if (dns_waitfd6() > 0) {
++    dns_iochannel = g_io_channel_unix_new(dns_waitfd6());
++    g_io_add_watch(dns_iochannel, G_IO_IN, gtk_dns_data6, NULL);
++  }
+ #endif
+   dns_iochannel = g_io_channel_unix_new(dns_waitfd());
+   g_io_add_watch(dns_iochannel, G_IO_IN, gtk_dns_data, NULL);
+diff --git a/select.c b/select.c
+index 0545d9f..e7c397e 100644
+--- a/select.c
++++ b/select.c
+@@ -80,8 +80,12 @@ void select_loop(void) {
+ #ifdef ENABLE_IPV6
+     if (dns) {
+       dnsfd6 = dns_waitfd6();
+-      FD_SET(dnsfd6, &readfd);
+-      if(dnsfd6 >= maxfd) maxfd = dnsfd6 + 1;
++      if (dnsfd6 >= 0) {
++        FD_SET(dnsfd6, &readfd);
++        if(dnsfd6 >= maxfd) maxfd = dnsfd6 + 1;
++      } else {
++        dnsfd6 = 0;
++      }
+     } else
+       dnsfd6 = 0;
+ #endif
+-- 
+2.1.3
+

Added: 0001-core-introduce-grace-period.patch
===================================================================
--- 0001-core-introduce-grace-period.patch	                        (rev 0)
+++ 0001-core-introduce-grace-period.patch	2014-12-03 19:30:59 UTC (rev 227274)
@@ -0,0 +1,74 @@
+From 6ce1601b27fdd95b44ed65d7fd83604860276d63 Mon Sep 17 00:00:00 2001
+From: Michal Sekletar <sekletar.m at gmail.com>
+Date: Tue, 17 Sep 2013 16:11:20 +0200
+Subject: [PATCH] core: introduce grace period
+
+In report mode we break out from select loop immediately after we reach
+maximum count of iterations. But we should wait for packets which are still on
+the way.
+
+In order to fix the issue we introduce grace period during which we don't send
+out more packets but we just wait for responses which might be still on the way.
+
+resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1009051
+---
+ select.c | 26 +++++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/select.c b/select.c
+index 29088fd..31bfd5f 100644
+--- a/select.c
++++ b/select.c
+@@ -45,6 +45,8 @@ static struct timeval intervaltime;
+ int display_offset = 0;
+ 
+ 
++#define GRACETIME (5 * 1000*1000)
++
+ void select_loop(void) {
+   fd_set readfd;
+   fd_set writefd;
+@@ -57,8 +59,12 @@ void select_loop(void) {
+   int NumPing = 0;
+   int paused = 0;
+   struct timeval lasttime, thistime, selecttime;
++  struct timeval startgrace;
+   int dt;
+   int rv; 
++  int graceperiod = 0;
++
++  memset(&startgrace, 0, sizeof(startgrace));
+ 
+   gettimeofday(&lasttime, NULL);
+ 
+@@ -124,10 +130,24 @@ void select_loop(void) {
+ 	   (thistime.tv_sec == lasttime.tv_sec + intervaltime.tv_sec &&
+ 	    thistime.tv_usec >= lasttime.tv_usec + intervaltime.tv_usec)) {
+ 	  lasttime = thistime;
+-	  if(NumPing >= MaxPing && (!Interactive || ForceMaxPing))
++
++	  if (!graceperiod) {
++	    if (NumPing >= MaxPing && (!Interactive || ForceMaxPing)) {
++	      graceperiod = 1;
++	      startgrace = thistime;
++	    }
++
++	    /* do not send out batch when we've already initiated grace period */
++	    if (!graceperiod && net_send_batch())
++	      NumPing++;
++	  }
++	}
++
++	if (graceperiod) {
++	  dt = (thistime.tv_usec - startgrace.tv_usec) +
++		    1000000 * (thistime.tv_sec - startgrace.tv_sec);
++	  if (dt > GRACETIME)
+ 	    return;
+-	  if (net_send_batch())
+-	    NumPing++;
+ 	}
+ 
+ 	selecttime.tv_usec = (thistime.tv_usec - lasttime.tv_usec);
+-- 
+2.1.3
+

Added: 0001-dns-iterate-over-all-configured-nameservers.patch
===================================================================
--- 0001-dns-iterate-over-all-configured-nameservers.patch	                        (rev 0)
+++ 0001-dns-iterate-over-all-configured-nameservers.patch	2014-12-03 19:30:59 UTC (rev 227274)
@@ -0,0 +1,57 @@
+From eae1b58c5a9f074f79a0edfaeb1cf7a4e77a34cb Mon Sep 17 00:00:00 2001
+From: Michal Sekletar <sekletar.m at 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 at 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,
+-- 
+2.1.3
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-12-03 06:01:53 UTC (rev 227273)
+++ PKGBUILD	2014-12-03 19:30:59 UTC (rev 227274)
@@ -5,20 +5,26 @@
 pkgbase=mtr
 pkgname=(mtr mtr-gtk)
 pkgver=0.85
-pkgrel=2
+pkgrel=3
 arch=('i686' 'x86_64')
 url="http://www.bitwizard.nl/mtr/"
 license=('GPL')
 makedepends=('ncurses' 'gtk2')
 source=(ftp://ftp.bitwizard.nl/mtr/$pkgbase-$pkgver.tar.gz
-        mtr-0.85-grace-period.patch)
+        0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch
+        0001-core-introduce-grace-period.patch
+        0001-dns-iterate-over-all-configured-nameservers.patch)
 md5sums=('5e665c617e5659b6ec3e201ee7488eb1'
-         'c5d16e124a4734adeaaf3e0b83ef40fb')
+         '9750d5aed1cd20e19b1c7c5e2f75705b'
+         '1b3fe01c88411b1e09787724f0a95f31'
+         'e0f75febc4a3a0421a953af84dd1a0e7')
 
 prepare() {
     cd "$srcdir/$pkgbase-$pkgver"
 
-    patch -Np1 -i ../mtr-0.85-grace-period.patch
+    patch -Np1 -i ../0001-Fix-bombout-with-ipv6-enabled-binary-on-ipv4-only-sy.patch
+    patch -Np1 -i ../0001-core-introduce-grace-period.patch
+    patch -Np1 -i ../0001-dns-iterate-over-all-configured-nameservers.patch
 }
 
 build() {

Deleted: mtr-0.85-grace-period.patch
===================================================================
--- mtr-0.85-grace-period.patch	2014-12-03 06:01:53 UTC (rev 227273)
+++ mtr-0.85-grace-period.patch	2014-12-03 19:30:59 UTC (rev 227274)
@@ -1,71 +0,0 @@
-From 6ce1601b27fdd95b44ed65d7fd83604860276d63 Mon Sep 17 00:00:00 2001
-From: Michal Sekletar <sekletar.m at gmail.com>
-Date: Tue, 17 Sep 2013 16:11:20 +0200
-Subject: [PATCH] core: introduce grace period
-
-In report mode we break out from select loop immediately after we reach
-maximum count of iterations. But we should wait for packets which are still on
-the way.
-
-In order to fix the issue we introduce grace period during which we don't send
-out more packets but we just wait for responses which might be still on the way.
-
-resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1009051
----
- select.c | 26 +++++++++++++++++++++++---
- 1 file changed, 23 insertions(+), 3 deletions(-)
-
-diff --git a/select.c b/select.c
-index 29088fd..31bfd5f 100644
---- a/select.c
-+++ b/select.c
-@@ -45,6 +45,8 @@ static struct timeval intervaltime;
- int display_offset = 0;
- 
- 
-+#define GRACETIME (5 * 1000*1000)
-+
- void select_loop(void) {
-   fd_set readfd;
-   fd_set writefd;
-@@ -57,8 +59,12 @@ void select_loop(void) {
-   int NumPing = 0;
-   int paused = 0;
-   struct timeval lasttime, thistime, selecttime;
-+  struct timeval startgrace;
-   int dt;
-   int rv; 
-+  int graceperiod = 0;
-+
-+  memset(&startgrace, 0, sizeof(startgrace));
- 
-   gettimeofday(&lasttime, NULL);
- 
-@@ -124,10 +130,24 @@ void select_loop(void) {
- 	   (thistime.tv_sec == lasttime.tv_sec + intervaltime.tv_sec &&
- 	    thistime.tv_usec >= lasttime.tv_usec + intervaltime.tv_usec)) {
- 	  lasttime = thistime;
--	  if(NumPing >= MaxPing && (!Interactive || ForceMaxPing))
-+
-+	  if (!graceperiod) {
-+	    if (NumPing >= MaxPing && (!Interactive || ForceMaxPing)) {
-+	      graceperiod = 1;
-+	      startgrace = thistime;
-+	    }
-+
-+	    /* do not send out batch when we've already initiated grace period */
-+	    if (!graceperiod && net_send_batch())
-+	      NumPing++;
-+	  }
-+	}
-+
-+	if (graceperiod) {
-+	  dt = (thistime.tv_usec - startgrace.tv_usec) +
-+		    1000000 * (thistime.tv_sec - startgrace.tv_sec);
-+	  if (dt > GRACETIME)
- 	    return;
--	  if (net_send_batch())
--	    NumPing++;
- 	}
- 
- 	selecttime.tv_usec = (thistime.tv_usec - lasttime.tv_usec);



More information about the arch-commits mailing list