Bug#254243: [updated] Patch for netstat to prevent chopping IPv6 addresses
martin f krafft
madduck at debian.org
Tue Nov 11 13:53:21 UTC 2008
also sprach martin f krafft <madduck at debian.org> [2008.11.11.1000 +0100]:
> Yes, that would make sense. Also, it has been suggested to add
> --wide as a synonym.
>
> You can just recreate the diff, no need to create a new changelog
> entry.
Attached is the updated patch and upstream is again on Cc. I changed
the changelog entry a bit from what Luar sent, and verified that the
patch is sane and obeys style rules etc. I also rephrased the
manpage description.
Still waiting for upstream to give an okay. This is not to sound
impatient, just telling the world that I haven't received one yet.
:)
--
.''`. 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
quantum mechanics: the dreams stuff is made of.
-------------- next part --------------
diffstat for net-tools_1.60-21 net-tools_1.60-21.1
debian/changelog | 8 ++++++++
man/en_US/netstat.8 | 3 +++
netstat.c | 26 ++++++++++++++++++--------
3 files changed, 29 insertions(+), 8 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);
@@ -1515,9 +1520,9 @@
static void usage(void)
{
- fprintf(stderr, _("usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
- fprintf(stderr, _(" netstat [-vnNcaeol] [<Socket> ...]\n"));
- fprintf(stderr, _(" netstat { [-veenNac] -i | [-cnNe] -M | -s }\n\n"));
+ fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
+ fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n"));
+ fprintf(stderr, _(" netstat { [-vWeenNac] -i | [-cWnNe] -M | -s }\n\n"));
fprintf(stderr, _(" -r, --route display routing table\n"));
fprintf(stderr, _(" -i, --interfaces display interface table\n"));
@@ -1527,6 +1532,7 @@
fprintf(stderr, _(" -M, --masquerade display masqueraded connections\n\n"));
#endif
fprintf(stderr, _(" -v, --verbose be verbose\n"));
+ fprintf(stderr, _(" -W, --wide don't truncate IP addresses\n"));
fprintf(stderr, _(" -n, --numeric don't resolve names\n"));
fprintf(stderr, _(" --numeric-hosts don't resolve host names\n"));
fprintf(stderr, _(" --numeric-ports don't resolve port names\n"));
@@ -1576,6 +1582,7 @@
{"programs", 0, 0, 'p'},
{"verbose", 0, 0, 'v'},
{"statistics", 0, 0, 's'},
+ {"wide", 0, 0, 'W'},
{"numeric", 0, 0, 'n'},
{"numeric-hosts", 0, 0, '!'},
{"numeric-ports", 0, 0, '@'},
@@ -1595,7 +1602,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 +1646,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,11 @@
+net-tools (1.60-21.1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Added new command line option -W/--wide which prevents the truncation of
+ IPv6 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.
diff -u net-tools-1.60/man/en_US/netstat.8 net-tools-1.60/man/en_US/netstat.8
--- net-tools-1.60/man/en_US/netstat.8
+++ net-tools-1.60/man/en_US/netstat.8
@@ -118,6 +118,9 @@
.SS "\-\-verbose , \-v"
Tell the user what is going on by being verbose. Especially print some
useful information about unconfigured address families.
+.SS "\-\-wide , \-W"
+Do not truncate IP addresses by using output as wide as needed. This is
+optional for now to not break existing scripts.
.SS "\-\-numeric , \-n"
Show numerical addresses instead of trying to determine symbolic host, port
or user names.
-------------- 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/1b3ccd61/attachment.pgp
More information about the Pkg-net-tools-maintainers
mailing list