🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7664

Re: [PATCH net v2 1/2] psp: fix transport mode encap with ipv6 extension headers

#7664
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 23:22
89 lines
11176 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The updated kernel-doc comment on the exported
  psp_dev_encapsulate() says "With IPv6, they go after any extension…

--

psp: fix transport mode encap with ipv6 extension headers

This patch changes psp_dev_encapsulate() to walk the IPv6 extension
header chain. It now rewrites the nexthdr of the last header in the chain
to UDP, instead of always rewriting the fixed header. Fragment, routing,
NEXTHDR_NONE and unknown header types are rejected, and psp_dev_rcv()
does the reverse on receive using ipv6_skip_exthdr().

> diff --git a/net/psp/psp_main.c b/net/psp/psp_main.c
> index c9c1a8826b7f9..0c009d7b08c00 100644
> --- a/net/psp/psp_main.c
> +++ b/net/psp/psp_main.c

[ ... ]

> +static int psp_ipv6_nexthdr_off(const u8 *hdr, unsigned int len)
> +{

[ ... ]

> +		if (!ipv6_ext_hdr(type) || type == NEXTHDR_NONE ||
> +		    type == NEXTHDR_FRAGMENT || type == NEXTHDR_ROUTING)
> +			return -1;

[ ... ]

> @@ -243,7 +280,7 @@ static void psp_write_headers(struct net *net, struct sk_buff *skb, __be32 spi,
>  }
>  
>  /* Encapsulate a TCP packet with PSP by adding the UDP+PSP headers and filling
> - * them in.
> + * them in. With IPv6, they go after any extension headers.
>   */
>  bool psp_dev_encapsulate(struct net *net, struct sk_buff *skb, __be32 spi,
>  			 u8 ver, __be16 sport)
> @@ -251,10 +288,17 @@ bool psp_dev_encapsulate(struct net *net, struct sk_buff *skb, __be32 spi,
>  	u32 network_len = skb_network_header_len(skb);
>  	u32 ethr_len = skb_mac_header_len(skb);
>  	u32 bufflen = ethr_len + network_len;
> -
> -	if (skb->protocol != htons(ETH_P_IP) &&
> -	    skb->protocol != htons(ETH_P_IPV6))
> +	int nh_off = 0;
> +
> +	if (skb->protocol == htons(ETH_P_IPV6)) {
> +		/* UDP + PSP after the extension headers, if any */
> +		nh_off = psp_ipv6_nexthdr_off(skb_network_header(skb),
> +					      network_len);
> +		if (nh_off < 0)
> +			return false;

[Severity: Low]
This isn't a bug, but do the comments on psp_dev_encapsulate() describe
more than the code accepts?

The kernel-doc says "With IPv6, they go after any extension headers", and
the inline comment says "UDP + PSP after the extension headers, if any".
However, psp_ipv6_nexthdr_off() rejects routing, fragment, NEXTHDR_NONE
and unknown header types. For those, psp_dev_encapsulate() returns false.

Callers such as mlx5e_psp_handle_tx_skb() and nsim_do_psp() drop the skb
in that case. In the selftest, a socket with IPV6_RTHDR set ends up with
its data stuck in the send queue.

On the RX side, psp_dev_rcv() already says that fragment and routing
headers are not supported in transport mode. Could the TX helper's
comment state the same restriction, so driver authors know that some
extension header layouts make encapsulation fail?

> +	} else if (skb->protocol != htons(ETH_P_IP)) {
>  		return false;
> +	}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261022223014.556388-1-toddfreed%40meta.com
Technical Details
Message-ID: <179305694824.3134.18415422493301271111@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352115-linux-kernel-netdev=dewy.ru
References: <20261022223014.556388-2-toddfreed@meta.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352115-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 1/2] psp: fix transport mode encap with ipv6
 extension headers
Date: Mon, 26 Oct 2026 23:22:28 +0000
Organization: Usenet Network
Message-ID: <179305694824.3134.18415422493301271111@kernel.org>
References: <20261022223014.556388-2-toddfreed@meta.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1420648"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cRnBdpzpJSCIx2WhI2+MMNGJ/TY= sha256:bTcRYL257EcfED1lVEz0XiYMqorZw2oCyZp3sFNXhpM=
	sha1:t+0ykgbPrCpZLRWxIf0N2xYTIJo= sha256:74lJ7w2bD266kWJvzyk7CnhsZy3YDmGRaOC834/kP+c=
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 BE165125BD7; Tue, 27 Oct 2026 02:23:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.738
X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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 cnt8gCnloMU2;
	Tue, 27 Oct 2026 02:23:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352115-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 A9AC8125AD8; Tue, 27 Oct 2026 02:23:33 +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 6A54D2A886; Mon, 26 Oct 2026 23:22:31 +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=1793056951;
	b=lclSTbQ1OlF/uh8895gNI+EB8OA+ibbD1RA/yaWxDyyjPvKHf3jkfB7orc1FuwpaETqV
	 CttqZaEKhsBuWS5sgjB1BXL8HGe1OcxjzNT97lrNpqOJaGoQDcmkPQ8DoIEfgJX2Ixx1L
	 ONKpT0ythDz5DJrsZ0wT9qFX//KR2Jyt8VzUbp6Fh42Q3V5jfBNihbomnZrc9Iu8Gwj0t
	 MThlH6TKPnsk4ZtYQL79NOA9QHC2Th6w4+8x7genoSELi9RD9pXT/Vo6ktEIGDlOnHK0h
	 aBTHzPfe+NdY2f7Y22cXb8zshzVVXHzqj/M4M/u9XdyLJk+Ce7df1egyeRyVKkwOhjg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793056951;
	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=VQi76aZsHSnfP5+RWnTNJp9RYYg8+NeBCNLcRHQmMbo=;
	b=o7AHflcGJ1mCMmLqZB7U/s04Pe/rTraLhJYRxbp/iwG0p2+yBqaSvEipOTtRBXbUze3Q
	 KNs3cmRLc93YszeXaQF8zxKSlnwNNBjaUO6uWznf1KgEGzie28kOT4A9CbK8So//LEtXc
	 xgceNHIHXSy8+4bK1pUoA+mnSbFe7x7d2r4Q8720y6IMCU+mg9UXu9Aylfahu6E1fYbk1
	 nRSHx2o+ZnaNR4NXzKEa2VkJRK8YcVNasghzsl8KgtNQLMhcKL+0dbl1hW8WwDa8g23JE
	 eq5RPJhqculxbI9DRFbogANxjIvhbEQBFuAM3j2Pexad7Zy7q5Pzs6i61ouIkzZbgMg==
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=n1acaGHA;
	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 1383A606A326;
	Mon, 26 Oct 2026 23:22:31 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=n1acaGHA
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=1793056950;
	b=f+1YUj9/Xl/P2ZPRl8yDxc67L4vm/p+BFDW6C+h8NWOGdmRIlbpGTUsg5V0mM9oLxohV
	 4OvLRg/bzOpHZg996ILRYc00eJwYUb/nhrDekPEKwbZTif9nh7YxjWUs0qOQlACK//G4F
	 nzJ0BvTmY4CI3zsEBoTl0hDuHGmhhJUczmHoIneJ/q5Q4HFrTITYeSSFJYv9JdnHNflvv
	 HXSu/2t4pWf95inAnyYxIkB7i4ZMvw/NYJh2nW4Ngw043vv0cEFjJ2p9OU9kykhUKE/eZ
	 Nf3cifa4k023UMvcw6g77DzJ89dBIlQAagK5TH2U6aC19ZiUJPxsOdWmSaObrZQevXQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793056950;
	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=VQi76aZsHSnfP5+RWnTNJp9RYYg8+NeBCNLcRHQmMbo=;
	b=1kj29DpypyZTSUrpaJ3n1xG0JV7ogOXCS5QPwxMDyC9XMY8peMo2ibPeenZCrw51x/nU
	 L9n/REj8S+3KGdwmFPoLIahwq6Ou0GRc3Z8mIgRggBusHtKN3hf/Ysr8hNqVXnXauQIk3
	 1ljrgHQM1BcfDIa2Zbzoo6xJoOeNYXrpWah3e30ZUaB5eaUvh0LnIhNBJoRP55aoKlrx0
	 0knWysvJmrawsxuEaAYYZDVaQSiHI8OID47fvq7VQHuies177YMLUQtBEJUrME60+OjBK
	 pYfm32SmCdzs15qNMz+uRtBFqyUX44Lh0Mrk+HKhanI96W/MPQtC0+wuNghGxzF0+AQ==
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=n1acaGHA;
	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 E5C75606A322;
	Mon, 26 Oct 2026 23:22:29 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A689B1F01828;
	Mon, 26 Oct 2026 23:22:28 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793056949;
	bh=VQi76aZsHSnfP5+RWnTNJp9RYYg8+NeBCNLcRHQmMbo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=n1acaGHAVUUzPJs65rtszWmauyrOg2LYJUYCYKXtC9YshIYeAyp46aLezhDULMxTg
	 UGOLl5DYfICbGiypWgJDFA7C0aeYojsoA5zeLMpXGz0qdpymRDboLcnFPitm8DIrNb
	 i9wXYatq3EsU3xvivVZ4SOhkU6qsmLqDslS2A+aVqdfKn3gijCNx8vHsGBNpDPROJD
	 1cM/wLmb6Kk6plw6CZBtZT7YZVz9uUSfD7DHBdC6op6ux67Dxc74hV2C9RNlTSYn/+
	 O27yQ67eEZW0DdjbMH0L0MLeExdJ7+yWgUfYbGvBwO99Tkj/OlRwhNJ8KORrgq+a5d
	 7b1h8pYgKNFWA==
X-Cc: netdev@vger.kernel.org, daniel.zahka@gmail.com, kuba@kernel.org,
 willemdebruijn.kernel@gmail.com, davem@davemloft.net, edumazet@kernel.org,
 pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch, shuah@kernel.org,
 raeds@nvidia.com, rrameshbabu@nvidia.com, cratiu@nvidia.com,
 linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
 bjorn@kernel.org
X-In-Reply-To: <20261022223014.556388-2-toddfreed@meta.com>
X-sashiko-severity: Low
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