[patch] add ip addr del alias for delete [was: Re: ipaddr applet query]

Bernhard Fischer rep.nop at aon.at
Thu Mar 30 11:53:04 UTC 2006


On Thu, Mar 30, 2006 at 10:06:28AM +1030, Adam Hawes wrote:
>All,
> 
>I'm using Busybox 1.01 (and have just tried 1.1.1) with an 
>embedded box.  I'm trying to use the ipaddr applet to add and 
>remove ip aliasses to interfaces dynamically.
> 
>I have no problem with the add command, but the documentation 
>lists a "del" command.  If I use the "del" command the applet 
>reports an error about non-existing commands.
>
>I've found that the "delete" command is supported and appears 
>to do exactly what I intend.  The documentation is slightly 
>inaccurate in this case.  Perhaps it would be useful to 
>update the command-line parser or the documentation for the 
>ipaddr applet so that they match up.

Please let me know if the attached patch fixes the missing "del" command
for you.

It was made against the 1.1.1 version but should apply cleanly against
1.01, too.

TIA,
Bernhard
-------------- next part --------------
Index: busybox/networking/libiproute/ipaddress.c
===================================================================
--- busybox/networking/libiproute/ipaddress.c	(revision 14700)
+++ busybox/networking/libiproute/ipaddress.c	(working copy)
@@ -808,7 +808,7 @@
 int do_ipaddr(int argc, char **argv)
 {
 	static const char *const commands[] = {
-		"add", "delete", "list", "show", "lst", "flush", 0
+		"add", "delete", "del", "list", "show", "lst", "flush", 0
 	};
 
 	int command_num = 2;
@@ -820,12 +820,13 @@
 		case 0: /* add */
 			return ipaddr_modify(RTM_NEWADDR, argc-1, argv+1);
 		case 1: /* delete */
+		case 2: /* del */
 			return ipaddr_modify(RTM_DELADDR, argc-1, argv+1);
-		case 2: /* list */
-		case 3: /* show */
-		case 4: /* lst */
+		case 3: /* list */
+		case 4: /* show */
+		case 5: /* lst */
 			return ipaddr_list_or_flush(argc-1, argv+1, 0);
-		case 5: /* flush */
+		case 6: /* flush */
 			return ipaddr_list_or_flush(argc-1, argv+1, 1);
 	}
 	bb_error_msg_and_die("Unknown command %s", *argv);


More information about the busybox mailing list