linux/net/ipv4/netfilter
Fernando Fernandez Mancera 0bf00859d7 netfilter: nf_socket: skip socket lookup for non-first fragments
Both nft_socket and xt_socket relies on L4 headers to perform socket
lookup in the slow path. For fragmented packets, while the IP protocol
remains constant across all fragments, only the first fragment contains
the actual L4 header.

As the expression/match could be attached to a chain with a priority
lower than -400, it could bypass defragmentation.

Add a check for fragmentation in the lookup functions directly so the
problem is handled for both nft_socket and xt_socket at the same time.
In addition, future users of the functions would not need to care about
this.

Fixes: 902d6a4c2a ("netfilter: nf_defrag: Skip defrag if NOTRACK is set")
Fixes: 554ced0a6e ("netfilter: nf_tables: add support for native socket matching")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
History 2026-04-30 17:59:01 +02:00
..
arp_tables.c netfilter: arp_tables: fix IEEE1394 ARP payload parsing 2026-04-21 12:44:39 +02:00
arpt_mangle.c netfilter: arp_tables: fix IEEE1394 ARP payload parsing 2026-04-21 12:44:39 +02:00
arptable_filter.c netfilter: arp_tables: allow use of arpt_do_table as hookfn 2021-10-14 23:06:53 +02:00
ip_tables.c netfilter: nf_dup{4, 6}: Move duplication check to task_struct 2025-05-23 13:57:12 +02:00
ipt_ah.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ipt_ECN.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-22 08:59:24 -04:00
ipt_REJECT.c netfilter: use actual socket sk for REJECT action 2020-12-01 14:33:55 +01:00
ipt_rpfilter.c ipv4: Convert ->flowi4_tos to dscp_t. 2025-08-26 17:34:31 -07:00
ipt_SYNPROXY.c netfilter: Add MODULE_DESCRIPTION entries to kernel modules 2020-06-25 00:50:31 +02:00
iptable_filter.c netfilter: use NF_DROP instead of -NF_DROP 2024-05-06 16:29:21 +02:00
iptable_mangle.c netfilter: xt_mangle: only check verdict part of return value 2023-10-18 10:26:43 +02:00
iptable_nat.c netfilter: nat: use kfree_rcu to release ops 2026-04-20 23:45:41 +02:00
iptable_raw.c netfilter: add missing module descriptions 2023-11-08 13:52:32 +01:00
iptable_security.c netfilter: iptables: allow use of ipt_do_table as hookfn 2021-10-14 23:06:53 +02:00
Kconfig netfilter: add back NETFILTER_XTABLES dependencies 2025-08-07 13:19:25 +02:00
Makefile netfilter: xtables: allow xtables-nft only builds 2024-01-29 15:43:21 +01:00
nf_defrag_ipv4.c netfilter: add missing module descriptions 2023-11-08 13:52:32 +01:00
nf_dup_ipv4.c ipv4: Convert ->flowi4_tos to dscp_t. 2025-08-26 17:34:31 -07:00
nf_nat_h323.c netfilter: nat: move repetitive nat port reserve loop to a helper 2022-09-07 16:46:04 +02:00
nf_nat_pptp.c netfilter: conntrack: pptp: use single option structure 2022-02-04 06:30:28 +01:00
nf_nat_snmp_basic.asn1 treewide: Add SPDX identifier to IETF ASN.1 modules 2023-10-27 18:04:28 +08:00
nf_nat_snmp_basic_main.c netfilter: ipv4: prefer skb_ensure_writable 2019-05-31 18:02:46 +02:00
nf_reject_ipv4.c ipv4: use dst4_mtu() instead of dst_mtu() 2026-02-02 17:49:29 -08:00
nf_socket_ipv4.c netfilter: nf_socket: skip socket lookup for non-first fragments 2026-04-30 17:59:01 +02:00
nf_tproxy_ipv4.c tcp: Don't pass hashinfo to socket lookup helpers. 2025-08-25 17:53:35 -07:00
nft_dup_ipv4.c netfilter: nf_tables: remove register tracking infrastructure 2026-02-25 19:36:26 -08:00
nft_fib_ipv4.c netfilter: nf_tables: remove register tracking infrastructure 2026-02-25 19:36:26 -08:00
nft_reject_ipv4.c netfilter: nf_tables: remove register tracking infrastructure 2026-02-25 19:36:26 -08:00