Skip to contentSkip to conversation

xfrm: Allow xfrmi if_id to be updated by UPDSA

PATCH Applied Nathan Harold 2 participants 2 messages Jul 20, 2018 – Jul 23, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm: Allow xfrmi if_id to be updated by UPDSA

Allow attaching an SA to an xfrm interface id after the creation of the SA, so that tasks such as keying which must be done as the SA is created, can remain separate from the decision on how to route traffic from an SA. This permits SA creation to be decomposed in to three separate steps:
1) allocation of a SPI
2) algorithm and key negotiation
3) insertion into the data path

---
 net/xfrm/xfrm_state.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
net/xfrm/xfrm_state.c +6 -2
index 27c84e63c7ff..c4c563d9be47 100644
@@ -1562,10 +1562,14 @@ int xfrm_state_update(struct xfrm_state *x)
 		if (x1->curlft.use_time)
 			xfrm_state_check_expire(x1);
 
-		if (x->props.smark.m || x->props.smark.v) {
+		if (x->props.smark.m || x->props.smark.v || x->if_id) {
 			spin_lock_bh(&net->xfrm.xfrm_state_lock);
 
-			x1->props.smark = x->props.smark;
+			if (x->props.smark.m || x->props.smark.v)
+				x1->props.smark = x->props.smark;
+
+			if (x->if_id)
+				x1->if_id = x->if_id;
 
 			__xfrm_state_bump_genids(x1);
 			spin_unlock_bh(&net->xfrm.xfrm_state_lock);
Signature · 1 line
2.18.0.233.g985f88cf7e-goog
maintainer Applied
#1 lore raw
Quoted 11 lines · Nathan Harold

Allow attaching an SA to an xfrm interface id after the creation of the SA, so that tasks such as keying which must be done as the SA is created, can remain separate from the decision on how to route traffic from an SA. This permits SA creation to be decomposed in to three separate steps:
1) allocation of a SPI
2) algorithm and key negotiation
3) insertion into the data path

Applied to ipsec-next, thanks Nathan!