Skip to content

RFC xfrm: XFRM_MSG_MIGRATE_STATE new netlink message

Antony Antony netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5xfrm: migrate encap should be set in migrate callnet/xfrm/xfrm_state.c+2 -81 reply
2/5xfrm: rename reqid in xfrm_migrateinclude/net/xfrm.h net/key/af_key.c net/xfrm/xfrm_policy.c +2 more+13 -130 replies
3/5xfrm: new method XFRM_MSG_MIGRATE_STATEinclude/net/xfrm.h include/uapi/linux/xfrm.h net/xfrm/xfrm_replay.c +3 more+202 -110 replies
4/5xfrm: reqid is invarient in old migrationnet/xfrm/xfrm_state.c net/xfrm/xfrm_user.c+3 -20 replies
5/5xfrm: check that SA is in VALID state before usenet/xfrm/xfrm_state.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC ipsec-next 0/5] xfrm: XFRM_MSG_MIGRATE_STATE new netlink message

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 other daemons than IKE daemon).

Mandatory SA selector list
The current API requires a non-empty SA selector list, which does not reflect 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. While polices are migrated, first installing a block policy

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.

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.

Antony Antony (5):
xfrm: migrate encap should be set in migrate call
xfrm: rename reqid in xfrm_migrate
xfrm: new method XFRM_MSG_MIGRATE_STATE
xfrm: reqid is invarient in old migration
xfrm: check that SA is in VALID state before use

 include/net/xfrm.h          |   7 +-
 include/uapi/linux/xfrm.h   |  10 +++
 net/key/af_key.c            |  10 +--
 net/xfrm/xfrm_policy.c      |   4 +-
 net/xfrm/xfrm_replay.c      |  16 ++++
 net/xfrm/xfrm_state.c       |  37 ++++----
 net/xfrm/xfrm_user.c        | 166 +++++++++++++++++++++++++++++++++++-
 security/selinux/nlmsgtab.c |   3 +-
 8 files changed, 221 insertions(+), 32 deletions(-)

Antony

--
2.39.5