netfilter: nf_queue: drop packets with cloned unconfirmed conntracks
authorFlorian Westphal <fw@strlen.de>
Wed, 7 Aug 2024 19:28:41 +0000 (21:28 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 14 Aug 2024 21:37:23 +0000 (23:37 +0200)
commit7d8dc1c7be8d3509e8f5164dd5df64c8e34d7eeb
tree6c9e46a8826f58e13a337aaa9974df82e610d491
parente9767137308daf906496613fd879808a07f006a2
netfilter: nf_queue: drop packets with cloned unconfirmed conntracks

Conntrack assumes an unconfirmed entry (not yet committed to global hash
table) has a refcount of 1 and is not visible to other cores.

With multicast forwarding this assumption breaks down because such
skbs get cloned after being picked up, i.e.  ct->use refcount is > 1.

Likewise, bridge netfilter will clone broad/mutlicast frames and
all frames in case they need to be flood-forwarded during learning
phase.

For ip multicast forwarding or plain bridge flood-forward this will
"work" because packets don't leave softirq and are implicitly
serialized.

With nfqueue this no longer holds true, the packets get queued
and can be reinjected in arbitrary ways.

Disable this feature, I see no other solution.

After this patch, nfqueue cannot queue packets except the last
multicast/broadcast packet.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/bridge/br_netfilter_hooks.c
net/netfilter/nfnetlink_queue.c