🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24993

Re: [PATCH ipsec-next v4 1/4] nfp: reject unsupported IPsec encryption algorithms

#24993
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 06:30
91 lines
11352 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 patch makes nfp_net_xfrm_add_state()
  (drivers/net/ethernet/netronome/nfp/crypto/ipsec.c) handle…

--

nfp: reject unsupported IPsec encryption algorithms

This patch makes nfp_net_xfrm_add_state() reject an SA whose
props.ealgo is SADB_EALG_NONE when an aead or ealg other than
ChaCha20-Poly1305 is attached. Before, such an SA fell through to the
NULL cipher case. The new branch returns -EOPNOTSUPP so the xfrm core
can fall back to software crypto.

> diff --git a/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c b/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
> index 960d7513aa8dd..5d861e5c46659 100644
> --- a/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
> +++ b/drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
> @@ -405,6 +405,11 @@ static int nfp_net_xfrm_add_state(struct net_device *dev,
>  			cfg->ctrl_word.cipher = NFP_IPSEC_CIPHER_CHACHA20;
>  			break;
>  		}
> +		if (x->aead || x->ealg) {
> +			NL_SET_ERR_MSG_MOD(extack,
> +					   "Unsupported encryption algorithm for offload");
> +			return -EOPNOTSUPP;
> +		}

[Severity: Low]
Should the other sites in nfp_net_xfrm_add_state() that set this same
extack message also return -EOPNOTSUPP?

Three older sites in the function use the same message but return
-EINVAL. The first is ChaCha20-Poly1305 on a device that is not
NFP3800:

    if (nn->pdev->device != PCI_DEVICE_ID_NFP3800) {
        NL_SET_ERR_MSG_MOD(extack,
                           "Unsupported encryption algorithm for offload");
        return -EINVAL;
    }

The second is 3DES on NFP3800, under case SADB_EALG_3DESCBC:

    if (nn->pdev->device == PCI_DEVICE_ID_NFP3800) {
        NL_SET_ERR_MSG_MOD(extack, "Unsupported encryption algorithm for offload");
        return -EINVAL;
    }

The third is the switch default:

    default:
        NL_SET_ERR_MSG_MOD(extack, "Unsupported encryption algorithm for offload");
        return -EINVAL;

For crypto offload, xfrm_dev_state_add() in net/xfrm/xfrm_device.c
treats these two errnos differently:

    if ((err != -EOPNOTSUPP && !is_packet_offload) || is_packet_offload) {
        NL_SET_ERR_MSG_WEAK(extack, "Device failed to offload this state");
        return err;
    }

On -EOPNOTSUPP the core clears the offload state and the SA is
installed with software crypto. Any other errno fails the whole
XFRM_MSG_NEWSA. nfp rejects every offload type except
XFRM_DEV_OFFLOAD_CRYPTO, so this split always applies.

As a result, algorithms with no SADB ID (such as the ARIA modes, once
the rest of the series lands) now fall back to software. Other
unsupported algorithms that do have a SADB ID still fail the SA add with
the same message. Examples are rfc4309(ccm(aes)), rfc3686(ctr(aes)),
cbc(camellia), cbc(serpent), cbc(twofish) and cbc(sm4).

Before this patch, all of these sites returned -EINVAL. The commit
message says "Return -EOPNOTSUPP to allow fallback to software crypto",
so should the peer sites be changed to -EOPNOTSUPP as well? The other
option is for the new site to match them.

>  		fallthrough;
>  	case SADB_EALG_NULL:
>  		cfg->ctrl_word.cimode = NFP_IPSEC_CIMODE_CBC;

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130062722.7504-1-his1415%40pribit.com
Technical Details
Message-ID: <179610662054.3146.46804203861944222@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374730-linux-kernel-netdev=dewy.ru
References: <20261130062722.7504-2-his1415@pribit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374730-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH ipsec-next v4 1/4] nfp: reject unsupported IPsec encryption algorithms
Date: Tue, 01 Dec 2026 06:30:20 +0000
Organization: Usenet Network
Message-ID: <179610662054.3146.46804203861944222@kernel.org>
References: <20261130062722.7504-2-his1415@pribit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1635286"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/BzuhhceGYBUqC3ejneoxz2DEH4= sha256:hHofQ2t514EEK+04kx1VIMU0PE4Z2BgqnZHOpSXtw+c= sha1:o9far5QJmjGi1tgEaKaSp7JOAiY= sha256:Y81GoKf1C4/Go19+yZW/YnOBgj2ewr7pdJFrBZQvs9M=
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 20AF211725D; Tue,  1 Dec 2026 09:30:40 +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 36UEtdPW1LOg; Tue,  1 Dec 2026 09:30:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374730-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 5582A117244; Tue,  1 Dec 2026 09:30:28 +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 6FE552A0CE; Tue,  1 Dec 2026 06:30:24 +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=1796106623; b=ycCHXT3Ai9bitEMU+EhRsmlvBJS5oupZ/O3Iac3WTypOBKZoca5YKhJOwLyiVklNotbo KPgQCxr0Nr6WxmiNrpm6+vKmqwnh/FDebsaZwXUOfvdNTDOahV9xS1S4aOP+Y6ErCnmn/ pHGWHI3TJ4w1gPHbaDiCBA9mPHvWZzkby+JkrFtr5xNUMg+YrWXniz32Wah/qk2NDAvLs r3Xm2SYT6WAZpqOwqSujUrFEG/8T8LzjjCLBLMG4l/zDXIpUrYr7q1wOq0CDGI6xCaAYl jlTyLlpD/1BwYB1iK5OEmASewaOINLYt3GrHbuUpwsNvlbjIMlWBz+/r94lzJrN7ZPw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796106623; 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=HO1JkQbxu5WNe2acbeX6InA+svbK/ujvJB4WP3PzBis=; b=Tq8s9BTbgpI8ldlSDlJFZ3obiF0YyU9CG1/ZsGdzTcqKHMWywOhlIdHWEYFAuGdN7JJJ K9Sqhr4i8nerrUipB7e19bDhzC3CSYtCrYmNk1y/a6bgT91bdk1viEj9exgUMI5140oDV Yq4YjfZSxGorozkIMnXvziF9eSE3KZHZtScjX2vvu+XOj43TgFLA6bwPyDIAcudkC1Is1 h167jF9kFr78Id4LQ6k91DkQwITPK9AcRtCP7IppI16iQJX7zo3s/PtBiVbtJXdptwI1b QkfYVNBviwbd9NzUsfw1sLDUl7u1BIVuX+p95mbvQfkgCvze7vdTCzz51M52TngpsfQ==
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=FIZggVmu; 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 2A0CA606A332; Tue,  1 Dec 2026 06:30:23 +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=FIZggVmu
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=1796106622; b=TfQELmWTZ1yhK4NyjNYV/+n36Rl47uS3JtltL0UzdFCDcxKsEWV/UMcqNh2UTXoO9FzR J5F5rjSI0fpF5qNOWbLVjbaamXDb1AzZTraXURh8R8sj1RaikH5EcTQwY4wna9l7BnpRM mRBKuT9Y2pOqU1UuHBeSHQrmi8p3OdL4kKCOEteSqUff10UYg0Y5RxE9KQfluAdKcW+fH 82QVdEYclMjK2NWdCUarUCC364yLXwAMoRK165rYTkZjL3xlrqpjbQ6WXlsp5eIOrghIH c/ih8+B+FOexsybuoM7iqQlwZ/SNCWk62NyBidOLGyn7r0D7rzO7CdrVpjIlbO64mDQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796106622; 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=HO1JkQbxu5WNe2acbeX6InA+svbK/ujvJB4WP3PzBis=; b=giK3hb9b3XoJvauPW0M/tX2Ic8JhPPxgzFKRjknYjw6QHWhDpXeqWfE9lSok2r/lXgeT rCaqFiS2bLqFnyIAGTqy3qzE2wmkAzfZfqhIe6+kAulAcDNOUwGEZEGyB+gd6sp11LiMK /UW8P/nsYz92/5a37i/tkft8v2ePrMdzTVgjDpsLYZP97pSAxZruObbBma6b0JCOUZISp MQ9Il7VYK+LCCMKycckD+3ngYUSTr83fiXkGkiVCNl0eWVu+CGYWF3Qev6xFO5eCu1vym w6ED20vLY5UOnXMiG+hOz/F6vPQhtCuG22NRKe2PwnUNDle5LmcGE+EkaE8wa2bO0BA==
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=FIZggVmu; 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 48FDA606A325; Tue,  1 Dec 2026 06:30:22 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BBDE1F000C1; Tue,  1 Dec 2026 06:30:20 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796106621; bh=HO1JkQbxu5WNe2acbeX6InA+svbK/ujvJB4WP3PzBis=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=FIZggVmut9VklagkKWuGKEJVyN7zCqrKGAxr08F2DqLPZDoX6sTnkDTZH24X8k/3v ZI1IXuR1VrSE/qRkiChSDNrDFo43zE5gPMKAsGZzfGmd9uqJljW/seA770P34eLDHG 8bw89w5d9jaTQ0j+dJ8m97d5lVQy/hpmb7/nkVZ/b6hgqmemqYY+4glzaNjU8im7I7 JMuIJTm9OiJ89fgMDGho+mJJGAkhwanYwLPP5Ji2Ga8GGJgiRaWGv7yQ0/dUBwQRBQ ub47HTTekF5MMsNdtsYyMKQ5l/YFu6/dgfg7iUypKpeCGJcy6OUjqkAiHaUYmOR36w XCXZPYmgAc4GQ==
X-Cc: steffen.klassert@secunet.com, herbert@gondor.apana.org.au, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, sd@queasysnail.net, andrew+netdev@lunn.ch, csh0052@gmail.com, oss-drivers@corigine.com, linux-crypto@vger.kernel.org, netdev@vger.kernel.org, ipsec@lists.linux.dev, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261130062722.7504-2-his1415@pribit.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