iproute: disallow ip rule del without parameters
Disallow run `ip rule del` without any parameter to avoid delete any first rule from table. Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
This commit is contained in:
parent
567e696072
commit
67a990b811
|
|
@ -346,6 +346,11 @@ static int iprule_modify(int cmd, int argc, char **argv)
|
||||||
req.r.rtm_type = RTN_UNICAST;
|
req.r.rtm_type = RTN_UNICAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd == RTM_DELRULE && argc == 0) {
|
||||||
|
fprintf(stderr, "\"ip rule del\" requires arguments.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (strcmp(*argv, "not") == 0) {
|
if (strcmp(*argv, "not") == 0) {
|
||||||
req.r.rtm_flags |= FIB_RULE_INVERT;
|
req.r.rtm_flags |= FIB_RULE_INVERT;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue