netstat fixes + notes in man pages about obsolete commands + infiniband hw

address warning
This commit is contained in:
Jiří Popelka 2009-09-01 13:18:22 +00:00
parent 73665a0e19
commit 14f06a4777
8 changed files with 486 additions and 11 deletions

View File

@ -1 +1,3 @@
ether-wake.8
ipmaddr.8
iptunnel.8

View File

@ -0,0 +1,31 @@
diff -up net-tools-1.60/netstat.c.avoid-name-resolution net-tools-1.60/netstat.c
--- net-tools-1.60/netstat.c.avoid-name-resolution 2009-08-28 10:48:40.000000000 +0200
+++ net-tools-1.60/netstat.c 2009-08-14 12:36:56.000000000 +0200
@@ -961,6 +961,10 @@ static void tcp_do_one(int lnr, const ch
&d, local_addr, &local_port, rem_addr, &rem_port, &state,
&txq, &rxq, &timer_run, &time_len, &retr, &uid, &timeout, &inode, more);
+ if (!flag_all &&
+ ((flag_lst && rem_port) || (!flag_lst && !rem_port)))
+ return;
+
if (strlen(local_addr) > 8) {
#if HAVE_AFINET6
/* Demangle what the kernel gives us */
@@ -1014,7 +1018,7 @@ static void tcp_do_one(int lnr, const ch
flag_not & FLAG_NUM_HOST), sizeof(local_addr));
safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not & FLAG_NUM_HOST),
sizeof(rem_addr));
- if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) {
+
snprintf(buffer, sizeof(buffer), "%s",
get_sname(htons(local_port), "tcp",
flag_not & FLAG_NUM_PORT));
@@ -1075,7 +1079,6 @@ static void tcp_do_one(int lnr, const ch
rxq, txq, local_addr, rem_addr, _(tcp_state[state]));
finish_this_one(uid,inode,timers);
- }
}
static int tcp_info(void)

View File

