Bug#254243: Patch for netstat to prevent chopping IPv6 addresses

martin f krafft madduck at debian.org
Tue Nov 11 07:54:01 UTC 2008


tags 254243 patch
thanks

@Phil, net-tools upstream: here is a patch proposal for netstat, you
can find information and the discussion leading up to it here:
  http://bugs.debian.org/254243
If you could acknowledge that you like the solution and want to
integrate it into netstat, then we could try to push it into our
forthcoming stable release, which has IPv6 as a release goal.

@Luk, Debian release team: I'd appreciate a short note whether this
is NMU-able and potentially could become part of lenny.



also sprach Luar Roji <cyberplant at roji.net> [2008.11.11.0837 +0100]:
> Well, I've finally done it!
[...]
> The URL is: http://roji.net/net-tools-files.tar.gz

Hi Luar, this is *really good* work. The patch is minimal and
non-intrusive, I wish more people would work like you. Don't worry
about taking a bit longer, we all have our lives to live. It's the
result in the end which counts. And yours is great.

I've tried the new package and I've created a patch as follows, and
also added the patch tag to the bug report (this email is BCC'd to
control at bugs.debian.org).

Let's hope upstream/Phil likes it as much as I do. I'll wait for his
word before I upload an NMU.


$ debdiff net-tools_1.60-21.dsc net-tools_1.60-21.1.dsc
diffstat for net-tools_1.60-21 net-tools_1.60-21.1

 debian/changelog |    7 +++++++
 netstat.c        |   18 +++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff -u net-tools-1.60/netstat.c net-tools-1.60/netstat.c
--- net-tools-1.60/netstat.c
+++ net-tools-1.60/netstat.c
@@ -149,6 +149,7 @@
 int flag_igmp= 0;
 int flag_rom = 0;
 int flag_exp = 1;
+int flag_wide= 0;
 int flag_prg = 0;
 int flag_arg = 0;
 int flag_ver = 0;
@@ -786,16 +787,20 @@
     get_sname(htons(local_port), "tcp",
         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);
  snprintf(buffer, sizeof(buffer), "%s",
     get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
 
-       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);
@@ -1595,7 +1600,7 @@
     getroute_init();           /* Set up AF routing support */
 
     afname[0] = '\0';
-    while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuVv?wxl64", longopts, &lop)) != EOF)
+    while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuWVv?wxl64", longopts, &lop)) != EOF)
  switch (i) {
  case -1:
      break;
@@ -1639,6 +1644,9 @@
  case 'i':
      flag_int++;
      break;
+       case 'W':
+           flag_wide++;
+           break;
  case 'n':
      flag_not |= FLAG_NUM;
      break;
diff -u net-tools-1.60/debian/changelog net-tools-1.60/debian/changelog
--- net-tools-1.60/debian/changelog
+++ net-tools-1.60/debian/changelog
@@ -1,3 +1,10 @@
+net-tools (1.60-21.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Added new parameter -W to not truncate IP addresses (Closes: #254243)
+
+ -- Luar Roji <cyberplant at roji.net>  Tue, 11 Nov 2008 05:15:42 -0200
+
 net-tools (1.60-21) unstable; urgency=low
 
   * Update maintainer to net-tools Team.

-- 
 .''`.   martin f. krafft <madduck at debian.org>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
"aus der kriegsschule des lebens -
 was mich nicht umbringt, macht mich härter."
                                                 - friedrich nietzsche
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
Url : http://lists.alioth.debian.org/pipermail/pkg-net-tools-maintainers/attachments/20081111/fd12d52e/attachment.pgp 


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