🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23658

[PATCH ipsec v2 0/2] xfrm: advance the route generation when policies are removed

#23658
From: Ralf Lici
Date: Fri, 27 Nov 2026 16:48
40 lines
10304 bytes
Hi,

Deleting, flushing or expiring an xfrm policy does not advance the IPv4
and IPv6 route generations, so a socket that cached a plain route while
an allow policy matched its flow keeps sending in plaintext after that
policy is removed, although a policy requiring IPsec now matches.

This was triggered at runtime in a VM test setup (not observed in
production): a connected UDP socket keeps sending unencrypted datagrams
after the allow policy that exempted its flow is deleted, deleted by
index or expires, and keeps sending after a flush with the output
default set to block. Patch 2 adds that reproducer as a selftest, which
fails in all these cases without patch 1, for both IPv4 and IPv6.

Thanks,

Ralf Lici
Mandelbit Srl

---
Changes since v1 https://lore.kernel.org/netdev/20261126111516.317545-1-ralf@mandelbit.com/
- Add a selftest. (Nicolas)
- Cc ipsec@lists.linux.dev.

Ralf Lici (2):
  xfrm: advance the route generation when policies are removed
  selftests: net: add a test for xfrm policy removal

 net/xfrm/xfrm_policy.c                        |  34 ++-
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/config            |   1 +
 .../selftests/net/xfrm_policy_removal.sh      | 212 ++++++++++++++++++
 4 files changed, 238 insertions(+), 10 deletions(-)
 create mode 100755 tools/testing/selftests/net/xfrm_policy_removal.sh


