Messages in this thread Patch in this message |  | | Subject | Quick and Dirty Patch for ifconfig | Date | Tue, 04 Feb 1997 00:44:40 -0500 | From | John Gotts <> |
| |
I've attached a quick and dirty patch for ifconfig to compensate for the added fields in /proc/net/dev. You'll need to hand-compile ifconfig like so:
gcc -D__KERNEL__ -O3 -Wall -fomit-frame-pointer -I. -Ilib -c ifconfig.c -o ifconfig.o gcc -s -Llib -o ifconfig ifconfig.o -lsupport
It's not meant as a final solution in any way, just an ad hoc measure until the next version of net-tools gets released.
--- net-tools-1.32-alpha/ifconfig.c.orig Mon Feb 3 23:58:26 1997 +++ net-tools-1.32-alpha/ifconfig.c Tue Feb 4 00:38:20 1997 @@ -73,7 +73,7 @@ int has_ax25; int has_ddp; char hwaddr[32]; /* HW address */ - struct enet_statistics stats; /* statistics */ + struct net_device_stats stats; /* statistics */ }; @@ -193,12 +193,12 @@ /* If needed, display the interface statistics. */ printf(" "); printf(NLS_CATGETS(catfd, ifconfigSet, ifconfig_rx, - "RX packets:%u errors:%u dropped:%u %s:%u\n"), + "RX packets:%ld errors:%ld dropped:%ld %s:%ld\n"), ptr->stats.rx_packets, ptr->stats.rx_errors, ptr->stats.rx_dropped, dispname, ptr->stats.rx_fifo_errors); printf(" "); printf(NLS_CATGETS(catfd, ifconfigSet, ifconfig_tx, - "TX packets:%u errors:%u dropped:%u %s:%u\n"), + "TX packets:%ld errors:%ld dropped:%ld %s:%ld\n"), ptr->stats.tx_packets, ptr->stats.tx_errors, ptr->stats.tx_dropped, dispname, ptr->stats.tx_fifo_errors); @@ -235,6 +235,7 @@ FILE *f=fopen("/proc/net/dev","r"); char buf[256]; char *bp; + unsigned long unused = 0; if(f==NULL) return; while(fgets(buf,255,f)) @@ -246,13 +247,15 @@ { bp=strchr(bp,':'); bp++; - sscanf(bp,"%d %d %d %d %d %d %d %d %d %d %d", + sscanf(bp,"%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", + &unused, &ife->stats.rx_packets, &ife->stats.rx_errors, &ife->stats.rx_dropped, &ife->stats.rx_fifo_errors, &ife->stats.rx_frame_errors, + &unused, &ife->stats.tx_packets, &ife->stats.tx_errors, &ife->stats.tx_dropped, -- John GOTTS <jgotts@engin.umich.edu> http://www-personal.engin.umich.edu/~jgotts Senior, EE/Motif Programmer/SysAdmin/Linux Hacker/Amateur Radio Callsign N8QDW
|  |