* [iptables PATCH] xtables-monitor: Fix ip6tables rule printing
@ 2020-08-07 14:51 Phil Sutter
2020-08-13 2:03 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2020-08-07 14:51 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
When printing an ip6tables rule event, false family ops are used as they
are initially looked up for AF_INET and reused no matter the current
rule's family. In practice, this means that nft_rule_print_save() calls
the wrong rule_to_cs, save_rule and clear_cs callbacks. Therefore, if a
rule specifies a source or destination address, the address is not
printed.
Fix this by performing a family lookup each time rule_cb is called.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
iptables/xtables-monitor.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c
index 57def83e2eea0..4008cc00d4694 100644
--- a/iptables/xtables-monitor.c
+++ b/iptables/xtables-monitor.c
@@ -93,6 +93,8 @@ static int rule_cb(const struct nlmsghdr *nlh, void *data)
if (arg->nfproto && arg->nfproto != family)
goto err_free;
+ arg->h->ops = nft_family_ops_lookup(family);
+
if (arg->is_event)
printf(" EVENT: ");
switch (family) {
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [iptables PATCH] xtables-monitor: Fix ip6tables rule printing
2020-08-07 14:51 [iptables PATCH] xtables-monitor: Fix ip6tables rule printing Phil Sutter
@ 2020-08-13 2:03 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-08-13 2:03 UTC (permalink / raw)
To: Phil Sutter; +Cc: netfilter-devel
On Fri, Aug 07, 2020 at 04:51:00PM +0200, Phil Sutter wrote:
> When printing an ip6tables rule event, false family ops are used as they
> are initially looked up for AF_INET and reused no matter the current
> rule's family. In practice, this means that nft_rule_print_save() calls
> the wrong rule_to_cs, save_rule and clear_cs callbacks. Therefore, if a
> rule specifies a source or destination address, the address is not
> printed.
>
> Fix this by performing a family lookup each time rule_cb is called.
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-13 2:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-07 14:51 [iptables PATCH] xtables-monitor: Fix ip6tables rule printing Phil Sutter
2020-08-13 2:03 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox