diff mbox series

[net,1/8] netfilter: allow ipv6 fragments to arrive on different devices

Message ID 20240814222042.150590-2-pablo@netfilter.org (mailing list archive)
State Accepted
Commit 3cd740b985963f874a1a094f1969e998b9d05554
Delegated to: Netdev Maintainers
Headers show
Series [net,1/8] netfilter: allow ipv6 fragments to arrive on different devices | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: dsahern@kernel.org coreteam@netfilter.org kadlec@netfilter.org
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest warning net-next-2024-08-15--00-00 (tests: 707)

Commit Message

Pablo Neira Ayuso Aug. 14, 2024, 10:20 p.m. UTC
From: Tom Hughes <tom@compton.nu>

Commit 264640fc2c5f4 ("ipv6: distinguish frag queues by device
for multicast and link-local packets") modified the ipv6 fragment
reassembly logic to distinguish frag queues by device for multicast
and link-local packets but in fact only the main reassembly code
limits the use of the device to those address types and the netfilter
reassembly code uses the device for all packets.

This means that if fragments of a packet arrive on different interfaces
then netfilter will fail to reassemble them and the fragments will be
expired without going any further through the filters.

Fixes: 648700f76b03 ("inet: frags: use rhashtables for reassembly units")
Signed-off-by: Tom Hughes <tom@compton.nu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/ipv6/netfilter/nf_conntrack_reasm.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 15, 2024, 11:30 a.m. UTC | #1
Hello:

This series was applied to netdev/net.git (main)
by Pablo Neira Ayuso <pablo@netfilter.org>:

On Thu, 15 Aug 2024 00:20:35 +0200 you wrote:
> From: Tom Hughes <tom@compton.nu>
> 
> Commit 264640fc2c5f4 ("ipv6: distinguish frag queues by device
> for multicast and link-local packets") modified the ipv6 fragment
> reassembly logic to distinguish frag queues by device for multicast
> and link-local packets but in fact only the main reassembly code
> limits the use of the device to those address types and the netfilter
> reassembly code uses the device for all packets.
> 
> [...]

Here is the summary with links:
  - [net,1/8] netfilter: allow ipv6 fragments to arrive on different devices
    https://git.kernel.org/netdev/net/c/3cd740b98596
  - [net,2/8] netfilter: nfnetlink: Initialise extack before use in ACKs
    https://git.kernel.org/netdev/net/c/d1a7b382a9d3
  - [net,3/8] netfilter: flowtable: initialise extack before use
    https://git.kernel.org/netdev/net/c/e9767137308d
  - [net,4/8] netfilter: nf_queue: drop packets with cloned unconfirmed conntracks
    https://git.kernel.org/netdev/net/c/7d8dc1c7be8d
  - [net,5/8] selftests: netfilter: add test for br_netfilter+conntrack+queue combination
    https://git.kernel.org/netdev/net/c/ea2306f0330c
  - [net,6/8] netfilter: nf_tables: Audit log dump reset after the fact
    https://git.kernel.org/netdev/net/c/e0b6648b0446
  - [net,7/8] netfilter: nf_tables: Introduce nf_tables_getobj_single
    https://git.kernel.org/netdev/net/c/69fc3e9e90f1
  - [net,8/8] netfilter: nf_tables: Add locking for NFT_MSG_GETOBJ_RESET requests
    https://git.kernel.org/netdev/net/c/bd662c4218f9

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 6f0844c9315d..4120e67a8ce6 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -154,6 +154,10 @@  static struct frag_queue *fq_find(struct net *net, __be32 id, u32 user,
 	};
 	struct inet_frag_queue *q;
 
+	if (!(ipv6_addr_type(&hdr->daddr) & (IPV6_ADDR_MULTICAST |
+					    IPV6_ADDR_LINKLOCAL)))
+		key.iif = 0;
+
 	q = inet_frag_find(nf_frag->fqdir, &key);
 	if (!q)
 		return NULL;