]> err.no Git - linux-2.6/commitdiff
xfrm: Add a XFRM_STATE_AF_UNSPEC flag to xfrm_usersa_info
authorSteffen Klassert <steffen.klassert@secunet.com>
Thu, 10 Jul 2008 23:55:37 +0000 (16:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Jul 2008 23:55:37 +0000 (16:55 -0700)
Add a XFRM_STATE_AF_UNSPEC flag to handle the AF_UNSPEC behavior for
the selector family. Userspace applications can set this flag to leave
the selector family of the xfrm_state unspecified.  This can be used
to to handle inter family tunnels if the selector is not set from
userspace.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/xfrm.h
net/xfrm/xfrm_user.c

index 2ca6bae88721920215a649bc437393733452aae9..fb0c215a3051a0e697d305c98067f39c25a2c790 100644 (file)
@@ -339,6 +339,7 @@ struct xfrm_usersa_info {
 #define XFRM_STATE_NOPMTUDISC  4
 #define XFRM_STATE_WILDRECV    8
 #define XFRM_STATE_ICMP                16
+#define XFRM_STATE_AF_UNSPEC   32
 };
 
 struct xfrm_usersa_id {
index b976d9ed10e45a3a2e410a6b873f9128a18f6021..04c41504f84c44b8b84d8be9b6cc602d568d3ce1 100644 (file)
@@ -277,9 +277,8 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
        memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr));
        x->props.flags = p->flags;
 
-       if (!x->sel.family)
+       if (!x->sel.family && !(p->flags & XFRM_STATE_AF_UNSPEC))
                x->sel.family = p->family;
-
 }
 
 /*