[BusyBox 0001076]: "ip addr del" does not work

bugs at busybox.net bugs at busybox.net
Sun Nov 5 18:05:48 UTC 2006


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=1076 
====================================================================== 
Reported By:                Andreas Winter
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1076
Category:                   Networking Support
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Resolution:                 reopened
Fixed in Version:           
====================================================================== 
Date Submitted:             10-25-2006 03:21 PDT
Last Modified:              11-05-2006 10:05 PST
====================================================================== 
Summary:                    "ip addr del" does not work
Description: 
file: ipaddress.c

...
int do_ipaddr(int argc, char **argv)
{
	static const char *const commands[] = {
		"add", "delete", "list", "show", "lst", "flush", 0
	};
...
should be
...
int do_ipaddr(int argc, char **argv)
{
	static const char *const commands[] = {
		"add", "del", "list", "show", "lst", "flush", 0
	};
...
====================================================================== 

---------------------------------------------------------------------- 
 Andreas Winter - 10-25-06 03:26  
---------------------------------------------------------------------- 
To be more precise: del should work in addition to delete 

---------------------------------------------------------------------- 
 bernhardf - 10-25-06 09:01  
---------------------------------------------------------------------- 
I disagree. ip addr delete should still be supported, so you cannot simply
change "delete" to "del" there.

The attached snippet uses strncmp(,key,strlen(key)) rather than strcmp.
This does not catch ambiguous args when you compare the string_array.

For this to work, we'd need to keep track on how many matches we got and
bail if matches > 1.

For the ip applet, the strncmp thing should do it for now, though. 

---------------------------------------------------------------------- 
 Andreas Winter - 10-25-06 09:36  
---------------------------------------------------------------------- 
Hi bernardf,

I disagree, too ;-)
Unfortunately the function compare_string_array is used at many places.
Changing the semantics could break other code.
On solution might be to simply add "del" to the list of commands. But this
would reject "dele" and "delet" as unknown commands.
Or you can add a function compare_string_array_prefix which does what you
want and return -1 if the command is ambigious.
Unfortunately "del" is used in some (many?) scripts, which would break, if
this not fixed. 

---------------------------------------------------------------------- 
 vda - 10-25-06 18:10  
---------------------------------------------------------------------- 
Fixed in rev 16439 

---------------------------------------------------------------------- 
 Andreas Winter - 10-26-06 02:02  
---------------------------------------------------------------------- 
In "do_ipaddr(int argc, char **argv)"
        int command_num = 2;
should be
	int command_num = 3; 

---------------------------------------------------------------------- 
 vda - 11-05-06 10:05  
---------------------------------------------------------------------- 
Hopefully really fixed in rev 16515 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-25-06 03:21  Andreas Winter New Issue                                    
10-25-06 03:21  Andreas Winter Status                   new => assigned     
10-25-06 03:21  Andreas Winter Assigned To               => BusyBox         
10-25-06 03:26  Andreas Winter Note Added: 0001718                          
10-25-06 08:58  bernhardf      File Added: busybox.bug1076.00.diff              
     
10-25-06 09:01  bernhardf      Note Added: 0001719                          
10-25-06 09:36  Andreas Winter Note Added: 0001720                          
10-25-06 18:10  vda            Status                   assigned => closed  
10-25-06 18:10  vda            Note Added: 0001721                          
10-25-06 18:10  vda            Resolution               open => fixed       
10-26-06 02:02  Andreas Winter Status                   closed => feedback  
10-26-06 02:02  Andreas Winter Resolution               fixed => reopened   
10-26-06 02:02  Andreas Winter Note Added: 0001722                          
11-05-06 10:05  vda            Status                   feedback => closed  
11-05-06 10:05  vda            Note Added: 0001731                          
======================================================================




More information about the busybox-cvs mailing list