From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424321; b=jV61GozmGT28fqOAtIKG85rwgHZcAHvH0EvFIotv13O5DcJRyf5KxVgRxA2q9QXvbFsw GmQttt92x811d9zD7krhcPoIbZbWxEubD9SXxa14ErK/2h0ua9UawodgfK/FLitcaJIMx khttPsQ1PnL602W7ZrfVZtCzAAKQ1KBLIWSul4Hz8ehryw6JIUZCoT1q+lHTnWDqQTrsK 3XGyuhVDeqcVaDA44DHijQJE0ca5YukadpbHAoSwWg5L5BqaiO56ficLt4dSGDP/ndGZq df8zv/ujjaHfCqnxYULjWdE05kMc9Fi8kwoJixG3uCW0nG6tt2lP4YJk071xPn2QisQ== 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-Forwarded-Encrypted: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=amrM2iVX468RxY8seIhCymiSucQUrjg4TM/I5mVTicKH1H+kheTlXFjvyDFYsPe1sXLM /O/NT6i8OsXkeq2dUFaeeMbHBKUV6PV68r8xp31k9h/4HWB8ChHDW8aIXswcQcX6J4j13 GbLVZiyBdYeoQ0BEM72n6RDyGasccRg8FIYaKSNWSX0Hvupq+tkXP1LYwOrB7GN/h56vM WLmiX8c+UXaLx6prUdn5diHsPV8l3xFoBJtGfCzx6qkBo/VGdsaQc3jEIC9U5vNNsN18T OgP6hVn9m/qtbSumlrSh9o9i8ZXBpTFYvyEk0N8U+R/oaZJ0NzifwElcipyJXWIVgxQ== 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.43 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 B486A606A332 for ; Fri, 4 Dec 2026 22:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B486A606A332 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, unprotected) header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=ZzbfHV4y Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-6b4bd3d98bfso1781231a12.1 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=sWKje3Rd5oaqqJQUr3uvdwUN24nlrRkzYVnBAXOfN9GHAv801cufjghux8l6rnBRop haJcJykoYmwcps7xZeWG1Gvbc9/+NxVPe7HhNFjwEkcwO/hUDAZ1lIZ6o7XvOt9lPe+E Z9xDhqAJKTKEbOtfDX7gK0EilMzcpBV9m723hzX5RsXE55Vll3/bEyKR3kbc33b2pTwz Ocsq8nXpQd0QeYz9Gd0kWgeZfeF9DTo8o7KwGp7RW9s1kvFyvSTALDjUqnRdxJnGSCsg STBZKku8wjcmz9gS69pXIOn8NFdEz3X/6dKICgMWwC2Zfv5bU2la1vmRmRNPyeqYx3Ks XmyQ== X-Forwarded-Encrypted: i=1; AL+hErHI07klCPlifX+i+cz8E8gTlMpCB7B5t4cbDfMs/ecmwahQ8CMvM52Qr6f7+pwA3yPMT6wg/BSqAeM=@vger.kernel.org X-Gm-Message-State: AB4q+uFx/ajBSpCvwjIZsD9M3NOBgN5/aG9mY0/YYaH7yzw13V9/c4x0 /Gg8f6skii+0q/UxRtcNcg6Ub52VEIO8PrjGnfvQSA76mWAgVrRuQitQuA+OaErejg== X-Gm-Gg: AZFdTZeXaUrcFyyBoKjn59vSO+S1r46ffqyzeFRPvJmug5ikwcZkZAofiUh9xcD6vHu wp4ipoih3prbNSH7ASvAGuXSmsS2pahJ+CZt8GPQOixcNchRMh66aNf2VIpYsyYhbLzPSOyKkQp lGHlC8aLyJq++rVQuYtc0af0lk2JyR36tRbDvQ1OhXZFXe9PotBE++F9DT0dZH8NlZJ8TwZC6wn zvDBrqlx8kbKwyxKF9LVAPYTZFe4/3wQFaej6kzzxLKKqnS9JhXVqdSfBnVhAnQIoURd7r36yDA F3Dypea0oUtAOXcnAFZoyXGBBjwBppvBrdbiGudH5sSC6nedcFkwj5MZMCOZDKL/07GYcHXcADo CS7id3PqEVVNWzOiK8yHS8jG6hOjAbb3pdXUYboL4apVbaLWZ5DFbDDWPimLCRrfIurcpp4Rz4H DZd1TRgPNm/DNRCwA7/WixWQu2n9in1b1ZqIOsPZfkUIh+uVd9fcuYNhWnz4YiW5TQrvxksw5E4 mo+6MxmDYq54MIDpOZdfaWV6xr0gCezu0CqprAcshIbdRxV45lW6+W7u1jbAReIyJi6+Bzh8kYu ImDH72jOMI6WiJa3nrUcu7bR6LK5HKD8j4Qo60+a+yIGg+yB5W2vaKtgrzlRDyXThlWKYIT4FmD WytdrIp2Xln0qfbTefD7PJddwzbfv4kcrNe03vh1kV4UyqQx4TUkekRndC9QOu4IbPF422h9w0b 57SAE2bEx/RpLkPnANEDLSHdlGbFbH1M/l8WANWzRsORewQjmo8Y0eO3BjtYBwPpvzgZexPiOaM JH/Er9DiFkDHwYx8ltVl+CH4lqTmrD4ZKNQypumBNVm/mDWkgx3+Xbnc+f5JjQBy76FdGOjLOPv la7bsn8soIwsz4TGsSRh/3e6sd/ZCANAS38WvJ1NIMLw/RMPX69+OiLgt0mkShw= 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: linux-doc@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