Skip to contentSkip to conversation

Have af-specific init_tempsel() initialize family field of temporary selector

PATCH Applied Arnaud Ebalard 3 participants 5 messages Nov 4, 2008

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

PATCH 1/1 Have af-specific init_tempsel() initialize family field of temporary selector

Hi,

While adding MIGRATE support to strongSwan, Andreas Steffen noticed that the selectors provided in XFRM_MSG_ACQUIRE have their family field uninitialized (those in MIGRATE do have their family set).

Looking at the code, this is because the af-specific init_tempsel() (called via afinfo->init_tempsel() in xfrm_init_tempsel()) do not set the value.

Even if current apps probably do not rely on it, is there any argument for not doing it or is it just an omission?

The patch below is more for discussion than anything else.

Cheers,

a+

---
 net/ipv4/xfrm4_state.c |    1 +
 net/ipv6/xfrm6_state.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/xfrm4_state.c +1 -0
index 07735ed..55dc6be 100644
@@ -33,6 +33,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
 	x->sel.dport_mask = htons(0xffff);
 	x->sel.sport = xfrm_flowi_sport(fl);
 	x->sel.sport_mask = htons(0xffff);
+	x->sel.family = AF_INET;
 	x->sel.prefixlen_d = 32;
 	x->sel.prefixlen_s = 32;
 	x->sel.proto = fl->proto;
net/ipv6/xfrm6_state.c +1 -0
index 89884a4..60c78cf 100644
@@ -34,6 +34,7 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
 	x->sel.dport_mask = htons(0xffff);
 	x->sel.sport = xfrm_flowi_sport(fl);
 	x->sel.sport_mask = htons(0xffff);
+	x->sel.family = AF_INET6;
 	x->sel.prefixlen_d = 128;
 	x->sel.prefixlen_s = 128;
 	x->sel.proto = fl->proto;
Signature · 1 line
1.5.6.3
maintainer
#1 lore raw
Quoted 6 lines · Arnaud Ebalard

Hi,

While adding MIGRATE support to strongSwan, Andreas Steffen noticed that the selectors provided in XFRM_MSG_ACQUIRE have their family field uninitialized (those in MIGRATE do have their family set).

Quoted 8 lines

Looking at the code, this is because the af-specific init_tempsel() (called via afinfo->init_tempsel() in xfrm_init_tempsel()) do not set the value.

Even if current apps probably do not rely on it, is there any argument for not doing it or is it just an omission?

The patch below is more for discussion than anything else.

We should ask the MIP6 folks since this may affect them.

Quoted 24 lines
---
 net/ipv4/xfrm4_state.c |    1 +
 net/ipv6/xfrm6_state.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/xfrm4_state.c +1 -0
index 07735ed..55dc6be 100644
@@ -33,6 +33,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
 	x->sel.dport_mask = htons(0xffff);
 	x->sel.sport = xfrm_flowi_sport(fl);
 	x->sel.sport_mask = htons(0xffff);
+	x->sel.family = AF_INET;
 	x->sel.prefixlen_d = 32;
 	x->sel.prefixlen_s = 32;
 	x->sel.proto = fl->proto;
net/ipv6/xfrm6_state.c +0 -0
index 89884a4..60c78cf 100644

net/ipv6/xfrm6_state.c __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl, · line 40

Quoted 7 lines
net/ipv6/xfrm6_state.c +1 -0
@@ -34,6 +34,7 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
 	x->sel.dport_mask = htons(0xffff);
 	x->sel.sport = xfrm_flowi_sport(fl);
 	x->sel.sport_mask = htons(0xffff);
+	x->sel.family = AF_INET6;
 	x->sel.prefixlen_d = 128;
 	x->sel.prefixlen_s = 128;
 	x->sel.proto = fl->proto;

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw

Hi,

Quoted 11 lines · Herbert Xu
Quoted 10 lines · Arnaud Ebalard

Hi,

While adding MIGRATE support to strongSwan, Andreas Steffen noticed that the selectors provided in XFRM_MSG_ACQUIRE have their family field uninitialized (those in MIGRATE do have their family set).

Looking at the code, this is because the af-specific init_tempsel() (called via afinfo->init_tempsel() in xfrm_init_tempsel()) do not set the value.

Quoted 6 lines
Quoted 4 lines

Even if current apps probably do not rely on it, is there any argument for not doing it or is it just an omission?

The patch below is more for discussion than anything else.

We should ask the MIP6 folks since this may affect them.

Sorry Herbert, my initial comment was misleading: the family is not set in the selectors provided in the *XFRM_MSG_ACQUIRE*, which is not MIPv6 related. I could check again, but I think the patch below will impact all native key managers. Or did I miss something and there is a specific reason why MIPv6 folks may be impacted?

Quoted 33 lines
Quoted 24 lines
---
 net/ipv4/xfrm4_state.c |    1 +
 net/ipv6/xfrm6_state.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/xfrm4_state.c +1 -0
index 07735ed..55dc6be 100644
@@ -33,6 +33,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
 	x->sel.dport_mask = htons(0xffff);
 	x->sel.sport = xfrm_flowi_sport(fl);
 	x->sel.sport_mask = htons(0xffff);
+	x->sel.family = AF_INET;
 	x->sel.prefixlen_d = 32;
 	x->sel.prefixlen_s = 32;
 	x->sel.proto = fl->proto;
net/ipv6/xfrm6_state.c +0 -0
index 89884a4..60c78cf 100644

net/ipv6/xfrm6_state.c __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl, · line 40

Quoted 7 lines
net/ipv6/xfrm6_state.c +1 -0
@@ -34,6 +34,7 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
 	x->sel.dport_mask = htons(0xffff);
 	x->sel.sport = xfrm_flowi_sport(fl);
 	x->sel.sport_mask = htons(0xffff);
+	x->sel.family = AF_INET6;
 	x->sel.prefixlen_d = 128;
 	x->sel.prefixlen_s = 128;
 	x->sel.proto = fl->proto;

Cheers,

maintainer Acked-by
#3 lore raw
Quoted 6 lines · Arnaud Ebalard

Sorry Herbert, my initial comment was misleading: the family is not set in the selectors provided in the *XFRM_MSG_ACQUIRE*, which is not MIPv6 related. I could check again, but I think the patch below will impact all native key managers. Or did I miss something and there is a specific reason why MIPv6 folks may be impacted?

Indeed, you're right. I was thinking of SA creation.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer Applied
#4 lore raw

From: Herbert Xu <[email protected]>
Date: Tue, 4 Nov 2008 19:52:28 +0800

Quoted 8 lines · Arnaud Ebalard
Quoted 6 lines

Sorry Herbert, my initial comment was misleading: the family is not set in the selectors provided in the *XFRM_MSG_ACQUIRE*, which is not MIPv6 related. I could check again, but I think the patch below will impact all native key managers. Or did I miss something and there is a specific reason why MIPv6 folks may be impacted?

Quoted 6 lines

Indeed, you're right. I was thinking of SA creation.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Applied to net-2.6, thanks.