From: Andrey Jr. Melnikov Date: Wed, 24 Aug 2016 20:43:00 +0000 (+0300) Subject: iproute: disallow ip rule del without parameters X-Git-Tag: v4.8.0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67a990b8112611e5e4b64f2a5f6ee890422d7695;p=thirdparty%2Fiproute2.git 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 --- diff --git a/ip/iprule.c b/ip/iprule.c index 8f242067f..70562c553 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -346,6 +346,11 @@ static int iprule_modify(int cmd, int argc, char **argv) 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) { if (strcmp(*argv, "not") == 0) { req.r.rtm_flags |= FIB_RULE_INVERT;