- use uint32_t as suggested by vda.
- minor size- and readability tweaks while at it: text data bss dec hex filename 2631 0 0 2631 a47 networking/libiproute/iprule.o.orig 2596 0 0 2596 a24 networking/libiproute/iprule.o
This commit is contained in:
parent
6912ea1467
commit
4d9a358ec1
@ -13,6 +13,7 @@
|
|||||||
* Changes:
|
* Changes:
|
||||||
*
|
*
|
||||||
* Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
|
* Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
|
||||||
|
* initially integrated into busybox by Bernhard Fischer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
@ -168,7 +169,8 @@ static int iprule_list(int argc, char **argv)
|
|||||||
af = AF_INET;
|
af = AF_INET;
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
bb_error_msg("\"rule show\" needs no arguments");
|
//bb_error_msg("\"rule show\" needs no arguments");
|
||||||
|
bb_warn_ignoring_args(argc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
|
|||||||
addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
|
addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
|
||||||
} else if (matches(*argv, "table") == 0 ||
|
} else if (matches(*argv, "table") == 0 ||
|
||||||
strcmp(*argv, "lookup") == 0) {
|
strcmp(*argv, "lookup") == 0) {
|
||||||
unsigned int tid;
|
uint32_t tid;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (rtnl_rttable_a2n(&tid, *argv))
|
if (rtnl_rttable_a2n(&tid, *argv))
|
||||||
invarg("table ID", *argv);
|
invarg("table ID", *argv);
|
||||||
@ -304,16 +306,16 @@ static int iprule_modify(int cmd, int argc, char **argv)
|
|||||||
|
|
||||||
int do_iprule(int argc, char **argv)
|
int do_iprule(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static const char * const ip_rule_commands[] =
|
const char * const ip_rule_commands[] =
|
||||||
{"add", "delete", "list", "show", 0};
|
{"add", "delete", "list", "show", 0};
|
||||||
int command_num = 2;
|
int cmd = 2; /* list */
|
||||||
int cmd;
|
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
return iprule_list(0, NULL);
|
return iprule_list(0, NULL);
|
||||||
if (*argv)
|
if (*argv)
|
||||||
command_num = index_in_substr_array(ip_rule_commands, *argv);
|
cmd = index_in_substr_array(ip_rule_commands, *argv);
|
||||||
switch (command_num) {
|
|
||||||
|
switch (cmd) {
|
||||||
case 0: /* add */
|
case 0: /* add */
|
||||||
cmd = RTM_NEWRULE;
|
cmd = RTM_NEWRULE;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user