kernel-hacking-2024-linux-s.../net/bridge
Florian Westphal 2b272bb558 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: c4b0e771f9 ("netfilter: avoid using skb->nf_bridge directly")
Reported-and-tested-by: Wolfgang Nothdurft <wolfgang@linogate.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2023-01-31 13:59:36 +01:00
..
netfilter netfilter: conntrack: merge ipv4+ipv6 confirm functions 2022-11-30 18:55:30 +01:00
br.c bridge: switchdev: Allow device drivers to install locked FDB entries 2022-11-09 19:06:13 -08:00
br_arp_nd_proxy.c
br_cfm.c
br_cfm_netlink.c
br_device.c
br_fdb.c bridge: switchdev: Allow device drivers to install locked FDB entries 2022-11-09 19:06:13 -08:00
br_forward.c
br_if.c kobject: make kobject_get_ownership() take a constant kobject * 2022-11-22 17:34:29 +01:00
br_input.c bridge: Add missing parentheses 2022-11-11 21:34:55 -08:00
br_ioctl.c
br_mdb.c bridge: mcast: Support replacement of MDB port group entries 2022-12-12 15:33:37 -08:00
br_mrp.c
br_mrp_netlink.c
br_mrp_switchdev.c
br_mst.c
br_multicast.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
br_multicast_eht.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
br_netfilter_hooks.c netfilter: br_netfilter: disable sabotage_in hook after first suppression 2023-01-31 13:59:36 +01:00
br_netfilter_ipv6.c
br_netlink.c bridge: Add MAC Authentication Bypass (MAB) support 2022-11-03 20:46:32 -07:00
br_netlink_tunnel.c
br_nf_core.c
br_private.h bridge: mcast: Support replacement of MDB port group entries 2022-12-12 15:33:37 -08:00
br_private_cfm.h
br_private_mcast_eht.h
br_private_mrp.h
br_private_stp.h
br_private_tunnel.h
br_stp.c
br_stp_bpdu.c
br_stp_if.c
br_stp_timer.c
br_switchdev.c bridge: switchdev: Reflect MAB bridge port flag to device drivers 2022-11-09 19:06:14 -08:00
br_sysfs_br.c bridge: Fix flushing of dynamic FDB entries 2022-11-02 20:47:09 -07:00
br_sysfs_if.c
br_vlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
br_vlan_options.c
br_vlan_tunnel.c
Kconfig
Makefile