[BusyBox] Bug on route.c

Pigi pigi at frumar.it
Fri Mar 19 22:58:53 UTC 2004


Hi all.
I'm a familiar user, and I've noticed a bug in route.c in 1.00-pre8.
If I issue the command
route add default gw 192.168.0.1 usbf ( without the "dev" keyword )i get
an error, while issuing the command route add default gw 192.168.0.1 dec
usbf works.
Same behavior with route add default usbf and route add default dev usbf

The fix seems easy. Here the patch:
diff -u -b -B -w -p -r1.25 route.c
--- a/route.c   15 Mar 2004 08:28:49 -0000      1.25
+++ b/route.c   19 Mar 2004 22:30:27 -0000
@@ -205,7 +205,12 @@ static void INET_setroute(int action, ch

        while (*args) {
                int k = kw_lookup(tbl_ipvx, &args);
-               const char *args_m1 = args[-1];
+               const char *args_m1 = NULL;
+                if (k)
+                 args_m1 = args[-1];
+                else
+                 args_m1 = *args;
+

                if (k & KW_IPVx_FLAG_ONLY) {
                        rt.rt_flags |= flags_ipvx[k & 3];


Can it be right ? ( at least it works for me )

Pigi



More information about the busybox mailing list