diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-15 11:48:48 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-12-30 23:50:35 +0100 |
commit | 10f92fce0a2ea1805c8b269543b8f1738d22bf3d (patch) | |
tree | d73a6a126c00aff4c752fa5c302e99db4e1df4d4 | |
parent | 0b3bafcedff19b69ff5a51855da28e8e83c05b71 (diff) |
xtables: nft: display rule number via -S
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | iptables/nft.c | 10 | ||||
-rw-r--r-- | iptables/xtables.c | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/iptables/nft.c b/iptables/nft.c index a9a391df..3d5a1532 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -2543,11 +2543,13 @@ int nft_rule_list_save(struct nft_handle *h, const char *chain, struct nft_chain_list *list; struct nft_chain_list_iter *iter; struct nft_chain *c; + int ret = 1; list = nft_chain_dump(h); /* Dump policies and custom chains first */ - nft_rule_list_chain_save(h, table, list, counters); + if (!rulenum) + nft_rule_list_chain_save(h, table, list, counters); /* Now dump out rules in this table */ iter = nft_chain_list_iter_create(list); @@ -2566,15 +2568,15 @@ int nft_rule_list_save(struct nft_handle *h, const char *chain, if (chain && strcmp(chain, chain_name) != 0) goto next; - __nft_rule_list(h, c, table, rulenum, - counters ? 0 : FMT_NOCOUNTS, list_save); + ret = __nft_rule_list(h, c, table, rulenum, + counters ? 0 : FMT_NOCOUNTS, list_save); next: c = nft_chain_list_iter_next(iter); } err: nft_chain_list_free(list); - return 1; + return ret; } static int nft_action(struct nft_handle *h, int type) diff --git a/iptables/xtables.c b/iptables/xtables.c index c712aaf4..a5a83c24 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -582,7 +582,7 @@ list_rules(struct nft_handle *h, const char *chain, const char *table, nft_rule_list_save(h, chain, table, rulenum, counters); - /* FIXME found */ + /* iptables does not return error if rule number not found */ return 1; } |