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

Denis Vlasenko vda.linux at googlemail.com
Sun Nov 5 10:02:18 PST 2006


On Sunday 05 November 2006 18:24, Denis Vlasenko wrote:
> > Index: networking/libiproute/ipaddress.c
> > ===================================================================
> > --- networking/libiproute/ipaddress.c   (revision 16438)
> > +++ networking/libiproute/ipaddress.c   (revision 16439)
> > @@ -800,7 +800,7 @@
> >  int do_ipaddr(int argc, char **argv)
> >  {
> >         static const char *const commands[] = {
> > -               "add", "delete", "list", "show", "lst", "flush", 0
> > +               "add", "del", "delete", "list", "show", "lst", "flush", 0
> >         };
> >  
> >         int command_num = 2;
> > [snip rest that introduced another bug, see the link above; The report
> > was automatically sent to the busybox-cvs like any other bugtracker note].
> 
> "another bug" is that command_num wasn't updated to 3, right?
> 
> > "del" and (i suppose) "lst" are superfluous.
> >   We are supposed to recognize e.g. "a" "ad" as "add", etc.
> >   Adding every possible string strikes me as a very bad idea, size-wise.
> > 
> > 
> > A sane approach is to use
> > - if (strcmp(string_array[i], key) == 0) {
> > + if (strncmp(string_array[i], key, strlen(key)) == 0) {
> > but that did beg the question if we need an indicator to only accept
> > exact matches (like the current code) or not (like the strncmp case).
> > See earlier discussion in this thread.
> 
> Do you like attached patch?

It didn't work well in testing, this one should be better:
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8.patch
Type: text/x-diff
Size: 9923 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20061105/d867245f/attachment.bin 


More information about the busybox mailing list