@ -0,0 +1,61 @@
diff -up net-tools-1.60/netstat.c.continous-flush-stdout net-tools-1.60/netstat.c
--- net-tools-1.60/netstat.c.continous-flush-stdout 2009-08-28 10:57:12.000000000 +0200
+++ net-tools-1.60/netstat.c 2009-08-28 10:58:48.000000000 +0200
@@ -357,6 +357,12 @@ static void prg_cache_clear(void)
prg_cache_loaded=0;
}
+static void wait_continous(const int reptimer)
+{
+ fflush(stdout);
+ sleep(reptimer);
+}
+
static void extract_type_1_socket_inode(const char lname[], unsigned long * inode_p, int * status) {
/* If lname is of the form "socket:[12345]", extract the "12345"
@@ -2289,7 +2295,7 @@ int main
flag_not & FLAG_NUM_PORT, flag_exp);
if (i || !flag_cnt)
break;
- sleep(reptimer);
+ wait_continous(reptimer);
}
#else
ENOSUPP("netstat.c", "FW_MASQUERADE");
@@ -2305,7 +2311,7 @@ int main
if(i || !flag_cnt)
break;
- sleep(reptimer);
+ wait_continous(reptimer);
}
return(i);
}
@@ -2329,7 +2335,7 @@ int main
i = route_info(afname, options);
if (i || !flag_cnt)
break;
- sleep(reptimer);
+ wait_continous(reptimer);
}
return (i);
}
@@ -2338,7 +2344,7 @@ int main
i = iface_info();
if (!flag_cnt || i)
break;
- sleep(reptimer);
+ wait_continous(reptimer);
}
return (i);
}
@@ -2470,7 +2476,7 @@ int main
}
if (!flag_cnt || i)
break;
- sleep(reptimer);
+ wait_continous(reptimer);
prg_cache_clear();
tcp_node_hash_clear();
}

View File

@ -0,0 +1,61 @@
diff -up net-tools-1.60/lib/rose.c.debug-fix net-tools-1.60/lib/rose.c
--- net-tools-1.60/lib/rose.c.debug-fix 2000-03-05 12:26:03.000000000 +0100
+++ net-tools-1.60/lib/rose.c 2009-09-01 13:02:20.000000000 +0200
@@ -86,7 +86,7 @@ static int ROSE_input(int type, char *bu
if (strlen(bufp) != 10) {
strcpy(ROSE_errmsg, _("Node address must be ten digits"));
#ifdef DEBUG
- fprintf(stderr, "rose_input(%s): %s !\n", ROSE_errmsg, orig);
+ fprintf(stderr, "rose_input(%s): %s !\n", bufp, ROSE_errmsg);
#endif
errno = EINVAL;
return (-1);
@@ -99,7 +99,7 @@ static int ROSE_input(int type, char *bu
/* All done. */
#ifdef DEBUG
- fprintf(stderr, "rose_input(%s): ", orig);
+ fprintf(stderr, "rose_input(%s): ", bufp);
for (i = 0; i < sizeof(rose_address); i++)
fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
fprintf(stderr, "\n");
diff -up net-tools-1.60/lib/x25.c.debug-fix net-tools-1.60/lib/x25.c
--- net-tools-1.60/lib/x25.c.debug-fix 2000-05-20 20:53:25.000000000 +0200
+++ net-tools-1.60/lib/x25.c 2009-09-01 13:06:05.000000000 +0200
@@ -81,6 +81,7 @@ X25_input(int type, char *bufp, struct s
unsigned char *ptr;
char *p;
unsigned int sigdigits;
+ int i;
sap->sa_family = x25_aftype.af;
ptr = ((struct sockaddr_x25 *)sap)->sx25_addr.x25_addr;
@@ -90,7 +91,7 @@ X25_input(int type, char *bufp, struct s
if (strlen(bufp)>18) {
strcpy(X25_errmsg, _("Address can't exceed eighteen digits with sigdigits"));
#ifdef DEBUG
- fprintf(stderr, "x25_input(%s): %s !\n", X25_errmsg, orig);
+ fprintf(stderr, "x25_input(%s): %s !\n", bufp, X25_errmsg);
#endif
errno = EINVAL;
return(-1);
@@ -108,7 +109,7 @@ X25_input(int type, char *bufp, struct s
*p = '/';
strcpy(X25_errmsg, _("Invalid address"));
#ifdef DEBUG
- fprintf(stderr, "x25_input(%s): %s !\n", X25_errmsg, orig);
+ fprintf(stderr, "x25_input(%s): %s !\n", bufp, X25_errmsg);
#endif
errno = EINVAL;
return(-1);
@@ -118,8 +119,8 @@ X25_input(int type, char *bufp, struct s
/* All done. */
#ifdef DEBUG
- fprintf(stderr, "x25_input(%s): ", orig);
- for (i = 0; i < sizeof(x25_address); i++)
+ fprintf(stderr, "x25_input(%s): ", bufp);
+ for (i = 0; i < sizeof(sap->sa_data); i++)
fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
fprintf(stderr, "\n");
#endif

View File

@ -0,0 +1,15 @@
diff -up net-tools-1.60/lib/ib.c.ib-warning net-tools-1.60/lib/ib.c
--- net-tools-1.60/lib/ib.c.ib-warning 2009-09-01 13:45:55.000000000 +0200
+++ net-tools-1.60/lib/ib.c 2009-09-01 13:47:43.000000000 +0200
@@ -48,7 +48,10 @@ static char *pr_ib(unsigned char *ptr)
pos += sprintf(pos, "%02X:", (*ptr++ & 0377));
}
buff[strlen(buff) - 1] = '\0';
-
+ char *ib_warning = "Ifconfig uses the ioctl access method to get the full address information, which limits hardware addresses to 8 bytes.\n"
+ "Because Infiniband address has 20 bytes, only the first 8 bytes are displayed correctly.\n"
+ "Ifconfig is obsolete! For replacement check ip.\n";
+ fprintf(stderr, _(ib_warning));
/* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X",
(ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
(ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)

View File

@ -0,0 +1,267 @@
diff -up net-tools-1.60/man/en_US/arp.8.man-obsolete net-tools-1.60/man/en_US/arp.8
--- net-tools-1.60/man/en_US/arp.8.man-obsolete 2009-09-01 11:28:22.000000000 +0200
+++ net-tools-1.60/man/en_US/arp.8 2009-09-01 11:28:22.000000000 +0200
@@ -1,6 +1,8 @@
.TH ARP 8 "5 Jan 1999" "net-tools" "Linux Programmer's Manual"
+
.SH NAME
arp \- manipulate the system ARP cache
+
.SH SYNOPSIS
.B arp
.RB [ \-evn ]
@@ -44,6 +46,10 @@ arp \- manipulate the system ARP cache
.RB [ "-i if" ]
.B -f [filename]
+.SH NOTE
+.P
+This program is obsolete. For replacement check \fBip neighbor\fR.
+
.SH DESCRIPTION
.B Arp
manipulates the kernel's ARP cache in various ways. The primary options
@@ -51,6 +57,7 @@ are clearing an address mapping entry an
debugging purposes, the
.B arp
program also allows a complete dump of the ARP cache.
+
.SH OPTIONS
.TP
.B "\-v, \-\-verbose"
@@ -107,6 +114,7 @@ table. For
entries the specified interface is the interface on which ARP requests will
be answered.
.br
+
.B NOTE:
This has to be different from the interface to which the IP
datagrams will be routed.
@@ -171,6 +179,7 @@ flag. Permanent entries are marked with
and published entries have the
.B P
flag.
+
.SH FILES
.I /proc/net/arp,
.br
@@ -179,8 +188,10 @@ flag.
.I /etc/hosts
.br
.I /etc/ethers
+
.SH SEE ALSO
-rarp(8), route(8), ifconfig(8), netstat(8)
+ip(8)
+
.SH AUTHORS
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> with a lot of improvements
from net-tools Maintainer Bernd Eckenfels <net-tools@lina.inka.de>.
diff -up net-tools-1.60/man/en_US/ethers.5.man-obsolete net-tools-1.60/man/en_US/ethers.5
--- net-tools-1.60/man/en_US/ethers.5.man-obsolete 1999-01-09 16:55:31.000000000 +0100
+++ net-tools-1.60/man/en_US/ethers.5 2009-09-01 11:28:22.000000000 +0200
@@ -1,7 +1,9 @@
.TH ETHERS 5 "April 26th, 1996" "" "File formats"
+
.SH NAME \"{{{roff}}}\"{{{
ethers \- Ethernet address to IP number database
.\"}}}
+
.SH DESCRIPTION \"{{{
\fB/etc/ethers\fP contains 48 bit Ethernet addresses and their corresponding
IP numbers, one line for each IP number:
@@ -20,12 +22,11 @@ which represents one byte of the address
order (big-endian). The \fIIP-number\fP may be a hostname which
can be resolved by DNS or a dot separated number.
.\"}}}
+
.SH EXAMPLES \"{{{
08:00:20:00:61:CA pal
.\"}}}
+
.SH FILES \"{{{
/etc/ethers
.\"}}}
-.SH "SEE ALSO" \"{{{
-rarp(8)
-.\"}}}
diff -up net-tools-1.60/man/en_US/ifconfig.8.man-obsolete net-tools-1.60/man/en_US/ifconfig.8
--- net-tools-1.60/man/en_US/ifconfig.8.man-obsolete 2009-09-01 11:28:22.000000000 +0200
+++ net-tools-1.60/man/en_US/ifconfig.8 2009-09-01 11:28:22.000000000 +0200
@@ -1,10 +1,19 @@
.TH IFCONFIG 8 "14 August 2000" "net-tools" "Linux Programmer's Manual"
+
.SH NAME
ifconfig \- configure a network interface
+
.SH SYNOPSIS
.B "ifconfig [interface]"
.br
.B "ifconfig interface [aftype] options | address ..."
+
+.SH NOTE
+.P
+This program is obsolete!
+For replacement check \fBip addr\fR and \fBip link\fR.
+For statistics use \fBip -s link\fR.
+
.SH DESCRIPTION
.B Ifconfig
is used to configure the kernel-resident network interfaces. It is
@@ -44,6 +53,7 @@ octal, or hexadecimal, as specified in t
or 0X implies hexadecimal; otherwise, a leading '0' implies octal; otherwise,
the number is interpreted as decimal). Use of hexamedial and octal numbers
is not RFC-compliant and therefore its use is discouraged and may go away.
+
.SH OPTIONS
.TP
.B interface
@@ -172,6 +182,7 @@ Set the length of the transmit queue of
to small values for slower devices with a high latency (modem links, ISDN)
to prevent fast bulk transfers from disturbing interactive traffic like
telnet too much.
+
.SH NOTES
Since kernel release 2.2 there are no explicit interface statistics for
alias interfaces anymore. The statistics printed for the original address
@@ -184,17 +195,27 @@ command.
Interrupt problems with Ethernet device drivers fail with EAGAIN. See
.I http://www.scyld.com/expert/irq-conflict.html
for more information.
+
.SH FILES
.I /proc/net/socket
.br
.I /proc/net/dev
.br
.I /proc/net/if_inet6
+
.SH BUGS
+Ifconfig uses obsolete kernel interface.
+It uses the ioctl access method to get the full address information,
+which limits hardware addresses to 8 bytes.
+Since an Infiniband address is 20 bytes,
+only the first 8 bytes of Infiniband address are displayed.
+.LP
While appletalk DDP and IPX addresses will be displayed they cannot be
altered by this command.
+
.SH SEE ALSO
-route(8), netstat(8), arp(8), rarp(8), ipchains(8)
+ip(8)
+
.SH AUTHORS
Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
.br
diff -up net-tools-1.60/man/en_US/nameif.8.man-obsolete net-tools-1.60/man/en_US/nameif.8
--- net-tools-1.60/man/en_US/nameif.8.man-obsolete 2000-10-18 19:26:29.000000000 +0200
+++ net-tools-1.60/man/en_US/nameif.8 2009-09-01 12:15:24.000000000 +0200
@@ -1,10 +1,18 @@
.TH NAMEIF 8 "18 Oct 2000" "net-tools" "Linux's Administrator's Manual"
+
.SH NAME
nameif \- name network interfaces based on MAC addresses
+
.SH SYNOPSIS
.B "nameif [-c configfile] [-s]"
.br
.B "nameif [-c configfile] [-s] {interface macaddress}"
+
+.SH NOTE
+.P
+This program is obsolete. For replacement check \fBip link\fR.
+This functionality is also much better provided by udev methods.
+
.SH DESCRIPTION
.B nameif
renames network interfaces based on mac addresses. When no arguments are
@@ -31,5 +39,9 @@ should be run before the interface is up
.SH FILES
/etc/mactab
+
+.SH SEE ALSO
+ip(8), udev(7)
+
.SH BUGS
Only works for Ethernet currently.
diff -up net-tools-1.60/man/en_US/netstat.8.man-obsolete net-tools-1.60/man/en_US/netstat.8
--- net-tools-1.60/man/en_US/netstat.8.man-obsolete 2009-09-01 11:28:22.000000000 +0200
+++ net-tools-1.60/man/en_US/netstat.8 2009-09-01 11:28:22.000000000 +0200
@@ -92,6 +92,14 @@ netstat \- Print network connections, ro
.RB [ \-\-netrom ]
.RB [ \-\-ddp ]
+.SH NOTE
+.P
+This program is obsolete.
+Replacement for \fBnetstat\fR is \fBss\fR.
+Replacement for \fBnetstat -r\fR is \fBip route\fR.
+Replacement for \fBnetstat -i\fR is \fBip -s link\fR.
+Replacement for \fBnetstat -g\fR is \fBip maddr\fR.
+
.SH DESCRIPTION
.B Netstat
prints information about the Linux networking subsystem. The type of
@@ -438,13 +446,11 @@ status information via the following fil
-- statistics
.fi
.P
+
.SH SEE ALSO
-.BR route (8),
-.BR ifconfig (8),
-.BR ipchains (8),
-.BR iptables (8),
-.BR proc (5)
+.BR ss (8), ip(8)
.P
+
.SH BUGS
Occasionally strange information may appear if a socket changes
as it is viewed. This is unlikely to occur.
diff -up net-tools-1.60/man/en_US/route.8.man-obsolete net-tools-1.60/man/en_US/route.8
--- net-tools-1.60/man/en_US/route.8.man-obsolete 2000-05-21 20:59:03.000000000 +0200
+++ net-tools-1.60/man/en_US/route.8 2009-09-01 11:28:22.000000000 +0200
@@ -1,6 +1,8 @@
.TH ROUTE 8 "2 January 2000" "net-tools" "Linux Programmer's Manual"
+
.SH NAME
route \- show / manipulate the IP routing table
+
.SH SYNOPSIS
.B route
.RB [ \-CFvnee ]
@@ -52,6 +54,11 @@ If]
.RB [ \-\-version ]
.RB [ \-h ]
.RB [ \--help ]
+
+.SH NOTE
+.P
+This program is obsolete. For replacement check \fBip route\fR.
+
.SH DESCRIPTION
.B Route
manipulates the kernel's IP routing tables. Its primary use is to set
@@ -306,6 +313,7 @@ address is not needed for the interface
.B Arp (cached only)
Whether or not the hardware address for the cached route is up to date.
.LP
+
.SH FILES
.I /proc/net/ipv6_route
.br
@@ -313,9 +321,11 @@ Whether or not the hardware address for
.br
.I /proc/net/rt_cache
.LP
+
.SH SEE ALSO
-.I ifconfig(8), netstat(8), arp(8), rarp(8)
+.I ip(8)
.LP
+
.SH HISTORY
.B Route
for Linux was originally written by Fred N. van Kempen,

View File

@ -3,7 +3,7 @@
Summary: Basic networking tools
Name: net-tools
Version: 1.60
Release: 94%{?dist}
Release: 95%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://net-tools.berlios.de/
@ -15,6 +15,8 @@ Source4: ether-wake.c
Source5: ether-wake.8
Source6: mii-diag.c
Source7: mii-diag.8
Source8: iptunnel.8
Source9: ipmaddr.8
Patch1: net-tools-1.57-bug22040.patch
Patch2: net-tools-1.60-miiioctl.patch
Patch3: net-tools-1.60-manydevs.patch
@ -82,9 +84,25 @@ Patch68: net-tools-1.60-a-option.patch
Patch69: net-tools-1.60-clear-flag.patch
Patch70: net-tools-1.60-metric-tunnel-man.patch
Patch71: net-tools-1.60-netstat-probe.patch
# scanf format length fix (non-exploitable)
Patch72: net-tools-1.60-scanf-format.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# netstat - avoid name resolution for listening or established sockets (-l) by return fast
Patch73: net-tools-1.60-avoid-name-resolution.patch
# netstat - --continuous should flush stdout
Patch74: net-tools-1.60-continous-flush-stdout.patch
# fix some errors so net-tools can be build with DEBUG defined
Patch75: net-tools-1.60-debug-fix.patch
# let the user know that ifconfig can correctly show only first 8 bytes of Infiniband hw address
Patch76: net-tools-1.60-ib-warning.patch
# notes in man pages, saying that these tools are obsolete
Patch77: net-tools-1.60-man-obsolete.patch
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
@ -93,8 +111,9 @@ BuildRequires: gettext, libselinux
BuildRequires: libselinux-devel
%description
The net-tools package contains basic networking tools, including
ifconfig, netstat, route, and others.
The net-tools package contains basic networking tools,
including ifconfig, netstat, route, and others.
Most of them are obsolete. For replacement check iproute package.
%prep
%setup -q -a 1
@ -166,6 +185,11 @@ ifconfig, netstat, route, and others.
%patch70 -p1 -b .metric-tunnel-man
%patch71 -p1 -b .probe
%patch72 -p1 -b .scanf-format
%patch73 -p1 -b .avoid-name-resolution
%patch74 -p1 -b .continous-flush-stdout
%patch75 -p1 -b .debug-fix
%patch76 -p1 -b .ib-warning
%patch77 -p1 -b .man-obsolete
cp %SOURCE2 ./config.h
cp %SOURCE3 ./config.make
@ -173,6 +197,8 @@ cp %SOURCE4 .
cp %SOURCE5 ./man/en_US
cp %SOURCE6 .
cp %SOURCE7 ./man/en_US
cp %SOURCE8 ./man/en_US
cp %SOURCE9 ./man/en_US
%ifarch alpha
perl -pi -e "s|-O2||" Makefile
@ -218,24 +244,28 @@ make
popd
%install
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
mv man/de_DE man/de
mv man/fr_FR man/fr
mv man/pt_BR man/pt
make BASEDIR=$RPM_BUILD_ROOT mandir=%{_mandir} install
make BASEDIR=%{buildroot} mandir=%{_mandir} install
install -m 755 ether-wake %{buildroot}/sbin
install -m 755 mii-diag %{buildroot}/sbin
pushd netplug-%{npversion}
make install prefix=$RPM_BUILD_ROOT \
initdir=$RPM_BUILD_ROOT/%{_initrddir} \
mandir=$RPM_BUILD_ROOT/%{_mandir}
make install prefix=%{buildroot} \
initdir=%{buildroot}/%{_initrddir} \
mandir=%{buildroot}/%{_mandir}
mv README README.netplugd
mv TODO TODO.netplugd
popd
ln -s %{_mandir}/man8/netplugd.8.gz %{buildroot}/%{_mandir}/man5/netplug.5.gz
ln -s %{_mandir}/man8/netplugd.8.gz %{buildroot}/%{_mandir}/man5/netplug.d.5.gz
ln -s %{_mandir}/man8/netplugd.8.gz %{buildroot}/%{_mandir}/man5/netplugd.conf.5.gz
rm %{buildroot}/sbin/rarp
rm %{buildroot}%{_mandir}/man8/rarp.8*
rm %{buildroot}%{_mandir}/de/man8/rarp.8*
@ -248,7 +278,7 @@ echo "# see man ethers for syntax" > %{buildroot}%{_sysconfdir}/ethers
%find_lang %{name}
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%post
/sbin/chkconfig --add netplugd
@ -281,6 +311,13 @@ exit 0
%{_sysconfdir}/rc.d/init.d/netplugd
%changelog
* Tue Sep 1 2009 Jiri Popelka <jpopelka@redhat.com> - 1.60-95
- netstat - avoid name resolution for listening or established sockets (-l) by return fast.
- netstat - --continuous should flush stdout
- added missing man pages (iptunnel, ipmaddr, netplug, netplug.d, netplugd.conf)
- added note about obsolete commands to existing man pages
- let the user know that ifconfig can correctly show only first 8 bytes of Infiniband hw address
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.60-94
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

View File

@ -4,4 +4,5 @@
8c6ac053fcab98a3fce2181e7da878ea mii-diag.8
15fe21b9cac19a79649c41fa7919e888 ether-wake.c
d765b596b9e930bf22c226b99080b420 ether-wake.8
32b749f457e19c5aea3a80ee8ee7f892 ipmaddr.8
2ab05121ef65bed64dc323a59c6f9e6f iptunnel.8