[BusyBox] [PATCH] - ifconfig seriously broken
Felipe Kellermann
stdfk at terra.com.br
Sat Aug 21 00:54:14 MDT 2004
Package: busybox
Version: v1.00-rc3
Severity: bug fix
Unfortunatelly I've not followed the last two or three weeks commits (new
semester started and so now I rarely have time to fix my personal bridge)
but tonight I synched my tree and immediately noticed a rather nasty bug!
[Using libbb/interface.c:1.24]
# grep eth0 /proc/net/dev | xargs
eth0:311708397 237346 1670 0 1789 1670 0 0 22580308 120297 0 0 0 102 0 0
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:20:AF:7C:EA:B7
inet addr:10.0.0.1 Bcast:10.0.0.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:5 Base address:0x320
All values `ifconfig' is showing are `zeroed' -- I quickly looked at the
last commits I missed and noticed that there were a commit relating to
ifconfig, libbb/interface.c:1.23->1.24 (PatchSet 4338).
I've reversed the patch and now everything is working again. I compared
the get_name's return values from the 1.23 and 1.24 and quickly noticed
that the new revision is leaving `p' right on the sep while the rev 1.23
was leaving it right on the starting of the values... OK, now I have:
[Using libbb/interface.c:1.24-patched]
# grep eth0 /proc/net/dev | xargs
eth0:311734021 237581 1670 0 1789 1670 0 0 22584370 120334 0 0 0 102 0 0
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:20:AF:7C:EA:B7
inet addr:10.0.0.1 Bcast:10.0.0.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:237606 errors:1670 dropped:0 overruns:1789 frame:1670
TX packets:120334 errors:0 dropped:0 overruns:0 carrier:0
collisions:102 txqueuelen:1000
RX bytes:311736667 (297.2 MiB) TX bytes:22584370 (21.5 MiB)
Interrupt:5 Base address:0x320
1-line, 1/3-minute patch attached :-)
--
Felipe Kellermann
-------------- next part --------------
Index: libbb/interface.c
===================================================================
RCS file: /var/cvs/busybox/libbb/interface.c,v
retrieving revision 1.24
diff -u -3 -p -b -w -u -r1.24 interface.c
--- libbb/interface.c 12 Aug 2004 16:52:00 -0000 1.24
+++ libbb/interface.c 21 Aug 2004 06:51:27 -0000
@@ -1016,7 +1016,7 @@ char *get_name(char *name, char *p)
/* first ':' not found - return empty */
name[0]='\0';
}
- return p;
+ return p + 1;
}
/* If scanf supports size qualifiers for %n conversions, then we can
More information about the busybox
mailing list