Skip to contentSkip to conversation

ip xfrm state: Allow different selector family

PATCH In review Thomas Egerer 1 participant 2 messages Mar 17, 2013 – Mar 20, 2013

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

PATCH 1/1 ip xfrm state: Allow different selector family

Do not enforce the selector of a state to have the same address family as the id. This makes it possible to configure inter family states.

---
 ip/xfrm_state.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
ip/xfrm_state.c +2 -0
index 8ac3437..aec49d6 100644
@@ -300,7 +300,9 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
 			xfrm_state_flag_parse(&req.xsinfo.flags, &argc, &argv);
 		} else if (strcmp(*argv, "sel") == 0) {
 			NEXT_ARG();
+			preferred_family = AF_UNSPEC;
 			xfrm_selector_parse(&req.xsinfo.sel, &argc, &argv);
+			preferred_family = req.xsinfo.sel;
 		} else if (strcmp(*argv, "limit") == 0) {
 			NEXT_ARG();
 			xfrm_lifetime_cfg_parse(&req.xsinfo.lft, &argc, &argv);
#1 lore raw

My previous commit introduced a patch to allow for states with different ip address families for selector and id. The must have somehow been a mixup of the patch I tested and the one I send, so the patch sent breaks the iproute2 build. This patch fixes this. My apologies.

---
Hi Stephen, *,

my sincere apologies for breaking the build. But I somehow build and tested one commit and sent the wrong one to the list. The assignment was wrong. This commit fixes this bug. My bad,

Thomas

 ip/xfrm_state.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

0001-ip-xfrm-state-Fix-assignment-of-preferred_family.patch

ip/xfrm_state.c +1 -1
index 6ff5b51..c0cf88c 100644
@@ -296,7 +296,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv)
 			NEXT_ARG();
 			preferred_family = AF_UNSPEC;
 			xfrm_selector_parse(&req.xsinfo.sel, &argc, &argv);
-			preferred_family = req.xsinfo.sel;
+			preferred_family = req.xsinfo.sel.family;
 		} else if (strcmp(*argv, "limit") == 0) {
 			NEXT_ARG();
 			xfrm_lifetime_cfg_parse(&req.xsinfo.lft, &argc, &argv);