Skip to content

Commit 52691f7

Browse files
committed
netfilter: br_netfilter: disable sabotage_in hook after first suppression
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2189550 Upstream Status: commit 2b272bb commit 2b272bb Author: Florian Westphal <[email protected]> Date: Mon Jan 30 11:39:29 2023 +0100 netfilter: br_netfilter: disable sabotage_in hook after first suppression When using a xfrm interface in a bridged setup (the outgoing device is bridged), the incoming packets in the xfrm interface are only tracked in the outgoing direction. $ brctl show bridge name interfaces br_eth1 eth1 $ conntrack -L tcp 115 SYN_SENT src=192... dst=192... [UNREPLIED] ... If br_netfilter is enabled, the first (encrypted) packet is received onR eth1, conntrack hooks are called from br_netfilter emulation which allocates nf_bridge info for this skb. If the packet is for local machine, skb gets passed up the ip stack. The skb passes through ip prerouting a second time. br_netfilter ip_sabotage_in supresses the re-invocation of the hooks. After this, skb gets decrypted in xfrm layer and appears in network stack a second time (after decryption). Then, ip_sabotage_in is called again and suppresses netfilter hook invocation, even though the bridge layer never called them for the plaintext incarnation of the packet. Free the bridge info after the first suppression to avoid this. I was unable to figure out where the regression comes from, as far as i can see br_netfilter always had this problem; i did not expect that skb is looped again with different headers. Fixes: c4b0e77 ("netfilter: avoid using skb->nf_bridge directly") Reported-and-tested-by: Wolfgang Nothdurft <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent be67665 commit 52691f7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/bridge/br_netfilter_hooks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ static unsigned int ip_sabotage_in(void *priv,
871871
if (nf_bridge && !nf_bridge->in_prerouting &&
872872
!netif_is_l3_master(skb->dev) &&
873873
!netif_is_l3_slave(skb->dev)) {
874+
nf_bridge_info_free(skb);
874875
state->okfn(state->net, state->sk, skb);
875876
return NF_STOLEN;
876877
}

0 commit comments

Comments
 (0)