From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424321; b=OworXMhLTYi+t7IGgyWgetn3pzC4ESM24U6fkRJ771fCoAfafVIqYgYWbAJOZk2d41hk WXXM1CzDC3PS+cIhl+jtpf5dnW4bvoB6YNnROmyr2k0wU0wkcSQ3qDF4A6ryxsvima85U xsB/W5+5frCYCiKzJW6qCYJ+/pWs8vND+4kWyEjcnTi8EOk+YEqo6N802VuPDAeuaavP0 D4GEqV3erItyXmBRUx7wj9cZguWPmc13g1S7wgDvh4yqYqvV+0H5aoj5MtdukFcA/X5go rXtacKNuTTVz5l8qjNbcD2ndafnlBSe2TFRBuYcf3NXc1F0k0ocdjwGbPGjEZ+PGR1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796424321; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=V4rYtJVAyq7QiVNpqWI541lIBkw3BL2PbP7SNMD9LvM=; b=xXCwCFzHuuv+D4GN6ZDbtEWVuZrhKKMlc7WcCL4I/YMs461V+L5/ICYhZIPBsA9abIQQ 0v1J6p1cTN8eK6KC1pKBVSYQMJzD7+vvxNH7efNUfIeMHhO8g13acW6Maj2ML1MLk5NeK SjyercJnfe6C+Yx0KIQFjjnR1nZCHUYKsq//pCnq4t8g4AEeJYHQ4Y7BBD9r+B5ocrOhi GMP1IdNCqdSQQNhmZKZwKcDVU3BZaDKJ/1A8UDSLaT+c9WDjBh2kLDzHXr1PAw97ql5LJ 89qlsjeC3yRp3FmCEJqRz1T6enMYKLUAB0LicbDbzzYSlzMZKF1gE4uYMTk5Zq1Hxhg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=ZzbfHV4y; arc=none smtp.remote-ip=209.85.208.49 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD9FC606A33A for ; Fri, 4 Dec 2026 22:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CD9FC606A33A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=ZzbfHV4y Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-6bcbb79c939so2093359a12.2 for ; Fri, 04 Dec 2026 14:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1796424319; x=1797029119; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=V4rYtJVAyq7QiVNpqWI541lIBkw3BL2PbP7SNMD9LvM=; b=ZzbfHV4yM+fuNJvi6vmHSkHbhvYujJkmOGLO4eLYKAndNQ2FHcwMXyma6hG1Da/IqY +r4fFsmfnqAH79T0BKnXcBe8wnqtvslgQg2uEZ625/VloQ55rW+HKXBqS/ScEd/fQglW ymN9qPmyZF6nP5RujkJPYgTE+afdxoHC6ovICGWIX8YKEVJix4F3pE4eH8aiVMEtyfNO n7pEiq6QgvkSgf3+1o6UdJpL9EIf4GVEgMcG01TT3IUIjtyCuhqrdLhCnkIRk27uTT6c i+CM5wo243Zf8dCK3fBKvgdLgz6dbXhT2BDzwJFHQ3lT8FIMpgeFBrPKzUhUO7RhOVgM qcCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796424319; x=1797029119; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=V4rYtJVAyq7QiVNpqWI541lIBkw3BL2PbP7SNMD9LvM=; b=VOfL80xUc7H0/9i7CAZCK+gwEHZN7slwbJKISPRlfZ6wXhvvYp4EVy7c1fA8qbl0fR JH23vXvn6X7YRXCzwT/KILgNEgwv4I88zaJRBVmVHOrGouNG0zdYQVHrU8PNQg5CskBo vMrszZmEr+D5w8UZjrUGEWZpryZOjRVLal2CTWj8d3Xfu7ZaSaytfBgn1Ucua1KP9Sw7 EgBaz/1FQHZLmFKdvyROA/wPtMSyxjcn6CNgiC5O9nLH+L8Z2V7wYz3Lpo16KAmWamLv C+fdhQGVFGcwUVnlePsylTMByt6tMAVoSoYRutDTyDwrTFA54FjXFsswfPmv5wtucFh+ TWIg== X-Gm-Message-State: AB4q+uFahAu21lkpSCq6drfuuNZdeUodVg+lD33XnY3z/lMFGZPHBo3c VDLfFCMJeIinBulwRZcKq+qL1oGuUTTDcRqPieH4uQfW0ShntS8LOFrxiJ/WDJ1GxgBroLTZZ7i WyEwmooJa X-Gm-Gg: AZFdTZewQ2pwY7CoNVnn2EIY7l5X1pCMB8dc4IPAv9m54b8YVDl25yUSvF4UF5tVtB8 rpRQMKQCgNGCWN5Zru2EPsTLVFsvGJJQq1spjGyR8Lh4NkwkiRKgdUuZZzaxVps+lWni0InyoRJ T6WeEAfpxzWGotGlUcCnwypiD2X78EQforc0yWwfrx/p0RnnfySAyVJpretNPliuTezSZWYuvXe BI03OXJilz59y+kyV0yJ3uRuXlAot5wXFCIwECCfYhES4aeaPPLApTiqyTd8+krJB6VnSKFU9nj ksMSePs4W+MEou+tuM7pLdzxKJtMUYuMp3BHxWgdolBhD04omCNxsavS6dtyvK9Wt1Y3gT2QNsF fE+q33UlKEUW4FZZqBCeljooZRTP/HmQKM6k5jY+xewpZVbyfBahZGqI9fTy0XvGe4cOJ1a9n+7 9W3KWZY6vKCT+/4py4nwjiqenbrClfT4hNjZEgmdi8ZN1GIpKzKDhyJTbvhIYP6Qk3Pdkd81u+7 yrrpl0GCBj+jbDRiHBBsnJ8uGWrdeboPQ8PbddVW8AJnLQlI8IDxWEoHQTIPoZKDmsB6HbNjZdp 05N3qogZxFjaCkmhqGQEvUVs0xYC7WBimwYFXk4ijbOaPJX0JmRFfViDsMSGF81ccWtKcPc33Tf OiaQQISxP74DhgJVG0O6J8XOv0MwbO9EhKcvaOSFhPLqHqY5ZLaz7vlrK+wp61JhUnWxDPFCDh+ K1b58omz8KSvW/IPXx7qvHCNo5OMRjNHZQ5nEy79jY3I8OGMRrwGHbABktv7LPnFVXmLPLJooPE NiPgZIGxuN6QJqGOpmLQLuhFt8JqHpwcabhtDXHE2MJ0xCUiRNgmDWT3TOTCQlsJs3+FbO47vfL R7TKX9Yo/bDVp3UvGhYk6vZd7LChqe1Zd4gklNMexM6KNJGQjK9FMiNKb5qWzAY= X-Received: by 2002:a05:6402:5111:b0:6bc:4863:570f with SMTP id 4fb4d7f45d1cf-6bcc1641c61mr2652838a12.11.1796424319089; Fri, 04 Dec 2026 14:45:19 -0800 (PST) Received: from Desktop.tail070c67.ts.net (pd9513dea.dip0.t-ipconnect.de. [217.81.61.234]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6bcbbfa4343sm1366837a12.6.2026.12.04.14.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 14:45:17 -0800 (PST) From: Julius Bairaktaris To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, andrew+netdev@lunn.ch, dsahern@kernel.org, idosch@nvidia.com, ncardwell@google.com, kuniyu@google.com, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, ecree.xilinx@gmail.com, andy.moreton@amd.com, alex.austin@amd.com, linux-net-drivers@amd.com, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org, alexei.starovoitov@gmail.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, john.fastabend@gmail.com, sdf@fomichev.me, izaiahsun@gmail.com, zirajs7@gmail.com, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, shuah@kernel.org, bpf@vger.kernel.org, ipsec@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 0/2] net: keep the TCP fixed-ID flags on the header they describe Date: Fri, 4 Dec 2026 23:45:16 +0100 Message-ID: X-Mailer: git-send-email 2.53.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit GRO sets SKB_GSO_TCP_FIXEDID for a TCP packet whose IPv4 IDs do not change. Since commit 3271f19bf7b9 ("net: gso: restore ids of outer ip headers correctly") the flag describes the outermost header and SKB_GSO_TCP_FIXEDID_INNER the inner one, so every path that adds or removes a header would have to move the flags. None does, and a TCP stream that GRO merged and that crosses a tunnel boundary is segmented with the fixed-ID state of the wrong header. Patch 1 lets SKB_GSO_TCP_FIXEDID describe the innermost header again and replaces the inner flag with SKB_GSO_TCP_FIXEDID_OUTER, as Alexei suggested in review of v1. iptunnel_handle_offloads() and the BPF LWT encapsulation clear the outer flag when they add a header, iptunnel_pull_offloads() and bpf_skb_net_shrink() when they remove one, and ESP transport and BEET mode with crypto offload, which keep the IPv4 header, copy the inner flag to the outer one. GRO of an IPv6 stream in an IPv4 tunnel sets the outer flag as it does for an IPv4 stream, and xfrm_output() no longer treats a decapsulated packet as an encapsulated one. Two flags cannot describe the middle header of a packet with three IPv4 headers: software segmentation uses SKB_GSO_TCP_FIXEDID for it, as it used SKB_GSO_TCP_FIXEDID_INNER before. Patch 2 adds a selftest. A host with GRO on its ingress device that forwards a TCP stream into or out of an IPIP, GRE, VXLAN or crypto-offloaded ESP tunnel sends IPv4 IDs that repeat across the segments of a tunnel's outer header, or that change on a header whose IDs the sender kept fixed. The hosted Sashiko AI review of v2 2/3 of my "ipmr: forward GSO multicast packets" series reported the issue [1], its reviews of the later versions the IPv6, xfrm_output() and selftest points, and the selftest in patch 2 reproduces each. Tested in QEMU (KVM) with the selftest, 25 cases, 400 segments each: - net-next (d5cf954cebe4), the 6in4 and ESP cases, 1 run: 6in4 with fixed outer IDs fails (390 outer IDs the sender did not write), the ESP tunnel mode cases fail (390 of 400 inner IDs renumbered, or after fraglist GRO no outer ID increments), ESP transport mode after VXLAN decapsulation fails (390), and after fraglist GRO all 400 segments are dropped as SKB_BAD_GSO. - v4, the same cases, 2 runs: both ESP cases after VXLAN decapsulation with fraglist GRO lose all 400 segments (SKB_BAD_GSO), the rest pass. - this series, the same cases, 1 run, and the whole selftest, 3 runs: every case passes. Changes in v5: - Patch 1: in xfrm_output(), clear skb->inner_protocol in the crypto offload path for a packet that is not encapsulated, so that the tunnel and transport mode outputs record its inner headers; after fraglist GRO and a decapsulation v4 dropped the ESP packet as SKB_BAD_GSO (Sashiko, Willem). - Patch 2: check the 6in4 outer IDs against the values the sender wrote (Sashiko); add ESP cases after VXLAN decapsulation with fraglist GRO and in transport mode. - Rebased onto net-next d5cf954cebe4. - The flowtable's IPIP and IP6IP6 decapsulation keeps the encapsulation state of the removed header, with and without this series (Sashiko); that is a separate netfilter fix. - v4: https://lore.kernel.org/netdev/cover.1795869698.git.julius@bairaktaris.de/ - v3: https://lore.kernel.org/netdev/cover.1795284858.git.julius@bairaktaris.de/ - v2: https://lore.kernel.org/netdev/cover.1794139176.git.julius@bairaktaris.de/ - v1: https://lore.kernel.org/netdev/cover.1792857378.git.julius@bairaktaris.de/ [1] https://lore.kernel.org/netdev/179182559332.434549.18294510093742639467@kernel.org/ I used Claude (Anthropic) to help write these patches. Julius Bairaktaris (2): net: keep the TCP fixed-ID flags on the header they describe selftests: net: check TCP IP IDs across tunnels after GRO and GSO .../networking/segmentation-offloads.rst | 8 +- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 8 +- drivers/net/ethernet/sfc/ef100_tx.c | 12 +- include/linux/netdevice.h | 2 +- include/linux/skbuff.h | 12 +- include/net/ip_tunnels.h | 1 + include/uapi/linux/bpf.h | 16 +- net/core/filter.c | 1 + net/core/lwt_bpf.c | 2 + net/ipv4/af_inet.c | 9 +- net/ipv4/ip_tunnel_core.c | 2 + net/ipv4/tcp_offload.c | 7 +- net/ipv6/tcpv6_offload.c | 5 +- net/xfrm/xfrm_output.c | 20 + tools/include/uapi/linux/bpf.h | 16 +- tools/testing/selftests/net/.gitignore | 1 + tools/testing/selftests/net/Makefile | 2 + tools/testing/selftests/net/tcp_fixedid.c | 554 ++++++++++++++++++ tools/testing/selftests/net/tcp_fixedid.sh | 494 ++++++++++++++++ 19 files changed, 1132 insertions(+), 40 deletions(-) create mode 100644 tools/testing/selftests/net/tcp_fixedid.c create mode 100755 tools/testing/selftests/net/tcp_fixedid.sh base-commit: d5cf954cebe4f175dfd834e1dc471a3aa203ec7d -- 2.53.0