]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'netfilter-vrf-rework'
authorDavid S. Miller <davem@davemloft.net>
Tue, 26 Oct 2021 12:21:10 +0000 (13:21 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Oct 2021 12:21:10 +0000 (13:21 +0100)
commit7869fab8116116da24b07bc16026c4a43f75dcb4
tree0903cd112a51720bc910ae1439b4bac14d7f2f69
parent438da86ea2c70cc767b7120251d2f2e30a5ad58f
parent328d5896dbf566f87325569c061d7245ef89778a
Merge branch 'netfilter-vrf-rework'

Florian Westphal says:

====================
vrf: rework interaction with netfilter/conntrack

V2:
- fix 'plain integer as null pointer' warning
- reword commit message in patch 2 to clarify loss of 'ct set untracked'

This patch series aims to solve the to-be-reverted change 4420796010c7040364
("vrf: Reset skb conntrack connection on VRF rcv") in a different way.

Rather than have skbs pass through conntrack and nat hooks twice, suppress
conntrack invocation if the conntrack/nat hook is called from the vrf driver.

First patch deals with 'incoming connection' case:
1. suppress NAT transformations
2. skip conntrack confirmation

NAT and conntrack confirmation is done when ip/ipv6 stack calls
the postrouting hook.

Second patch deals with local packets:
in vrf driver, mark the skbs as 'untracked', so conntrack output
hook ignores them.  This skips all nat hooks as well.

Afterwards, remove the untracked state again so the second
round will pick them up.

One alternative to the chosen implementation would be to add a 'caller
id' field to 'struct nf_hook_state' and then use that, these patches
use the more straightforward check of VRF flag on the state->out device.

The two patches apply to both net and net-next, i am targeting -next
because I think that since snat did not work correctly for so long that
we can take the longer route.  If you disagree, apply to net at your
discretion.

The patches apply both with 4420796010c7040364 reverted or still
in-place, but only with the revert in place ingress conntrack settings
(zone, notrack etc) start working again.

I've already submitted selftests for vrf+nfqueue and conntrack+vrf.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>