* [PATCH iproute2] ip rule: Require at least one argument for add
@ 2018-10-30 20:59 David Ahern
2018-11-01 19:54 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2018-10-30 20:59 UTC (permalink / raw)
To: netdev; +Cc: stephen, David Ahern
From: David Ahern <dsahern@gmail.com>
'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>
---
ip/iprule.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ip/iprule.c b/ip/iprule.c
index d89d808d8909..b465a80785b1 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -691,6 +691,11 @@ static int iprule_modify(int cmd, int argc, char **argv)
};
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.frh.action = FR_ACT_TO_TBL;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-02 4:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 20:59 [PATCH iproute2] ip rule: Require at least one argument for add David Ahern
2018-11-01 19:54 ` Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.