fix numbering in switch(): we don't have "del" anymore,
substring match on "delete" handles it ok. But we (I?) forgot to renumber case labels...
This commit is contained in:
parent
5ff8f3d7fd
commit
fd94efa41f
@ -33,8 +33,9 @@ int ip_main(int argc, char **argv)
|
|||||||
if (ENABLE_FEATURE_IP_LINK && matches(argv[1], "link") == 0) {
|
if (ENABLE_FEATURE_IP_LINK && matches(argv[1], "link") == 0) {
|
||||||
ret = do_iplink(argc-2, argv+2);
|
ret = do_iplink(argc-2, argv+2);
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_IP_TUNNEL &&
|
if (ENABLE_FEATURE_IP_TUNNEL
|
||||||
(matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0)) {
|
&& (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0)
|
||||||
|
) {
|
||||||
ret = do_iptunnel(argc-2, argv+2);
|
ret = do_iptunnel(argc-2, argv+2);
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_IP_RULE && matches(argv[1], "rule") == 0) {
|
if (ENABLE_FEATURE_IP_RULE && matches(argv[1], "rule") == 0) {
|
||||||
|
@ -835,9 +835,11 @@ static int iproute_get(int argc, char **argv)
|
|||||||
|
|
||||||
int do_iproute(int argc, char **argv)
|
int do_iproute(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static const char * const ip_route_commands[] =
|
static const char * const ip_route_commands[] = {
|
||||||
{ "add", "append", "change", "chg", "delete", "get",
|
/*0-3*/ "add", "append", "change", "chg",
|
||||||
"list", "show", "prepend", "replace", "test", "flush", 0 };
|
/*4-7*/ "delete", "get", "list", "show",
|
||||||
|
/*8..*/ "prepend", "replace", "test", "flush", 0
|
||||||
|
};
|
||||||
int command_num = 6;
|
int command_num = 6;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
int cmd = RTM_NEWROUTE;
|
int cmd = RTM_NEWROUTE;
|
||||||
@ -848,7 +850,7 @@ int do_iproute(int argc, char **argv)
|
|||||||
command_num = index_in_substr_array(ip_route_commands, *argv);
|
command_num = index_in_substr_array(ip_route_commands, *argv);
|
||||||
}
|
}
|
||||||
switch (command_num) {
|
switch (command_num) {
|
||||||
case 0: /* add*/
|
case 0: /* add */
|
||||||
flags = NLM_F_CREATE|NLM_F_EXCL;
|
flags = NLM_F_CREATE|NLM_F_EXCL;
|
||||||
break;
|
break;
|
||||||
case 1: /* append */
|
case 1: /* append */
|
||||||
@ -859,21 +861,20 @@ int do_iproute(int argc, char **argv)
|
|||||||
flags = NLM_F_REPLACE;
|
flags = NLM_F_REPLACE;
|
||||||
break;
|
break;
|
||||||
case 4: /* delete */
|
case 4: /* delete */
|
||||||
case 5: /* del */
|
|
||||||
cmd = RTM_DELROUTE;
|
cmd = RTM_DELROUTE;
|
||||||
break;
|
break;
|
||||||
case 6: /* get */
|
case 5: /* get */
|
||||||
return iproute_get(argc-1, argv+1);
|
return iproute_get(argc-1, argv+1);
|
||||||
case 7: /* list */
|
case 6: /* list */
|
||||||
case 8: /* show */
|
case 7: /* show */
|
||||||
return iproute_list_or_flush(argc-1, argv+1, 0);
|
return iproute_list_or_flush(argc-1, argv+1, 0);
|
||||||
case 9: /* prepend */
|
case 8: /* prepend */
|
||||||
flags = NLM_F_CREATE;
|
flags = NLM_F_CREATE;
|
||||||
case 10: /* replace */
|
case 9: /* replace */
|
||||||
flags = NLM_F_CREATE|NLM_F_REPLACE;
|
flags = NLM_F_CREATE|NLM_F_REPLACE;
|
||||||
case 11: /* test */
|
case 10: /* test */
|
||||||
flags = NLM_F_EXCL;
|
flags = NLM_F_EXCL;
|
||||||
case 12: /* flush */
|
case 11: /* flush */
|
||||||
return iproute_list_or_flush(argc-1, argv+1, 1);
|
return iproute_list_or_flush(argc-1, argv+1, 1);
|
||||||
default:
|
default:
|
||||||
bb_error_msg_and_die("unknown command %s", *argv);
|
bb_error_msg_and_die("unknown command %s", *argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user