]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Clarify error message when deleting by index
authorPhil Sutter <phil@nwl.cc>
Mon, 12 Nov 2018 13:29:46 +0000 (14:29 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 12 Nov 2018 13:34:10 +0000 (14:34 +0100)
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

index 429bd652cc439f99074c2c49c494a55ce0aa2e01..24a6e234bcf4b9efdce888fab5fb6d0aefc9ea68 100644 (file)
@@ -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) {