diff mbox series

[iptables,2/3] xtables: Clarify error message when deleting by index

Message ID 20181112132947.9501-3-phil@nwl.cc
State Accepted
Headers show
Series A few minor fixes | expand

Commit Message

Phil Sutter Nov. 12, 2018, 1:29 p.m. UTC
Trying to delete a rule by index from a non-existent chain leads to a
somewhat confusing error message:

| # iptables-nft -D foobar 1
| iptables: Index of deletion too big.

Fix this by performing chain existence checks for CMD_DELETE_NUM, too.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 iptables/xtables.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/iptables/xtables.c b/iptables/xtables.c
index 429bd652cc439..24a6e234bcf4b 100644
--- a/iptables/xtables.c
+++ b/iptables/xtables.c
@@ -1040,6 +1040,7 @@  void do_parse(struct nft_handle *h, int argc, char *argv[],
 
 	if (p->command == CMD_APPEND ||
 	    p->command == CMD_DELETE ||
+	    p->command == CMD_DELETE_NUM ||
 	    p->command == CMD_CHECK ||
 	    p->command == CMD_INSERT ||
 	    p->command == CMD_REPLACE) {