Patchwork [iproute2] ip xfrm policy: allow different tmpl family

login
register
mail settings
Submitter Alex Badea
Date Jan. 11, 2010, 3:24 p.m.
Message ID <1263223444-14092-1-git-send-email-abadea@ixiacom.com>
Download mbox | patch
Permalink /patch/42628/
State Accepted
Delegated to: stephen hemminger
Headers show

Comments

Alex Badea - Jan. 11, 2010, 3:24 p.m.
Allow tmpl IP addresses to have a different family than
selector addresses.  This is useful in conjunction with
XFRM_STATE_AF_UNSPEC.

Signed-off-by: Alex Badea <abadea@ixiacom.com>
---

Rather than resetting preferred_family unconditionally, we could
have a new optional keyword for TMPL, e.g. "ip xfrm policy add ...
tmpl unspec mode tunnel ...".  Let me know if that would be preferred.

 ip/xfrm_policy.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
stephen hemminger - Jan. 21, 2010, 6:11 p.m.
On Mon, 11 Jan 2010 17:24:04 +0200
Alex Badea <abadea@ixiacom.com> wrote:

> Allow tmpl IP addresses to have a different family than
> selector addresses.  This is useful in conjunction with
> XFRM_STATE_AF_UNSPEC.
> 
> Signed-off-by: Alex Badea <abadea@ixiacom.com>
> ---
> 
> Rather than resetting preferred_family unconditionally, we could
> have a new optional keyword for TMPL, e.g. "ip xfrm policy add ...
> tmpl unspec mode tunnel ...".  Let me know if that would be preferred.
> 
>  ip/xfrm_policy.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
> index 11116e5..2788477 100644
> --- a/ip/xfrm_policy.c
> +++ b/ip/xfrm_policy.c
> @@ -201,10 +201,10 @@ static int xfrm_tmpl_parse(struct xfrm_user_tmpl *tmpl,
>  				break;
>  			}
>  			idp = *argv;
> +			preferred_family = AF_UNSPEC;
>  			xfrm_id_parse(&tmpl->saddr, &tmpl->id, &tmpl->family,
>  				      0, &argc, &argv);
> -			if (preferred_family == AF_UNSPEC)
> -				preferred_family = tmpl->family;
> +			preferred_family = tmpl->family;
>  		}
>  
>  		if (!NEXT_ARG_OK())

applied

Patch

diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index 11116e5..2788477 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -201,10 +201,10 @@  static int xfrm_tmpl_parse(struct xfrm_user_tmpl *tmpl,
 				break;
 			}
 			idp = *argv;
+			preferred_family = AF_UNSPEC;
 			xfrm_id_parse(&tmpl->saddr, &tmpl->id, &tmpl->family,
 				      0, &argc, &argv);
-			if (preferred_family == AF_UNSPEC)
-				preferred_family = tmpl->family;
+			preferred_family = tmpl->family;
 		}
 
 		if (!NEXT_ARG_OK())