Bug#632660: netstat: patch for wide failure for UDP/RAW

Mats Erik Andersson mats.andersson at gisladisker.se
Mon Sep 19 20:19:26 UTC 2011


merge 632660 590056
thanks

May I suggest the resolution of said bug report. Only a straight
recalculation of the position would be needed in order to insert
the difference text into

   debian/patches/Bug#254243-netstat.c-wide-opt.patch

The patch included in #508110 should be applied at the same time,
since it remedies distorted output for site-local and link-local
addresses.

Best regards,
  Mats Erik Andersson, DM


Description: Implement wide printing for UDP and RAW.
 Said protocols did not see the intended modifications
 that allows long addresses printed in full.
Last-Update: 2011-09-18
X-Comment: Will force a computation of 
 debian/patches/Bug#254243-netstat.c-wide-opt.patch

--- net-tools-1.60/netstat.c.debian
+++ net-tools-1.60/netstat.c
@@ -946,8 +946,10 @@ static void udp_do_one(int lnr, const ch
 	snprintf(buffer, sizeof(buffer), "%s",
 		 get_sname(htons(local_port), "udp",
 			   flag_not & FLAG_NUM_PORT));
-	if ((strlen(local_addr) + strlen(buffer)) > 22)
-	    local_addr[22 - strlen(buffer)] = '\0';
+        if (!flag_wide) {
+	    if ((strlen(local_addr) + strlen(buffer)) > 22)
+                local_addr[22 - strlen(buffer)] = '\0';
+        }
 	strcat(local_addr, ":");
 	strcat(local_addr, buffer);
 
@@ -955,8 +957,10 @@ static void udp_do_one(int lnr, const ch
 		 get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT));
         safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, 
 					  flag_not), sizeof(rem_addr));
-	if ((strlen(rem_addr) + strlen(buffer)) > 22)
-	    rem_addr[22 - strlen(buffer)] = '\0';
+        if (!flag_wide) {
+	    if ((strlen(rem_addr) + strlen(buffer)) > 22)
+                rem_addr[22 - strlen(buffer)] = '\0';
+        }
 	strcat(rem_addr, ":");
 	strcat(rem_addr, buffer);
 
@@ -1068,8 +1072,10 @@ static void raw_do_one(int lnr, const ch
 			   flag_not & FLAG_NUM_PORT));
         safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, 
 					    flag_not), sizeof(local_addr));
-	if ((strlen(local_addr) + strlen(buffer)) > 22)
-	    local_addr[22 - strlen(buffer)] = '\0';
+        if (!flag_wide) {
+	    if ((strlen(local_addr) + strlen(buffer)) > 22)
+                local_addr[22 - strlen(buffer)] = '\0';
+        }
 	strcat(local_addr, ":");
 	strcat(local_addr, buffer);
 
@@ -1077,8 +1083,10 @@ static void raw_do_one(int lnr, const ch
 		 get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT));
         safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, 
 					  flag_not), sizeof(rem_addr));
-	if ((strlen(rem_addr) + strlen(buffer)) > 22)
-	    rem_addr[22 - strlen(buffer)] = '\0';
+        if (!flag_wide) {
+	    if ((strlen(rem_addr) + strlen(buffer)) > 22)
+                rem_addr[22 - strlen(buffer)] = '\0';
+        }
 	strcat(rem_addr, ":");
 	strcat(rem_addr, buffer);
 





More information about the Pkg-net-tools-maintainers mailing list