svn commit: trunk/busybox/networking/libiproute

vda at busybox.net vda at busybox.net
Fri Jan 4 15:28:29 UTC 2008


Author: vda
Date: 2008-01-04 07:28:28 -0800 (Fri, 04 Jan 2008)
New Revision: 20707

Log:
ip route: "ip route" was misbehaving (extra argv+1 ate 1st env var)



Modified:
   trunk/busybox/networking/libiproute/iproute.c


Changeset:
Modified: trunk/busybox/networking/libiproute/iproute.c
===================================================================
--- trunk/busybox/networking/libiproute/iproute.c	2008-01-04 15:10:47 UTC (rev 20706)
+++ trunk/busybox/networking/libiproute/iproute.c	2008-01-04 15:28:28 UTC (rev 20707)
@@ -841,15 +841,17 @@
 	/*0-3*/	"add\0""append\0""change\0""chg\0"
 	/*4-7*/	"delete\0""get\0""list\0""show\0"
 	/*8..*/	"prepend\0""replace\0""test\0""flush\0";
-	int command_num = 6;
+	int command_num;
 	unsigned flags = 0;
 	int cmd = RTM_NEWROUTE;
 
+	if (!*argv)
+		return iproute_list_or_flush(argv, 0);
+
 	/* "Standard" 'ip r a' treats 'a' as 'add', not 'append' */
 	/* It probably means that it is using "first match" rule */
-	if (*argv) {
-		command_num = index_in_substrings(ip_route_commands, *argv);
-	}
+	command_num = index_in_substrings(ip_route_commands, *argv);
+
 	switch (command_num) {
 		case 0: /* add */
 			flags = NLM_F_CREATE|NLM_F_EXCL;




More information about the busybox-cvs mailing list