- new option for netstat - -T stops trimming remote and local addresses

(#176465)
This commit is contained in:
Radek Vokál 2006-02-10 10:27:36 +00:00
parent f3b2b42b15
commit 9d2e4991b2
2 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,80 @@
--- net-tools-1.60/man/en_US/netstat.8.old 2006-02-10 11:18:11.000000000 +0100
+++ net-tools-1.60/man/en_US/netstat.8 2006-02-10 11:22:19.000000000 +0100
@@ -176,6 +176,10 @@
Print routing information from the FIB. (This is the default.)
.SS "\-C"
Print routing information from the route cache.
+.SS "\-Z \-\-context"
+If SELinux enabled print SELinux context.
+.SS "\-T \-\-trim"
+Stop trimming long addresses.
.SS delay
Netstat will cycle printing through statistics every
.B delay
--- net-tools-1.60/netstat.c.old 2006-02-10 11:18:12.000000000 +0100
+++ net-tools-1.60/netstat.c 2006-02-10 11:13:50.000000000 +0100
@@ -157,6 +157,9 @@
int flag_arg = 0;
int flag_ver = 0;
int flag_selinux = 0;
+int flag_trim = 0;
+
+
FILE *procinfo;
@@ -980,17 +983,21 @@
get_sname(htons(local_port), "tcp",
flag_not & FLAG_NUM_PORT));
- if ((strlen(local_addr) + strlen(buffer)) >= 27)
- local_addr[27 - strlen(buffer) - 1] = '\0';
+ if (!flag_trim) {
+ if ((strlen(local_addr) + strlen(buffer)) >= 27)
+ local_addr[27 - strlen(buffer) - 1] = '\0';
+ }
strcat(local_addr, ":");
strncat(local_addr, buffer, sizeof(local_addr));
local_addr[sizeof(local_addr)-1] = 0;
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(rem_port), "tcp", flag_not & FLAG_NUM_PORT));
-
- if ((strlen(rem_addr) + strlen(buffer)) >= 27)
- rem_addr[27 - strlen(buffer) - 1] = '\0';
+
+ if (!flag_trim) {
+ if ((strlen(rem_addr) + strlen(buffer)) >= 27)
+ rem_addr[27 - strlen(buffer) - 1] = '\0';
+ }
strcat(rem_addr, ":");
strncat(rem_addr, buffer, sizeof(rem_addr));
@@ -1776,6 +1783,7 @@
{"fib", 0, 0, 'F'},
{"groups", 0, 0, 'g'},
{"context", 0, 0, 'Z'},
+ {"trim", 0, 0, 'T'},
{NULL, 0, 0, 0}
};
@@ -1788,7 +1796,7 @@
afname[0] = '\0';
- while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxlZ", longopts, &lop)) != EOF)
+ while ((i = getopt_long(argc, argv, "MCFA:acdegphiI::nNorstuVv?wxlZT", longopts, &lop)) != EOF)
switch (i) {
case -1:
break;
@@ -1904,6 +1912,10 @@
usage();
case 's':
flag_sta++;
+ break;
+ case 'T':
+ flag_trim++;
+ break;
}
if(argc == optind + 1) {

View File

@ -3,7 +3,7 @@
Summary: Basic networking tools.
Name: net-tools
Version: 1.60
Release: 61.1
Release: 62
License: GPL
Group: System Environment/Base
Source0: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2
@ -58,6 +58,7 @@ Patch43: net-tools-1.60-arp_overflow.patch
Patch44: net-tools-1.60-hostname_man.patch
Patch45: net-tools-1.60-interface_stack.patch
Patch46: net-tools-1.60-selinux.patch
Patch47: net-tools-1.60-netstat_stop_trim.patch
BuildRoot: %{_tmppath}/%{name}-root
Requires(post,preun): chkconfig
@ -112,6 +113,7 @@ ifconfig, netstat, route, and others.
%patch44 -p1 -b .hostname_man
%patch45 -p0 -b .stack
%patch46 -p1 -b .selinux
%patch47 -p1 -b .trim
cp %SOURCE2 ./config.h
cp %SOURCE3 ./config.make
@ -223,6 +225,9 @@ exit 0
%{_sysconfdir}/rc.d/init.d/netplugd
%changelog
* Fri Feb 10 2006 Radek Vokál <rvokal@redhat.com> - 1.60-62
- new option for netstat - -T stops trimming remote and local addresses (#176465)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.60-61.1
- rebuilt for new gcc4.1 snapshot and glibc changes