Netdev List
 help / color / mirror / Atom feed
* [PATCH ipsec v2 0/2] xfrm: advance the route generation when policies are removed
@ 2026-11-27 16:48 Ralf Lici
  2026-11-27 16:48 ` [PATCH ipsec v2 1/2] " Ralf Lici
  2026-11-27 16:48 ` [PATCH ipsec v2 2/2] selftests: net: add a test for xfrm policy removal Ralf Lici
  0 siblings, 2 replies; 3+ messages in thread
From: Ralf Lici @ 2026-11-27 16:48 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Willem de Bruijn, Simon Horman, Shuah Khan, Nicolas Dichtel,
	netdev, ipsec, linux-kselftest, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-27 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 16:48 [PATCH ipsec v2 0/2] xfrm: advance the route generation when policies are removed Ralf Lici
2026-11-27 16:48 ` [PATCH ipsec v2 1/2] " Ralf Lici
2026-11-27 16:48 ` [PATCH ipsec v2 2/2] selftests: net: add a test for xfrm policy removal Ralf Lici

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox