netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: ctnetlink: fix dump of the expect mask attribute
@ 2021-03-15 10:31 Florian Westphal
  2021-03-15 17:43 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2021-03-15 10:31 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

Before this change, the mask is never included in the netlink message, so
"conntrack -E expect" always prints 0.0.0.0.

In older kernels the l3num callback struct was passed as argument, based
on tuple->src.l3num. After the l3num indirection got removed, the call
chain is based on m.src.l3num, but this value is 0xffff.

Init l3num to the correct value.

Fixes: f957be9d349a3 ("netfilter: conntrack: remove ctnetlink callbacks from l3 protocol trackers")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_conntrack_netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 1469365bac7e..1d519b0e51a5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2962,6 +2962,7 @@ static int ctnetlink_exp_dump_mask(struct sk_buff *skb,
 	memset(&m, 0xFF, sizeof(m));
 	memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3));
 	m.src.u.all = mask->src.u.all;
+	m.src.l3num = tuple->src.l3num;
 	m.dst.protonum = tuple->dst.protonum;
 
 	nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf] netfilter: ctnetlink: fix dump of the expect mask attribute
  2021-03-15 10:31 [PATCH nf] netfilter: ctnetlink: fix dump of the expect mask attribute Florian Westphal
@ 2021-03-15 17:43 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-03-15 17:43 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On Mon, Mar 15, 2021 at 11:31:09AM +0100, Florian Westphal wrote:
> Before this change, the mask is never included in the netlink message, so
> "conntrack -E expect" always prints 0.0.0.0.
> 
> In older kernels the l3num callback struct was passed as argument, based
> on tuple->src.l3num. After the l3num indirection got removed, the call
> chain is based on m.src.l3num, but this value is 0xffff.
> 
> Init l3num to the correct value.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-15 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-15 10:31 [PATCH nf] netfilter: ctnetlink: fix dump of the expect mask attribute Florian Westphal
2021-03-15 17:43 ` 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;
as well as URLs for NNTP newsgroup(s).