ip rule: Require at least one argument for add
'ip rule add' with no additional arguments just adds another rule for the main table - which exists by default. Require at least 1 argument similar to delete. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
b65b4c0870
commit
2380120926
|
|
@ -696,6 +696,11 @@ static int iprule_modify(int cmd, int argc, char **argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cmd == RTM_NEWRULE) {
|
if (cmd == RTM_NEWRULE) {
|
||||||
|
if (argc == 0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"\"ip rule add\" requires arguments.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL;
|
req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL;
|
||||||
req.frh.action = FR_ACT_TO_TBL;
|
req.frh.action = FR_ACT_TO_TBL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue