Re: ifconfig -> TX packets 0, errors:18425

Dmitry Yaitskov (dima@interlog.com)
Mon, 13 Apr 1998 21:42:15 -0400


On Monday, Apr 13, Stefan van der Eijk (stefan@stack.nl) spake thusly:
> Hello,
>
> First of all I'd like to say that I'm quite a newbie with
> development kernels... I've just compiled a 2.1.95 kernel,
> everything works fine but I get some strange things with
> ifconfig...

To get stats, ifconfig parses the /proc/net/dev file, whose format has
changed - namely, 2 new fields were added (compressed and
multicast). This confuses the (old?) ifconfig parser, and the number
of tx errors it's reporting actually is the number of packets. There
should be a new version of net-tools I suppose. As a quick fix for
ifconfig.c (this is for net-tools 1.432):

*** net-tools/ifconfig.c Tue Sep 23 16:05:24 1997
--- net-tools.new/ifconfig.c Sun Apr 12 15:32:39 1998
***************
*** 401,413 ****
bp=strchr(bp,':');
bp++;
if (have_byte_counters) {
! sscanf(bp,"%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld",
&ife->stats.rx_bytes,
&ife->stats.rx_packets,
&ife->stats.rx_errors,
&ife->stats.rx_dropped,
&ife->stats.rx_fifo_errors,
&ife->stats.rx_frame_errors,

&ife->stats.tx_bytes,
&ife->stats.tx_packets,
--- 401,416 ----
bp=strchr(bp,':');
bp++;
if (have_byte_counters) {
! /* dima: hack to report correctly for 2.1.9? kernel */
! sscanf(bp,"%ld %ld %ld %ld %ld %ld %*ld %*ld %ld %ld %ld %ld %ld %ld %ld",
&ife->stats.rx_bytes,
&ife->stats.rx_packets,
&ife->stats.rx_errors,
&ife->stats.rx_dropped,
&ife->stats.rx_fifo_errors,
&ife->stats.rx_frame_errors,
+ /* 2.1.9? kernel: compressed goes here */
+ /* 2.1.9? kernel: multicast goes here */

&ife->stats.tx_bytes,
&ife->stats.tx_packets,

-- 
Cheers,
 -Dima.

A New York City ordinance prohibits the shooting of rabbits from the rear of a Third Avenue street car -- if the car is in motion.

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