🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19647

Re: [PATCH ipsec] xfrm: check inner family via skb_dst for small_ipv6 DF clearing

#19647
From: Steffen Klassert
Date: Fri, 20 Nov 2026 06:42
43 lines
11858 bytes
On Tue, Nov 10, 2026 at 09:25:12AM +0000, Sewook Seo wrote:
> Commit 6821ad877034 ("xfrm: do not set IPv4 DF flag when encapsulating
> IPv6 frames <= 1280 bytes.") intended to clear the outer IPv4 DF bit in
> xfrm4_tunnel_encap_add() when encapsulating inner IPv6 frames of at most
> IPV6_MIN_MTU (1280) bytes, by checking skb->protocol == htons(ETH_P_IPV6).
> 
> However, its caller xfrm4_prepare_output() overwrites skb->protocol with
> htons(ETH_P_IP) before invoking xfrm4_tunnel_encap_add(), since
> commit 0c620e97b349 ("xfrm: remove output indirection from xfrm_mode").
> As a result, small_ipv6 always evaluates to false, leaving IP_DF set on
> outer IPv4 tunnel packets even when encapsulating <= 1280-byte IPv6
> frames.
> 
> This issue was observed on devices in production use over IPv6-in-IPv4
> ESP-in-UDP tunnels where an intermediate IPv4 link has an MTU smaller
> than the encapsulated packet size (e.g. < 1362 bytes) and ICMPv4
> Fragmentation Needed errors are either filtered or not actionable below
> IPV6_MIN_MTU, causing encapsulated <= 1280-byte IPv6 packets to be
> dropped instead of fragmented by the outer IPv4 router.
> 
> At the time xfrm4_tunnel_encap_add() runs, skb_dst(skb) has not been
> popped yet and still represents the inner packet destination entry, as
> already used a few lines below to set top_iph->protocol via
> xfrm_af2proto(skb_dst(skb)->ops->family), while skb->len still holds the
> unencapsulated inner packet length. Check dst->ops->family == AF_INET6
> instead of skb->protocol so small_ipv6 works as intended.
> 
> Tested on User-Mode Linux (ARCH=um) with a four-namespace IPv6-over-IPv4
> XFRM ESP tunnel reproducer across a 1300-byte MTU router link with ICMPv4
> Fragmentation Needed filtered (verifying 1280-byte inner IPv6 frames fail
> before the fix and pass via outer IPv4 fragmentation with the fix, while
> larger frames still preserve outer IP_DF), and verified all tests pass in
> tools/testing/selftests/net/xfrm_state.sh.
> 
> Fixes: 6821ad877034 ("xfrm: do not set IPv4 DF flag when encapsulating IPv6 frames <= 1280 bytes.")
> Cc: stable@vger.kernel.org
> Cc: Maciej Żenczykowski <maze@google.com>
> Cc: Lorenzo Colitti <lorenzo@google.com>
> Assisted-by: LLM
> Signed-off-by: Sewook Seo <sewookseo@google.com>

Applied, thanks a lot!
Technical Details
Message-ID: <av_r8dKdyeJmw-jj@gauss4>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367712-linux-kernel-netdev=dewy.ru
References: <20261110092513.2375648-1-sewookseo@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367712-linux-kernel-netdev=dewy.ru
From: steffen.klassert@secunet.com (Steffen Klassert)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH ipsec] xfrm: check inner family via skb_dst for
 small_ipv6 DF clearing
