diff options
Diffstat (limited to 'networking/libiproute/ipaddress.c')
-rw-r--r-- | networking/libiproute/ipaddress.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 955a9d933..8874fdb0a 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -412,7 +412,7 @@ static void ipaddr_reset_filter(int _oneline) | |||
412 | /* Return value becomes exitcode. It's okay to not return at all */ | 412 | /* Return value becomes exitcode. It's okay to not return at all */ |
413 | int ipaddr_list_or_flush(int argc, char **argv, int flush) | 413 | int ipaddr_list_or_flush(int argc, char **argv, int flush) |
414 | { | 414 | { |
415 | static const char *const option[] = { "to", "scope", "up", "label", "dev", 0 }; | 415 | static const char option[] = "to\0""scope\0""up\0""label\0""dev\0"; |
416 | 416 | ||
417 | struct nlmsg_list *linfo = NULL; | 417 | struct nlmsg_list *linfo = NULL; |
418 | struct nlmsg_list *ainfo = NULL; | 418 | struct nlmsg_list *ainfo = NULL; |
@@ -437,7 +437,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush) | |||
437 | } | 437 | } |
438 | 438 | ||
439 | while (argc > 0) { | 439 | while (argc > 0) { |
440 | const int option_num = index_in_str_array(option, *argv); | 440 | const int option_num = index_in_strings(option, *argv); |
441 | switch (option_num) { | 441 | switch (option_num) { |
442 | case 0: /* to */ | 442 | case 0: /* to */ |
443 | NEXT_ARG(); | 443 | NEXT_ARG(); |
@@ -599,18 +599,17 @@ static int default_scope(inet_prefix *lcl) | |||
599 | /* Return value becomes exitcode. It's okay to not return at all */ | 599 | /* Return value becomes exitcode. It's okay to not return at all */ |
600 | static int ipaddr_modify(int cmd, int argc, char **argv) | 600 | static int ipaddr_modify(int cmd, int argc, char **argv) |
601 | { | 601 | { |
602 | static const char *const option[] = { | 602 | static const char option[] = |
603 | "peer", "remote", "broadcast", "brd", | 603 | "peer\0""remote\0""broadcast\0""brd\0" |
604 | "anycast", "scope", "dev", "label", "local", 0 | 604 | "anycast\0""scope\0""dev\0""label\0""local\0"; |
605 | }; | ||
606 | struct rtnl_handle rth; | 605 | struct rtnl_handle rth; |
607 | struct { | 606 | struct { |
608 | struct nlmsghdr n; | 607 | struct nlmsghdr n; |
609 | struct ifaddrmsg ifa; | 608 | struct ifaddrmsg ifa; |
610 | char buf[256]; | 609 | char buf[256]; |
611 | } req; | 610 | } req; |
612 | char *d = NULL; | 611 | char *d = NULL; |
613 | char *l = NULL; | 612 | char *l = NULL; |
614 | inet_prefix lcl; | 613 | inet_prefix lcl; |
615 | inet_prefix peer; | 614 | inet_prefix peer; |
616 | int local_len = 0; | 615 | int local_len = 0; |
@@ -627,7 +626,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
627 | req.ifa.ifa_family = preferred_family; | 626 | req.ifa.ifa_family = preferred_family; |
628 | 627 | ||
629 | while (argc > 0) { | 628 | while (argc > 0) { |
630 | const int option_num = index_in_str_array(option, *argv); | 629 | const int option_num = index_in_strings(option, *argv); |
631 | switch (option_num) { | 630 | switch (option_num) { |
632 | case 0: /* peer */ | 631 | case 0: /* peer */ |
633 | case 1: /* remote */ | 632 | case 1: /* remote */ |
@@ -769,14 +768,13 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
769 | /* Return value becomes exitcode. It's okay to not return at all */ | 768 | /* Return value becomes exitcode. It's okay to not return at all */ |
770 | int do_ipaddr(int argc, char **argv) | 769 | int do_ipaddr(int argc, char **argv) |
771 | { | 770 | { |
772 | static const char *const commands[] = { | 771 | static const char commands[] = |
773 | "add", "delete", "list", "show", "lst", "flush", 0 | 772 | "add\0""delete\0""list\0""show\0""lst\0""flush\0"; |
774 | }; | ||
775 | 773 | ||
776 | int command_num = 2; /* default command is list */ | 774 | int command_num = 2; /* default command is list */ |
777 | 775 | ||
778 | if (*argv) { | 776 | if (*argv) { |
779 | command_num = index_in_substr_array(commands, *argv); | 777 | command_num = index_in_substrings(commands, *argv); |
780 | } | 778 | } |
781 | if (command_num < 0 || command_num > 5) | 779 | if (command_num < 0 || command_num > 5) |
782 | bb_error_msg_and_die("unknown command %s", *argv); | 780 | bb_error_msg_and_die("unknown command %s", *argv); |