From: Steffen Klassert <steffen.klassert@secunet.com>
To: Antony Antony <antony.antony@secunet.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>,
Masahide NAKAMURA <nakam@linux-ipv6.org>,
Paul Moore <paul@paul-moore.com>,
Stephen Smalley <stephen.smalley.work@gmail.com>,
Ondrej Mosnacek <omosnace@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Sabrina Dubroca <sd@queasysnail.net>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <selinux@vger.kernel.org>,
<linux-doc@vger.kernel.org>,
Chiachang Wang <chiachangwang@google.com>,
Yan Yan <evitayan@google.com>, <devel@linux-ipsec.org>
Subject: Re: [PATCH ipsec-next v9 00/16] xfrm: XFRM_MSG_MIGRATE_STATE new netlink message
Date: Tue, 9 Jun 2026 16:05:45 +0200 [thread overview]
Message-ID: <aigducMLaXYKn6sa@secunet.com> (raw)
In-Reply-To: <migrate-state-v9-0-ad9947e4ae74@secunet.com>
On Tue, May 26, 2026 at 09:05:38PM +0200, Antony Antony wrote:
> The current XFRM_MSG_MIGRATE interface is tightly coupled to policy and
> SA migration, and it lacks the information required to reliably migrate
> individual SAs. This makes it unsuitable for IKEv2 deployments,
> dual-stack setups (IPv4/IPv6), and scenarios where policies are managed
> externally (e.g., by daemons other than the IKE daemon).
>
> Mandatory SA selector list
> The current API requires a non-empty SA selector list, which does not
> reflect the IKEv2 use case.
> A single Child SA may correspond to multiple policies,
> and SA discovery already occurs via address and reqid matching. With
> dual-stack Child SAs this leads to excessive churn: the current method
> would have to be called up to six times (in/out/fwd × v4/v6) on SA,
> while the new method only requires two calls.
>
> Selectors lack SPI (and marks)
> XFRM_MSG_MIGRATE cannot uniquely identify an SA when multiple SAs share
> the same policies (per-CPU SAs, SELinux label-based SAs, etc.). Without
> the SPI, the kernel may update the wrong SA instance.
>
> Reqid cannot be changed
> Some implementations allocate reqids based on traffic selectors. In
> host-to-host or selector-changing scenarios, the reqid must change,
> which the current API cannot express.
>
> Because strongSwan and other implementations manage policies
> independently of the kernel, an interface that updates only a specific
> SA - with complete and unambiguous identification - is required.
>
> SA Selector, x->sel, can't be changed, especially Transport mode.
>
> XFRM_MSG_MIGRATE_STATE provides that interface. It supports migration
> of a single SA via xfrm_usersa_id (including SPI) and we fix
> encap removal in this patch set, reqid updates, address changes,
> and other SA-specific parameters. It avoids the structural limitations
> of XFRM_MSG_MIGRATE and provides a simpler, extensible mechanism for
> precise per-SA migration without involving policies.
> This method also allows migtrating SA selectors typically used with
> host-to-host in Transport mode.
>
> New migration steps: first install block policy, remove the old policy,
> call XFRM_MSG_MIGRATE_STATE for each state, then re-install the
> policies and remove the block policy.
>
> If the target SA tuple (daddr, SPI, proto, family) is already
> occupied, the operation returns -EEXIST. In this case the original
> SA is not preserved. Userspace must handle -EEXIST by
> re-establishing the SA at the IKE level and manage policies.
>
> ---
> v8->v9: address v8 review Sabrina and Steffen
> - split const xuo cleanup
> - input validation
>
> Link to v8: https://lore.kernel.org/all/migrate-state-v8-0-4578fb016965@secunet.com/
> v7->v8: - removed the unknown-flags validation block
>
> Link to v7: https://patch.msgid.link/migrate-state-v7-14-44eb2440b91c@secunet.com
> v6->v7: - add SA selectoor migration
> - fixes to commit messages
> - white space removal
>
> Link to v6: https://lore.kernel.org/r/migrate-state-v6-0-9df9764ddb9e@secunet.com
> v5->v6: - add mark to look up SA.
> - restrict netlink attributes in new method
> - address review feedback from Sabrina
> - add new patch to fix existing inter-family address comparison
> - add extack xfrm_state_init()
> - Feedback from Yan : omit-to-inherit add migrating marks
> - Drop missing __rcu annotation on nlsk, Sabrina has a better patch
>
> Link to v5: https://lore.kernel.org/all/cover.1769509130.git.antony.antony@secunet.com/
> v4->v5: add synchronize after migrate and delete it inside a lock
> - split xfrm_state_migrate into create and install functions
>
> Link to v4: https://lore.kernel.org/all/cover.1768811736.git.antony.antony@secunet.com/
> v3->v4: add patch to fix pre-existing missing __rcu annotation on nlsk
>
> v2->v3: - fix commit message formatting
>
> Link to v2: https://lore.kernel.org/all/cover.1768462955.git.antony.antony@secunet.com/
>
> Lint to v1: https://lore.kernel.org/all/cover.1767964254.git.antony@moon.secunet.de/
> v1->v2: dropped 6/6. That check is already there where the func is called
> - merged patch 4/6 and 5/6, to fix use uninitialized value
> - fix commit messages
>
> ---
> Antony Antony (16):
> xfrm: remove redundant assignments
> xfrm: add extack to xfrm_init_state
> xfrm: allow migration from UDP encapsulated to non-encapsulated ESP
> xfrm: fix NAT-related field inheritance in SA migration
> xfrm: rename reqid in xfrm_migrate
> xfrm: split xfrm_state_migrate into create and install functions
> xfrm: check family before comparing addresses in migrate
> xfrm: add state synchronization after migration
> xfrm: add error messages to state migration
> xfrm: move encap and xuo into struct xfrm_migrate
> xfrm: refactor XFRMA_MTIMER_THRESH validation into a helper
> xfrm: extract address family and selector validation helpers
> xfrm: make xfrm_dev_state_add xuo parameter const
> xfrm: add XFRM_MSG_MIGRATE_STATE for single SA migration
> xfrm: restrict netlink attributes for XFRM_MSG_MIGRATE_STATE
> xfrm: add documentation for XFRM_MSG_MIGRATE_STATE
Series appled, thanks a lot for your effort Antony!
prev parent reply other threads:[~2026-06-09 14:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 19:05 [PATCH ipsec-next v9 00/16] xfrm: XFRM_MSG_MIGRATE_STATE new netlink message Antony Antony
2026-05-26 19:05 ` [PATCH ipsec-next v9 01/16] xfrm: remove redundant assignments Antony Antony
2026-05-26 19:06 ` [PATCH ipsec-next v9 02/16] xfrm: add extack to xfrm_init_state Antony Antony
2026-05-26 19:06 ` [PATCH ipsec-next v9 03/16] xfrm: allow migration from UDP encapsulated to non-encapsulated ESP Antony Antony
2026-05-26 19:07 ` [PATCH ipsec-next v9 04/16] xfrm: fix NAT-related field inheritance in SA migration Antony Antony
2026-05-26 19:07 ` [PATCH ipsec-next v9 05/16] xfrm: rename reqid in xfrm_migrate Antony Antony
2026-05-26 19:07 ` [PATCH ipsec-next v9 06/16] xfrm: split xfrm_state_migrate into create and install functions Antony Antony
2026-05-26 19:07 ` [PATCH ipsec-next v9 07/16] xfrm: check family before comparing addresses in migrate Antony Antony
2026-05-26 19:08 ` [PATCH ipsec-next v9 08/16] xfrm: add state synchronization after migration Antony Antony
2026-05-26 19:08 ` [PATCH ipsec-next v9 09/16] xfrm: add error messages to state migration Antony Antony
2026-05-26 19:08 ` [PATCH ipsec-next v9 10/16] xfrm: move encap and xuo into struct xfrm_migrate Antony Antony
2026-05-26 19:08 ` [PATCH ipsec-next v9 11/16] xfrm: refactor XFRMA_MTIMER_THRESH validation into a helper Antony Antony
2026-05-26 19:09 ` [PATCH ipsec-next v9 12/16] xfrm: extract address family and selector validation helpers Antony Antony
2026-05-26 19:09 ` [PATCH ipsec-next v9 13/16] xfrm: make xfrm_dev_state_add xuo parameter const Antony Antony
2026-05-26 19:09 ` [PATCH ipsec-next v9 14/16] xfrm: add XFRM_MSG_MIGRATE_STATE for single SA migration Antony Antony
2026-05-26 19:10 ` [PATCH ipsec-next v9 15/16] xfrm: restrict netlink attributes for XFRM_MSG_MIGRATE_STATE Antony Antony
2026-05-26 19:10 ` [PATCH ipsec-next v9 16/16] xfrm: add documentation " Antony Antony
2026-06-09 14:05 ` Steffen Klassert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aigducMLaXYKn6sa@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=antony.antony@secunet.com \
--cc=chiachangwang@google.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devel@linux-ipsec.org \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=evitayan@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nakam@linux-ipv6.org \
--cc=netdev@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=pabeni@redhat.com \
--cc=paul@paul-moore.com \
--cc=sd@queasysnail.net \
--cc=selinux@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox