[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160824204252.2melotzdx6ftzgaq@ppc.Dlink>
Date: Wed, 24 Aug 2016 23:43:00 +0300
From: "Andrey Jr. Melnikov" <temnota.am@...il.com>
To: Stephen Hemminger <shemminger@...l.org>
Cc: netdev@...r.kernel.org
Subject: [PATCH] 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@...il.com>
---
diff --git a/ip/iprule.c b/ip/iprule.c
index 8f24206..70562c5 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;
Powered by blists - more mailing lists