Date: Fri, 20 Nov 2026 07:42:57 +0100
Organization: Usenet Network
Message-ID: <av_r8dKdyeJmw-jj@gauss4>
References: <20261110092513.2375648-1-sewookseo@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3085019"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kcSncVei4ISV6Y+9DwUQBfIafJI= sha256:pBscwd6iX38/AMXbhps84FlSe1spZJrhd4aD3Zcm4oo=
	sha1:5FyWJIRntJ/E/15o3QmG1/0a4oc= sha256:D6kxulECM0MdBpGllxgLQsMFf9VmjmWtImNgaAKqQnY=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id D9FB91158CF; Fri, 20 Nov 2026 09:43:21 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=secunet.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id mJM5YS5Ga5oR;
	Fri, 20 Nov 2026 09:43:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367712-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=secunet.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 8C41911548D; Fri, 20 Nov 2026 09:43:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 0D1991442EE; Fri, 20 Nov 2026 06:43:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795156984;
	b=TmsnG91W+KzvxbV6Xfsxd3alpBqe6/CZDJ44ZgQ0iG2W6lh5dLr5JRfxgSg+S0NatOi6
	 DxpOjHnsEx05v8JHxOWHo0A4bOOV2VzXrXc8tp9DOQBarMJqrCTsuak69Tpwli5Dmxrvf
	 o237bbkF0hxkTB3XDPItsyTQvascE8WNYXMJZI8hSGNu9wawrrovGdR2qq8o80kN7xCcD
	 lsvnqWm/mLEk88gBv1FOi+CmbrMFmDzasIPZn1GaRd/cmU4Pb9Fp2awnyhD4ASm4IS9Nk
	 Z2ShsixUMfRPfuX+tNo3tkRRvxQATyfYKXFaZVeoaWshePeUGVQx2Hxc9xaa5R1Y5Ug==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795156984;
	h=X-Original-To:Received:DMARC-Filter:Received:X-Virus-Scanned:
	 Received:Received:DKIM-Filter:DKIM-Signature:Received:Received:Date:
	 From:To:CC:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:
	 Content-Transfer-Encoding:In-Reply-To:X-ClientProxiedBy;
	bh=5L5MV5K9+o090G2Wf4y7FRKXeHZWJ1IGq5n28rVHbBE=;
	b=t+N67IqLAWnsGom88RRPpNJqGJy+FNCTQD8ZL5CSExdkedgRnK+BU7OscfHlaVQWuZuo
	 14v/YTW5RluhFLZAocnrYw2iNX0ZgTdO/Gf0bn1XIMZ/3x9qvZVmWpv381mtUKoXvqJsO
	 4dCODFiiQEy6uF7eXosftbRjDzygCV9W0Z9UNt+NXCg3snxpPniF5r4asj7TTT7QAoaDh
	 W/1/5w446rBorwUbc9/smhy+M+gllQk9f66eM7kmQML56MaruqgbZJ+NxuakInKPK/W2I
	 GXpw0o/Ss7BG+RNNpjd7rN5tmG3UOS7gVfsYLzSN7bIs2xY+896bGLLGFDhBjpg+exA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b="O7//PZXX";
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0184D606A339;
	Fri, 20 Nov 2026 06:43:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=O7//PZXX
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795156983;
	b=r8s3vK/n3s4pg68mo6VA2jkcrgbdslkD3rVGaUlcTx5ogp+3Fb6nJvenVNACQ8BUBKUJ
	 mO3MgCmcrZkEkd8ehQJ+y2YjXY7KUk2d+p2VMtPy27coCUpa8oboaLqjBXnBK7CYcVB3k
	 kL+rtSvQFWQngBX6zBYWVjf6BSoSE9/KV4MebBB1eKMDwJ33UmkR+YIXLnQPPM6AaF3U2
	 TsU7cDlC7VKee9WlOvtEJv5b96mATxXn6H+y442M9ky4is8z0rTWKcZTp6xQNAhEZkGkb
	 YlvVlJdvRZ80OEUn+rib8e2mcnVjAYcn1kgAz04/1ogk1uw89VPOkYrFGfDhL91zBSw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795156983;
	h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter:
	 DKIM-Signature:Received:Received:Date:From:To:CC:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:
	 Content-Transfer-Encoding:In-Reply-To:X-ClientProxiedBy;
	bh=5L5MV5K9+o090G2Wf4y7FRKXeHZWJ1IGq5n28rVHbBE=;
	b=W/E1GV9taOQWyZ32OFSxXOI6GX9GRwcT9UAgJTSdNSiGpH/Jq6N4Ndj0YyDJJse5PSQs
	 8bwrtGx7hWr9cCjrWol/iAW0bvypQSUvo1tntu8A8dHm9d9WygutfhpVshA6YrQrsA1DI
	 XMYGEjOzC27kH0PeI7dgLfZwrNL3i35MD9rWIPfxuGeYSSj4LYhZwRqvrQODmcQ9QJ2pX
	 JZD2eVPMlcFzbOSAbZr8Q5YHCd7agM3lfbL8vOMnWAqdFeF5WIi4BklbIFNVO4rpLvw40
	 dgtogQBs7ah7Ru70vydQa0bTQFz+idXbialU1GJQ16JJMPihOJVMQyWfNd+Th9/wrTQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=secunet.com;
	spf=pass smtp.mailfrom=secunet.com;
	dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b="O7//PZXX";
	arc=none smtp.remote-ip=62.96.220.36
X-Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC99C606A326;
	Fri, 20 Nov 2026 06:43:01 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EC99C606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com
X-Received: from localhost (localhost [127.0.0.1])
	by mx1.secunet.com (Postfix) with ESMTP id D56DD20743;
	Fri, 20 Nov 2026 07:42:59 +0100 (CET)
X-Virus-Scanned: by secunet
X-Received: from mx1.secunet.com ([127.0.0.1])
 by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id AWpiZiIyASIi; Fri, 20 Nov 2026 07:42:59 +0100 (CET)
X-Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mx1.secunet.com (Postfix) with ESMTPS id 420FB2069C;
	Fri, 20 Nov 2026 07:42:59 +0100 (CET)
X-DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com 420FB2069C
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com;
	s=202301; t=1795156979;
	bh=5L5MV5K9+o090G2Wf4y7FRKXeHZWJ1IGq5n28rVHbBE=;
	h=Date:From:To:CC:Subject:References:In-Reply-To:From;
	b=O7//PZXXS2BxZ7HIF8RijE/yH9oyOT/zJP9KyUHuQSs9T+t63SzLo41QFuSYeXKN8
	 6xRMYZMRzcurBvpi0/V1AO99nLifwZPC/GXSZYZM4sQSiZ8qtbjboWv8lXv+M5e0d6
	 CNkr3dg6AaqEvKesHkRZM2mvCg7vWkGVqKz0g7MWUsnlxS/pSwY5kQDoTJyKrDq++m
	 Cxpje+0jJp1qFyrmd/30j1LGLz7SYKv/uVWKYI1aU41HKxhGvFaNBfDTUfPz8da1vn
	 SLo6le0jhBEEPhNf+y8MSM/4oc8mxz/6WYgnc0Nc86IoV1+/+imDEbc55sYxxmHKa5
	 EhK2PVKo+VxCg==
X-Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Fri, 20 Nov
 2026 07:42:57 +0100
X-Received: (nullmailer pid 1661259 invoked by uid 1000);
	Fri, 20 Nov 2026 06:42:57 -0000
X-CC: Herbert Xu <herbert@gondor.apana.org.au>, "David S . Miller"
	<davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski
	<kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman
	<horms@kernel.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<kernel-team@android.com>, <stable@vger.kernel.org>, Maciej
 Żenczykowski <maze@google.com>, Lorenzo Colitti
	<lorenzo@google.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261110092513.2375648-1-sewookseo@google.com>
X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de
 (10.32.0.171)