src: display rule by number
PATCH v2 1/1 src: display rule by number
This patch fixes the display of rule by number.
Signed-off-by Giuseppe Longo <[email protected]>
--- iptables/nft.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
iptables/nft.c +11 -11
@@ -2450,19 +2450,19 @@ __nft_rule_list(struct nft_handle *h, struct nft_chain *c, const char *table, strcmp(chain, rule_chain) != 0) goto next; -if (rulenum >0 ) { +if (rulenum >0 && rule_ctr != rulenum) {/* List by rule number case */ -if (rule_ctr != rulenum) { - rule_ctr++; - goto next; - } - }else { -struct iptables_command_state cs = {}; -/* Show all rules case */ -nft_rule_to_iptables_command_state (r, &cs); - -cb (&cs, r, rule_ctr, format); + goto next; } + +struct iptables_command_state cs = {}; +/* Show all rules case */ +nft_rule_to_iptables_command_state (r, &cs); + +cb (&cs, r, rule_ctr, format); +if (rulenum >0 && rule_ctr == rulenum) +break ; + next: r =nft_rule_list_iter_next (iter); }
Hi Giuseppe,
Sounds fine to me.
Tomasz
Quoted 1 line · Giuseppe Longo
This patch fixes the display of rule by number.
Applied, thanks Giuseppe and Tomasz.