diff options
author | Florian Westphal <fw@strlen.de> | 2018-05-08 10:43:45 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-05-10 02:31:05 +0200 |
commit | 564862d0cfcd9c241e8410c8f9416c88764aefec (patch) | |
tree | 468bb552ec19412faccb9e1c48a59bdc1f0a4761 /iptables | |
parent | 0ae81d09c93a6c27573ae561f2af09153a5f3e51 (diff) |
xtables-compat: ebtables: split match/target print from nft_bridge_print_firewall
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables')
-rw-r--r-- | iptables/nft-bridge.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/iptables/nft-bridge.c b/iptables/nft-bridge.c index 1887586c..5f9a02c2 100644 --- a/iptables/nft-bridge.c +++ b/iptables/nft-bridge.c @@ -413,12 +413,34 @@ static void nft_bridge_print_header(unsigned int format, const char *chain, chain, refs, basechain ? pol : "RETURN"); } -static void nft_bridge_print_firewall(struct nftnl_rule *r, unsigned int num, - unsigned int format) +static void print_matches_and_watchers(const struct iptables_command_state *cs, + unsigned int format) { - struct xtables_match *matchp; struct xtables_target *watcherp; + struct xtables_match *matchp; struct ebt_match *m; + + for (m = cs->match_list; m; m = m->next) { + if (m->ismatch) { + matchp = m->u.match; + if (matchp->print != NULL) { + matchp->print(&cs->eb, matchp->m, + format & FMT_NUMERIC); + } + } else { + watcherp = m->u.watcher; + if (watcherp->print != NULL) { + watcherp->print(&cs->eb, watcherp->t, + format & FMT_NUMERIC); + } + } + } +} + + +static void nft_bridge_print_firewall(struct nftnl_rule *r, unsigned int num, + unsigned int format) +{ struct iptables_command_state cs = {}; char *addr; @@ -492,21 +514,7 @@ static void nft_bridge_print_firewall(struct nftnl_rule *r, unsigned int num, print_iface(cs.eb.out); } - for (m = cs.match_list; m; m = m->next) { - if (m->ismatch) { - matchp = m->u.match; - if (matchp->print != NULL) { - matchp->print(&cs.fw, matchp->m, - format & FMT_NUMERIC); - } - } else { - watcherp = m->u.watcher; - if (watcherp->print != NULL) { - watcherp->print(&cs.fw, watcherp->t, - format & FMT_NUMERIC); - } - } - } + print_matches_and_watchers(&cs, format); printf("-j "); |