Re: RX on aliased interfaces :)

Jon Lewis (jlewis@inorganic5.fdt.net)
Tue, 10 Feb 1998 22:25:14 -0500 (EST)


On Tue, 10 Feb 1998, Pawel S. Veselov wrote:

> Just wondering : is it bug feature or just a joke ? :) :
>
> (strip from ifconfig -a)
>
> eth0:0 Link encap:10Mbps Ethernet HWaddr 00:80:48:EE:60:19
> RX packets:0 errors:0 dropped:0 overruns:0
> eth0:1 Link encap:10Mbps Ethernet HWaddr 00:80:48:EE:60:19
> RX packets:1 errors:0 dropped:0 overruns:0

It's a bug in ifconfig. Ifconfig is not interpreting /proc/net/dev
properly...and it should be obvious when looking at the format why this
happens.

# cat /proc/net/dev
Inter-| Receive | Transmit
face |packets errs drop fifo frame|packets errs drop fifo colls carrier
lo:12919315 0 0 0 0 12919315 0 0 0 0 0
eth0:88574601 0 0 0 0 81180254 0 0 0 928764 0
eth0:0: 240854 0 0 0 0 0 0 0 0 0 0
eth0:1: 21234 0 0 0 0 0 0 0 0 0 0
eth0:2: 2503 0 0 0 0 0 0 0 0 0 0

Fortunately, it's really simple to fix. The following also allows
ifconfig to display a lot more devices...previously, only about 32 devices
got listed by ifconfig.

I know this isn't the latest version...so maybe these things have already
been fixed.

--- net-tools-1.32-alpha/ifconfig.c Tue May 14 20:03:25 1996
+++ net-tools-1.32-alpha-fdt/ifconfig.c Tue Feb 10 22:22:19 1998
@@ -244,7 +244,8 @@
bp++;
if(strncmp(bp,ifname,strlen(ifname))==0 &&
bp[strlen(ifname)]==':')
{
- bp=strchr(bp,':');
+/* bp=strchr(bp,':'); */
+ bp=strrchr(bp,':');
bp++;
sscanf(bp,"%d %d %d %d %d %d %d %d %d %d %d",
&ife->stats.rx_packets,
@@ -381,7 +382,7 @@
static void
if_print(char *ifname)
{
- char buff[1024];
+ char buff[10240];
struct interface ife;
struct ifconf ifc;
struct ifreq *ifr;

------------------------------------------------------------------
Jon Lewis <jlewis@fdt.net> | Unsolicited commercial e-mail will
Network Administrator | be proof-read for $199/message.
Florida Digital Turnpike |
______http://inorganic5.fdt.net/~jlewis/pgp for PGP public key____

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu