From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424321; b=nBb1erUVioDlWBd0/kFDe+IyrF+GXozF+4nGjEyfu4V6knhQtejvMINclCW3dNyxuPi5 UmSsGdmLKxEZphlglpNcCRcgktwB9+OYvhWNzdYQE+JOO0HF8CYuvlEpgfiHt2TtwvUWi YepKqp6fKaTnp9WK4BIYPlkeKabfIFPVB8qu+hFdezFggEhD+LWkjQegQdCZ7nD/p4aIo jWhHpPzkZIkABxjDxGQBWDhVuYhm3g8ZFIBxshXvvw+0AT3mI/PZZ5Hyt3EER3eMHJPSS Exmy/0TjAuOkm5/8HSGM+SV2v+d4YpyMR5qI1H3261a9y+AdhH/ZVRIahjLhHKYy/Qw== 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=kXMRUMhPsxHQ+rzor4bLR1sbNMQQtX8g1OsK/VxZF7AcGGpwMFQsWVQd8yO+x/x2H627 35Fn/gQAX1TUuY2qCKc5FLlxunKLjujwHklW6ejKJbJzAcADN0t/23/qIuSPuFZKlhId/ D5flTYpOVYZq2jv5N9YnyTB/0AXDCP9Y6j7qG/A5ORYp07k+amr+w+vbNXVrnJ5s5NwjD ZtEKjYBOf/kK0uk98zly9ET2yFvH6kOyjL85r3KHO8GffoYjj9XQqL+9s8hyo6my/DmfR PGeht/nQucMM2RH09RBv6HLM2a1lbqNb8SOfOlx6gN1hdRlTdaPhJW61V1erfsgxAtw== 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.44 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 C5C99606A337 for ; Fri, 4 Dec 2026 22:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C5C99606A337 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-f44.google.com with SMTP id 4fb4d7f45d1cf-6b4bd3d98bfso1781227a12.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=XF8GTMOivPkYERycJr7s7yrXW3Ycl1eYLHplhOpr+FjoPod5hffawYRGgqLxCQTunR BHZyFHra4vYJu8uxCGNFTlOfKfSeLU+Mnsk0/Vg29/c2XoGPmJYrPdt1E4Wj5gtXAwXo QbTNt2lRf+R4qNzY+NIWWBJ4lQUZEIdSPFZeRwxFv0awlLIYj65JzcnthxUCBmAOrS/h ccNsI1/rW8770AStRDJcSPa01ui+ELcLfV9e5otXRw6v/AaLTaQGNTHoZywUuD3bMtL6 Al4h87iHfUJbH1+9A/tmy1kdOGikbFG2jEccpzCB62dcxzRiEvae4NQlaK08KHfS/4fL qOaA== X-Forwarded-Encrypted: i=1; AL+hErH8mdtBMfPlpXhS3j57xdqLcR59ubETP/m06WZ1bowJow5ujRDwMryeGcoGbQDqBUVNKfJrtmAFz/AVag0=@vger.kernel.org X-Gm-Message-State: AB4q+uGObpmq5UsshnM0zZO/2OPQPGMR5GRerp3YOJ/mc0azKF31dwAm dYwe5+wEOLX/WRvOG1U0RKdOLGmOKELaw7kpU4xe6J7fMai0DGSvkuI77OhkoMlK/w== X-Gm-Gg: AZFdTZfBU7D4ntfYvOeWP/+uExndSNHIBvDMXlI69YZjyHZEyoCBbWSm4zRdDBrSKjY TLaAdG0KzUo8ApmcldTnP6aZKPsIbIzPr8+BlEcSB0qBg08VdtE/GhKNZ28yknTbDCZmrRXw3iG v9BJgSF106zVIDbfFonxa9APIaM5DCcYHw7J0JO6G0+fQRky2nIK/ihbnx1ZpStqouqWxX2i9a/ Yh0FHPK56svLapn1Sqc1UNcuFMT5w1VBjb2Qz4deIzRItBBTaDIHHg55DXqV2qlrolUw8dVsLAc NC8eJ6ThPIcLpKLVmPobzCHan3hv04PznVxUxjIW32mTEKOjakv6IsT0uD4FlaRGWRJgr5gFi48 cCX5/6Ketlau80W/BC2TiJR+W7990bM6QETejxuwKlH4O6zBbfFCMfOmY/pwjQZqkN+gr+OyxFw 0aZTzJ8weElhqR0Z1LAAGtZl1qPR99qtbQcuYQCKtr1rylzLf9uwSByKHrww7xNN9fxvN0rVekq EKrv0iPNP3QIBpwe4t5lnOlMLYFYRQd9fuZ7xe4g0+flXurwoVwgX4TynvJ1p6wlWTDNCOh4Sn5 yODoguQR3UriPl+do+rA2IFggpSGGJaeS1egm3AQ4IYqhpZ2DtZmlbgSXZPGnKQxQ6v+iUlfui5 zQpIIsMW1aCT33iWZ/gwsJKqw/+Cr8JFUKUOc2ONJ8ZskRYFc7DsRKqvb33hsapUpCe3tzU14dg f+kG+BLV9VYo2ghsbWwaqYd6xUYvlmisQ/WcdLSJAr3M8gZSD2bDnuhpmieZ/f60ztZgyfjIg4j riTkZ59MPhTyRglLVbCgodBijoTbAVJw/c+bJ/WUPJU1sq+mNQP1+iIATJ3hFML0hC6EqOxjmXU MQdm5xtKAMz7vmKbL0s7NYTtTTdJl+ANJlqCqzbizBB6Sn8Ha/K6PHGzDGYX9RI= 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-kernel@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