Package: ntp
Version: 1:4.2.6.p5+dfsg-2
Tags: patch

There are format errors in some prints of ntpsweep. Further there are
problems with IPv6 addresses. Attached is a patch for these issues.

   Thorsten
--- /usr/bin/ntpsweep.org	2012-09-19 12:48:38.000000000 +0200
+++ /usr/bin/ntpsweep	2012-09-20 12:29:35.000000000 +0200
@@ -105,8 +105,13 @@
 sub ip2name {
     my($ip) = @_;
     my($addr, $name, $aliases, $addrtype, $length, @addrs);
-    $addr = pack('C4', split(/\./, $ip));
-    ($name, $aliases, $addrtype, $length, @addrs) = gethostbyaddr($addr, 2);
+    if( $ip =~ m/^(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)$/ ) {
+      # it is ipv4
+      $addr = pack('C4', split(/\./, $ip));
+      ($name, $aliases, $addrtype, $length, @addrs) = gethostbyaddr($addr, 2);
+    } else {
+        # no ipv4 so it is ipv6
+    }
     if ($name) {
         # return lower case name
 	return("\L$name");
@@ -252,7 +257,7 @@
 		    if ($strip) {
 			$printhost =~ s/$strip//;
 		    }
-		    printf("%-32s %s\n",
+		    printf("%-32s\n",
 			substr($printhost,0,32));
 		} else {
 		    if (substr($peer,0,3) ne "127") {

Reply via email to