Patchwork IPv6: 6rd iproute2 support

login
register
mail settings
Submitter Alexandre Cassen
Date May 5, 2009, 10:50 a.m.
Message ID <20090505105050.GA2598@lnxos.staff.proxad.net>
Download mbox | patch
Permalink /patch/26871/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Alexandre Cassen - May 5, 2009, 10:50 a.m.
IPv6 rapid deployment (6rd) builds upon mechanisms of 6to4 (RFC3056)
to enable a service provider to rapidly deploy IPv6 unicast service
to IPv4 sites to which it provides customer premise equipment.  Like
6to4, it utilizes stateless IPv6 in IPv4 encapsulation in order to
transit IPv4-only network infrastructure.  Unlike 6to4, a 6rd service
provider uses an IPv6 prefix of its own in place of the fixed 6to4
prefix. more info at http://tools.ietf.org/html/draft-despres-6rd-03.

Signed-off-by: Alexandre Cassen <acassen@freebox.fr>
---
 include/linux/if_tunnel.h |    5 +++++
 ip/iptunnel.c             |   16 +++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
YOSHIFUJI Hideaki / 吉藤英明 - May 5, 2009, 1:16 p.m.
Hello.

In article <20090505105050.GA2598@lnxos.staff.proxad.net> (at Tue, 5 May 2009 12:50:50 +0200), Alexandre Cassen <acassen@freebox.fr> says:

> IPv6 rapid deployment (6rd) builds upon mechanisms of 6to4 (RFC3056)
> to enable a service provider to rapidly deploy IPv6 unicast service
> to IPv4 sites to which it provides customer premise equipment.  Like
> 6to4, it utilizes stateless IPv6 in IPv4 encapsulation in order to
> transit IPv4-only network infrastructure.  Unlike 6to4, a 6rd service
> provider uses an IPv6 prefix of its own in place of the fixed 6to4
> prefix. more info at http://tools.ietf.org/html/draft-despres-6rd-03.
> 
> Signed-off-by: Alexandre Cassen <acassen@freebox.fr>
> ---
>  include/linux/if_tunnel.h |    5 +++++
>  ip/iptunnel.c             |   16 +++++++++++++++-
>  2 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
> index 2918c6f..00092e0 100644
> --- a/include/linux/if_tunnel.h
> +++ b/include/linux/if_tunnel.h
> @@ -30,6 +30,11 @@ struct ip_tunnel_parm
>  	__be16			o_flags;
>  	__be32			i_key;
>  	__be32			o_key;
> +
> +	/* 6rd matching params */
> +	struct in6_addr		ip6rd_zone;
> +	__u8			ip6rd_prefix;
> +
>  	struct iphdr		iph;
>  };
>  

Sorry, you cannot change this struct this way because you break
existing applications.

--yoshfuji
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 2918c6f..00092e0 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -30,6 +30,11 @@  struct ip_tunnel_parm
 	__be16			o_flags;
 	__be32			i_key;
 	__be32			o_key;
+
+	/* 6rd matching params */
+	struct in6_addr		ip6rd_zone;
+	__u8			ip6rd_prefix;
+
 	struct iphdr		iph;
 };
 
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index 7bee162..8e08872 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -40,7 +40,7 @@  static void usage(void)
 {
 	fprintf(stderr, "Usage: ip tunnel { add | change | del | show } [ NAME ]\n");
 	fprintf(stderr, "          [ mode { ipip | gre | sit | isatap } ] [ remote ADDR ] [ local ADDR ]\n");
-	fprintf(stderr, "          [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
+	fprintf(stderr, "          [ [i|o]seq ] [ [i|o]key KEY ] [ 6rd_zone ADDR ] [ [i|o]csum ]\n");
 	fprintf(stderr, "          [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev PHYS_DEV ]\n");
 	fprintf(stderr, "\n");
 	fprintf(stderr, "Where: NAME := STRING\n");
@@ -156,6 +156,13 @@  static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
 			p->i_flags |= GRE_CSUM;
 		} else if (strcmp(*argv, "ocsum") == 0) {
 			p->o_flags |= GRE_CSUM;
+		} else if (strcmp(*argv, "6rd_zone") == 0) {
+			inet_prefix zone;
+			NEXT_ARG();
+			if (get_prefix(&zone, *argv, AF_INET6))
+				invarg("invalid 6rd_zone\n", *argv);
+			memcpy(&p->ip6rd_zone, zone.data, 16);
+			p->ip6rd_prefix = zone.bitlen;
 		} else if (strcmp(*argv, "nopmtudisc") == 0) {
 			p->iph.frag_off = 0;
 		} else if (strcmp(*argv, "pmtudisc") == 0) {
@@ -348,6 +355,13 @@  static void print_tunnel(struct ip_tunnel_parm *p)
 	if (!(p->iph.frag_off&htons(IP_DF)))
 		printf(" nopmtudisc");
 
+	if (p->ip6rd_prefix) {
+		char buf[128];
+		printf(" 6rd_zone %s/%u ",
+		       inet_ntop(AF_INET6, &p->ip6rd_zone, buf, 128),
+		       p->ip6rd_prefix);
+	}
+
 	if ((p->i_flags&GRE_KEY) && (p->o_flags&GRE_KEY) && p->o_key == p->i_key)
 		printf(" key %s", s3);
 	else if ((p->i_flags|p->o_flags)&GRE_KEY) {