Article View: linux.kernel.netdev
Article #25794Re: [PATCH 07/22] xfrm: check inner family via skb_dst for small_ipv6 DF clearing
From: netdev-bot+sashiko
Date: Wed, 02 Dec 2026 13:12
Date: Wed, 02 Dec 2026 13:12
123 lines
12177 bytes
12177 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] This patch fixes the family test, but small_ipv6 in
xfrm4_tunnel_encap_add() (net/xfrm/xfrm_output.c:283-284) is still…
--
xfrm: check inner family via skb_dst for small_ipv6 DF clearing
This commit changes the small_ipv6 test in xfrm4_tunnel_encap_add(). It
now checks dst->ops->family == AF_INET6 instead of skb->protocol, because
xfrm4_prepare_output() has already set skb->protocol to ETH_P_IP. The aim
is to clear the outer IPv4 DF bit when the inner IPv6 frame is 1280 bytes
or less.
> diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
> index f1f612cd7b438..60ffe9549c094 100644
> --- a/net/xfrm/xfrm_output.c
> +++ b/net/xfrm/xfrm_output.c
> @@ -275,11 +275,14 @@ static int xfrm4_beet_encap_add(struct xfrm_state *x, struct sk_buff *skb)
> */
> static int xfrm4_tunnel_encap_add(struct xfrm_state *x, struct sk_buff *skb)
> {
> - bool small_ipv6 = (skb->protocol == htons(ETH_P_IPV6)) && (skb->len <= IPV6_MIN_MTU);
> struct dst_entry *dst = skb_dst(skb);
> struct iphdr *top_iph;
> + bool small_ipv6;
> int flags;
>
> + small_ipv6 = (dst->ops->family == AF_INET6) &&
> + (skb->len <= IPV6_MIN_MTU);
> +
[Severity: High]
Does this test still give the wrong answer for GSO skbs that take the ESP
offload path?
The commit message says that "skb->len still holds the unencapsulated
inner packet length". On this path, though, skb->len appears to be the
length of the whole unsegmented GSO skb.
In xfrm_output(), when xfrm_dev_offload_ok() returns true and the skb is
GSO with no inner_protocol (for example, locally generated TCP over IPv6),
the skb is not segmented first:
net/xfrm/xfrm_output.c:xfrm_output() {
...
if (skb_is_gso(skb)) {
if (skb->inner_protocol && x->props.mode == XFRM_MODE_TUNNEL)
return xfrm_output_gso(net, sk, skb);
skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
goto out;
}
...
}
It then reaches xfrm4_tunnel_encap_add() through this chain:
xfrm_output2()->xfrm_output_resume()->xfrm_output_one()->
xfrm4_prepare_output()->xfrm4_tunnel_encap_add()
At that point skb->len can be close to 64KB.
Earlier on the same skb, xfrm6_tunnel_check_size() checks each segment
rather than the total length:
net/xfrm/xfrm_output.c:xfrm6_tunnel_check_size() {
...
if ((!skb_is_gso(skb) && skb->len > mtu) ||
(skb_is_gso(skb) &&
!skb_gso_validate_network_len(skb, ip6_skb_dst_mtu(skb)))) {
...
}
So every segment can be an IPv6 frame of 1280 bytes or less while
small_ipv6 is still false. In that case frag_off is taken from
XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF), and xfrm6_extract_header()
always sets that field to htons(IP_DF). When esp4_gso_segment() or
hardware crypto offload segments the skb later, each segment gets a copy
of the outer IPv4 header with DF set.
This path does not seem to need offload hardware. xfrm_set_type_offload(x,
false) sets x->type_offload whenever esp4_offload is registered. For a
plain ESP software SA (x->xso.dev == NULL, x->encap == NULL),
xfrm_dev_offload_ok() then reaches:
net/xfrm/xfrm_device.c:xfrm_dev_offload_ok() {
...
ok:
if (!dev)
return true;
...
}
The ESP-in-UDP case reported in the commit message looks fully fixed.
With x->encap set, xfrm_dev_offload_ok() returns false, and the GSO skb
is segmented in xfrm_output_gso() before encapsulation.
Would it make sense to mirror xfrm6_tunnel_check_size() here, along these
lines?
small_ipv6 = dst->ops->family == AF_INET6 &&
(skb_is_gso(skb) ?
skb_gso_validate_network_len(skb, IPV6_MIN_MTU) :
skb->len <= IPV6_MIN_MTU);
> if (!skb->inner_protocol) {
> skb_set_inner_network_header(skb, skb_network_offset(skb));
> skb_set_inner_transport_header(skb, skb_transport_offset(skb));
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201124252.1163254-2-steffen.klassert%40secunet.com
Technical Details
Message-ID:
<179621714695.3146.588817331654404931@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375795-linux-kernel-netdev=dewy.ruReferences:
<20261201124252.1163254-8-steffen.klassert@secunet.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375795-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH 07/22] xfrm: check inner family via skb_dst for small_ipv6 DF clearing Date: Wed, 02 Dec 2026 13:12:26 +0000 Organization: Usenet Network Message-ID: <179621714695.3146.588817331654404931@kernel.org> References: <20261201124252.1163254-8-steffen.klassert@secunet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1976642"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:vugIBf9F9fe8w604grqKLOXXKpQ= sha256:kpjTu/czLxTiYfG/MxUAokqRXY6CcZcvmnd6I5PHV/s= sha1:aXmRrWuNRr2mnrnWPa8sR7vSeW0= sha256:QAm3N3R7OjXtYeSiyTuJR/KF29bOOwu/5ZZRCCdv9Bo= 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 63EF8117647; Wed, 2 Dec 2026 16:12:45 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 A8i42FB9Cke7; Wed, 2 Dec 2026 16:12:41 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375795-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 8914F11763E; Wed, 2 Dec 2026 16:12:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 1AFC025B91; Wed, 2 Dec 2026 13:12:29 +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=1796217148; b=zrXQpwbybqinYhWgVHpIr75YbourHWKR+KnVFVyHYiXtuEBsCUMqYy0UQaeUAZmJd1An w8pIqSn6Lnrk0JOQqBh22T44pxsu9rdwl5fNyF2TCMOsz9hV5ZQsyVdngROXKv4XgAi2E XTKAZVX8q/m67eBYXtt0bvk/c4MjPKIx2hwQSSVPtkrNEjJbfA9w1kC0oImhcjEJh/DDl YOWHjxgzECaMeE5+aZDb1DV/kr6I7sxNllQlMfdjTKihaWBq2QBhzV7FvqfTCElCxTgAL XX6mgTORCmkUdfCH2vMpUiTYJZQ1TlYYO3113YW/EqD6+Bh7lqK7E47+Jz1RK6uefxQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796217148; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Wla8fvmC+y1SC5HxYQq236Vx+bPDmyqhEop9tvYWTLU=; b=J1BFIkhQpz2xE2kKjaiYE6/7s8taLGFZQWRCT1MY4Z9WBOKCYrJIKyqxmIjgaTZGgJ2X GeN1Ls5xItTGh5LMoxoyIGAp90ylHayiPKnBNOFDaRZM/uUlICX9fJ0mg2MC7vl/aE6YL ZJ90BTOWKncwYOkUtksJRHeYfgH38aVXPmJ07QJ6xgnllQTRrcI2GhDd9bDCRFks64O1h RJ+x3LTfCMTZzaiIqxC43ankMdPAbSyEuroCDhxAUmokhmBgxkFHYjX71tIiW3g0XVjb6 kCKvb3GYZ59IMGs5K+Tb+6Nyztc5CctgtApZfqGBp/tKzIU54qczWJO56i9cXfBrEmQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BYlOTBCK; 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 B2FAF606A32A; Wed, 2 Dec 2026 13:12:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BYlOTBCK X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796217147; b=Z7LELup/VhrQaUOwvrF+oyVH+FYKN7AcVEFjDmIke4hpyLzKGcXgrmkcLrTDzXi9NZDA JJX4+gCNPQdHIfR1AOKWHUy+immRUCqNOXutFVwJ/YL8A3hxGR5di60dk2H6rXZ0Ocjmp tr5OM1nqLOsmJWYKmFhQKaTJ2pZ94WyqPXvWHdirxP670kaOOqS42GGd9pHf3GJ9toDdh dxSS9etCpcrZvcROmDE8HtOtNYVX+6ibV8PF1ZbWFYZVubpAoJfIp9MGPn26epcxg6PSN tD2jFkUEa8nWJ9vi1ULi5v6MCOGI7HpSuraeCUFEebpqNnqHyHn5RN9bqo40krbeo3A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796217147; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Wla8fvmC+y1SC5HxYQq236Vx+bPDmyqhEop9tvYWTLU=; b=kiVcPjhSjsyooc06pM4hEcURMZ0+90x/jeeZBq/X/wVLP9bECbsjdm4HlmM5iiCcp239 oX1KDiV9F/nqklJ6TAjPlmmkN1BeXhqf0nIXI+KQxhevE5o/TpZWWCQmY48q9yoMJnuOl N9FheXpX8RNt1zCGHbGAu8PetzakMSV2TExNHYjnzalOwjEQITWLVp4ROT0ewA6MFcwBV 9EkKdR94YblfJlJIkVa9dNMH84uBy7thH1QUF2xDYYCPnkCybt1oeMeKQqD7KEJKUJVKu N1AYfJA5y4AUrScSlUe7ek/0vsLIo2tV5cAjykqgiSLAz0sFXSHWPtSRM5lTs/7gyAA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BYlOTBCK; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D01EC606A31A for <netdev@vger.kernel.org>; Wed, 2 Dec 2026 13:12:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 691E41F000C1; Wed, 2 Dec 2026 13:12:27 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796217147; bh=Wla8fvmC+y1SC5HxYQq236Vx+bPDmyqhEop9tvYWTLU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BYlOTBCKaFWsC2YpD5I8uDDe7NpfP9kd7tExXwPsPCMahNwwFZIi6SHfAl3x0z/bQ Ma8W2J4WK9ELkg+hJ2jarCZhrvWIkJrRq0Oxc5/42u6AzufjqnX1dsQdaaYJea3o0r P0Yid9UuMKJXdF+LCYCmwXUvSJpoj5/dinc9koMeaVPN0I5xTm+3R4LrEGFZfwfnpU rjBfaOEX7hFBEJjXv6VFZDP3hsFvStgo1JYHKDlR3OQ++k3F+3oU8UL7/+Av2CPEBm j4FFCX6ODAa9xRuwZ3E2REWhh6hg7nBLJJRd+hAlJ3VTGGO1KjcRHMKLr9gptN+Goj as+XlPifaOn+A== X-Cc: davem@davemloft.net, kuba@kernel.org, herbert@gondor.apana.org.au, netdev@vger.kernel.org X-In-Reply-To: <20261201124252.1163254-8-steffen.klassert@secunet.com> X-sashiko-severity: High 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