From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424321; b=XPQ4iCWn6YS8SxDGEDxa2vVLav2y898xnWJL395PyOCREl8dRZPhvIe8e9e/nLZZvQRV 5ARRVDTGYaqVp0yejopYmEl8sU+Vy4AtPNFAKWWF2eyeVjRjqZ85f4sOrI/wcwtW8DWt1 HSSdf2uC98tnzJKDhMVwVjyj3oAYKIGKJTubdDee7b8581E4JdFNOaBgCDH7eLnr2uG1t aw5mBZ5Dh27nGfwfdljQiKgVAjz1VaLcBietks0Ny0Hnbw4sMJxP88nxBwwQ+vj1opvU0 QpNRfY1b2WFN5bEtzlNCmsDc8klo33R6OVIpShCSfni+xu20Y9sHFg0arb3O8RSNXPQ== 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=xyfJM+FlcgrP4F+V0JHwPc8fuJLGdVuMwMKtij+NoOai9K6NgZSiUDjhvE4fqxnz47Sv Gpi91siRuiXYD4B9TKASm2syLymlds+cs9H6bFNbjruLuXd3cT0C6sQFZwRLfHcgRbGMz nw0zrM7p1u3pEccMuzqijq5GKEhE7ipDiG+aG8Sb2hdIHcwLx2JX8EGpSLxP6rGLfUl6Y HbKZQKhU48XOQ41U+Q4su3Zyv3wLp+n4ahQP4eV1gDW0aTGvLvYD52HZ9pk0AiM76n6W+ a3Rx/EB8oWr9caRIAc6mUmc2YSacDXsh0MzKs/NuUM3KcSFKigtOHrUmhVPxjn+5feQ== 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.52 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 BF02F606A336 for ; Fri, 4 Dec 2026 22:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BF02F606A336 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-f52.google.com with SMTP id 4fb4d7f45d1cf-6bcbb79c939so2093352a12.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=XG9GjtlmTI1mFHWNrNy25Dd3pPihsoYUW28BgC7dsvMDNJbo69FZL+azB1U572KLo3 4Fe7kkppeLA5V5mA3sMfCb6tOr9hhrhsLKd4QYDr6KGUe/XedQJSSmSm5Sy16/LsrIAw E4IC2+DBM+E1+UOpRqldxtLDO+ZnqPBaqi7XTpjiayff2qkrwwJJQQNRYD2Ts1+OX1h/ zFb+1RcYLaxJ91HmAidS1jtWWXbjDTjI+RStDUj6TVMoh/I2kXo6WxU8l8lWD33VjPWk EfREFaXh+j+M4g8aQ33CZghw5abG/BBoPUd5+r9M3J2ixXd5G+dx9QWYSpEEJbYRjoIq cyXQ== X-Forwarded-Encrypted: i=1; AL+hErGXX76kzRYJfiwAFJQ2j4s7QDWO77NET0N9APRovTLHmBdXDO+UbPNSz8TMmWlXJJVBeR+kmWlLVcMOY/GQrNo=@vger.kernel.org X-Gm-Message-State: AB4q+uGW7qImVlUSqRrT1JvO8iYumAsEbb9Q4jrCziHiXUFnNzy4kVN5 9KZLnQ7w2j90dQqbuXjzEpCaMYqeTtFF+8oQHmcsyqYcP0pRbWxLOdk16k5WMo6kMQ== X-Gm-Gg: AZFdTZeKeTkDS+caOPOLUxoKTNVlIFT6JTb+7gjFRZeRy/Zdt7Hy9HrLL+2N2MKzYbe VhQ6RS4MjzinLZkBDUZhl0QQi2O4fpIbH/WrXo4oQRD94Yj+oZaVDsixUcMY+hVL3huqz111RpQ vq0Vw8+YBmM2Q8HTLdE87ux3Vg8Z3Lc5MgjaDapoVpMua/NCKOQo8X6faGpOGc4lH4QvIJLK3lF HlFEyR0gwPCyRr2HaOnFf0eJwckbko2GF49qWD20ACvrS/C/D3F0XZQ+HT2G4YG4rdS153+MXIj rHzseoZlTVrKyHrTfEP2j+Uul6GJVCFAojvBABwOSXJdRbFbWuYH9Gw99yBJ1R+GRp1CIXOw/HS rfknlBpWzwHbSRU1wJnmf9T9ClHiqKIs/SOEtcRy0wLqkt/0ke/LfPdw8oAxqsSA7LrF5f4S883 v/ujfu8GF8N9/+WFbkoSN6g602XiSGMMeI/KxgucI1jLLbwsDManwPdum2oXh15Fw3rOc6aYra5 JwVpDOGN58clVQCI7u+f1ILyTm1fsbbk/docsgcaV8agxjjYGi/7sL+TTxOyiqYxp5juAYaujuu et+Zt/QqRlL+3p7oUSx9Vy8GyjaMtkJXLN4iB72kRBLbHeEI2Umg84//WckfHkz4gKiM4Xurgqp AXGwQD5BkJtPvSQNQPEi7jZErxffNU/DDP+6/XJ0/4mc7/nQw7loRxUmxZAwxrNC+MUVi7sIu/x rheJUzwq/Mv83h9L+jBlsT9lbJFXrhUrq3DwgClhRQO2fg/XEUjN9w9azXCfSA8w0X7G7kMIKkV j/SoZmhsddpP7/E75FShif1EnuURahmO+YzUpIOCGtwdGQQrB4zEWLOCPuEAd3itFMtoPO76ZOW z8p5G6qrgKIlxloJ+/ZH7eUcgWNlYXkw53jLJoTUcJagtBvaajx2LryPwew1US8= 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-kselftest@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