]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
vrf: run conntrack only in context of lower/physdev for locally generated packets
authorFlorian Westphal <fw@strlen.de>
Mon, 25 Oct 2021 14:14:00 +0000 (16:14 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:48:17 +0000 (09:48 +0100)
commit540cab7c7af2f4bc80226574d81ecd0ccd139762
treea3d796d914c9a788cd42a071d8358256e9868c59
parent719e1dd890296566acd844030c512bb3f09aac1e
vrf: run conntrack only in context of lower/physdev for locally generated packets

BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit 8c9c296adfae9ea05f655d69e9f6e13daa86fb4a ]

The VRF driver invokes netfilter for output+postrouting hooks so that users
can create rules that check for 'oif $vrf' rather than lower device name.

This is a problem when NAT rules are configured.

To avoid any conntrack involvement in round 1, tag skbs as 'untracked'
to prevent conntrack from picking them up.

This gets cleared before the packet gets handed to the ip stack so
conntrack will be active on the second iteration.

One remaining issue is that a rule like

  output ... oif $vrfname notrack

won't propagate to the second round because we can't tell
'notrack set via ruleset' and 'notrack set by vrf driver' apart.
However, this isn't a regression: the 'notrack' removal happens
instead of unconditional nf_reset_ct().
I'd also like to avoid leaking more vrf specific conditionals into the
netfilter infra.

For ingress, conntrack has already been done before the packet makes it
to the vrf driver, with this patch egress does connection tracking with
lower/physical device as well.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/vrf.c