base-commit: 1213df0bc5993e479706c5eba5830243d778f164
-- 
2.56.0
Technical Details
Message-ID: <cover.1795797791.git.ralf@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srv.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-372858-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-372858-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: [PATCH ipsec v2 0/2] xfrm: advance the route generation when policies are removed
Date: Fri, 27 Nov 2026 17:48:19 +0100
Organization: Usenet Network
Message-ID: <cover.1795797791.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="776007"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:U2DRMLUQBXbnuzh7xV/hqaqpBnw= sha256:VMEhLjm6fLb8vyEOVcYXQs1g/xxc3sTFSfw1uOKs7WY=
	sha1:JpiG/+NS1xumPwlRU6UZQwXhRYk= sha256:O6cuR5M86pt9kQ5tLCwL37Q6GG9BCEyOm29kNxr1rWY=
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 CB8C2125F61; Fri, 27 Nov 2026 19:49:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[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=mandelbit.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 HNSZb_GDtCPX;
	Fri, 27 Nov 2026 19:49:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-372858-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 4AC6D125F62; Fri, 27 Nov 2026 19:48:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 69C8F6021AF; Fri, 27 Nov 2026 16:48:52 +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=1795798130;
	b=lv6EjyEogzmaQ20HkGEOSRMSYRYfEn9Q3PYYxUtE/sBqigOt2KLY2L6eYXI3NGj/yBXP
	 W7Tmez+bKIvxsFQIQMl7RMGVYEW2TvAdfNLbTkDh6d73KEWoQCJhTz0iA/GnAMIUGBfZW
	 XVh4P5+250wnOlcHDPN3UvRfb6h4yuovECcKTHSMQxjBybmmecXOPo5w8DWvBgR65YG9P
	 jixbjVSnv3qooHCeM1iI9V0xWrwZ3HT+JvmKsPHL5uekU6UTC1/g9j40MB4T9O8/u6gVF
	 VMYgKxVuOO9aV5xQNWEXhwikf9DnIo6aYxQ4NRoNac80ag+54ggLmNP+xz5t9Q6CPuQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795798130;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=H5PJwaF+JX9HNNgDeTEv6/PetwW34s2zOXNWJoIQFbo=;
	b=G1KQhlVU2gW2AlaIDbfThzl383Jy8IN/Z7B/BG9uYG1RbxVzJeVsCEgLBbDD5dWdq4zc
	 FCVwCtbOWX5VICfJ2gtUmZrgJDZugzvVolLfYiayATFO56SZJCAcsypBgEQvIIPQ3O1R/
	 TqkvcoSV+v0G/jg82o142iKgNjRWNAL4EeMv0M0e3/2Z2l5d6Iu3St+QfotdSXDozcMYk
	 V4V/PnLlSe6tyn5pydVreMLSaeqxGo8H0a7XE3qJRJglPgWjSHsLVPwjqIbixSsU1FYuQ
	 o/Qn9TKSFkL8N7oMADLaoxegZ0FmLQDBc657F8H6xEYrozALmje8t2tV//HlVNQPCmQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=BQxYEdgu;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.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 CCF77606A33B;
	Fri, 27 Nov 2026 16:48:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=BQxYEdgu
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.55
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795798120;
	b=JJ08pSpvaTPwZfCA2q+C08rkJAaseaU3SF6+F9Xeke1ZCOjwsthwhdsTk52lkEsxuUTf
	 0oCWRu9BSW6QwWZSbsmNliRqmoBSsU5TRldxUpX38H/6qGLDpuAm1Exw10iiaH3HYfUR+
	 63hwwjW1uYtO8xBNp4mBEJM4W+cZ0gZlUPeDg9D/b92TvYuW1CkQ1XgLjpOPppxU24Pa3
	 /4kzbc1hfDHWdyX+Mr/aDkviOLiYfDikFRegGHAIbdfC1upsCqwhHFtPWge3G5SS7v7Gd
	 jcGDrcO7mZxet8lecOCLWUdHUlznv3iRJevMzyNMm2W1KK9WqBm6PUcOT7123COGGTg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795798120;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-Rspamd-Queue-Id;
	bh=H5PJwaF+JX9HNNgDeTEv6/PetwW34s2zOXNWJoIQFbo=;
	b=OB6kT6MBsgvQqvIdHZf1dQGVowPRp3Kodk+xA8g7a3vsfrh7CIitpnr6JaecRUaNmKZG
	 q12veeWs5SQ6MQWho109JCmbxInyh1i4A+a5osPPC0v0QvWv9bpo7H2P/BmktO2LO3P0K
	 SxQEPZC2Ig34HzOOvCMpJD2FiVRnyDZkkK4aIdwIj3SCnbZ8nl/9kQT2ejfYwSVtP3tNp
	 rm0455aOYq1gg6mDL6gsugzcs3SCJdueMJnWXJTaa9slBxjHlEz6ShMwiwH8J+Eyatjjl
	 uPCzsFzZqqMAf84mt+Pyh4xkcTpuMOS9cpHuLnynq70E+X57yOLpKEB+662DKiDkpQw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=BQxYEdgu;
	arc=none smtp.remote-ip=195.10.208.55
X-Received: from mout-b-110.mailbox.org (mout-b-110.mailbox.org [195.10.208.55])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A395606A31F;
	Fri, 27 Nov 2026 16:48:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4A395606A31F
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-110.mailbox.org (Postfix) with ESMTPS id 4jbfW56xMjzNknP;
	Fri, 27 Nov 2026 17:48:33 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795798114;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding;
	bh=H5PJwaF+JX9HNNgDeTEv6/PetwW34s2zOXNWJoIQFbo=;
	b=BQxYEdgudhiizquByfte/Ved9VDZgS67PkwaiI3yMqDYmFrAfCOyzie65gur2bp54VotqU
	+qj07O9Y6W37qKrMOcuIZ2pGqwPFjL0bNESmP+KgkLd9plBaaSLr9OY382xX0EZu05swyc
	vAWIFuv4htVtACpcLhEoAsWc3gSc1D1sKzndiIYck4FM6Q015IIVJsqsO4eZxtP9qNEwBW
	4OydYJTMmtkocs0t9+KlXLNGX1CAABtfCFVzZb7Outp96ORoQMMUILxvhpAEdRJi5Ulac2
	lgT55EBwEDtqjRWuJNopV0qOUBXVuwL6GzO/5Pa8MSthsmfoBrWN8eR9ZWiakA==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=ralf@mandelbit.com
X-Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	netdev@vger.kernel.org,
	ipsec@lists.linux.dev,
	linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.0
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-Rspamd-Queue-Id: 4jbfW56xMjzNknP