diff options
author | 2016-05-25 01:16:19 +0800 | |
---|---|---|
committer | 2016-05-25 10:42:43 +0000 | |
commit | df921cc65a25f6fb71b1169db6ff004b4e45430e (patch) | |
tree | f45fb2fe3641c59db8f89acba0bf51cba95ad8b2 /vpp | |
parent | c4cb44c05d121da2e0f0ccd39d5e1bf470731a85 (diff) |
Add Vxlan-Gpe over IPv6
PatchSet4: consolidate code as per comments.
PatchSet3: simplify the code using ip_udp_encap_one/two
PatchSet2: consolidate comments and indent style
Change-Id: Ia8b43f854a46d77e838e198566200ad28fd72472
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/api/api.c | 16 | ||||
-rw-r--r-- | vpp/api/custom_dump.c | 5 | ||||
-rw-r--r-- | vpp/api/vpe.api | 5 |
3 files changed, 20 insertions, 6 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c index 3bf2ed47..8b801e5a 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -4568,12 +4568,24 @@ vl_api_vxlan_gpe_add_del_tunnel_t_handler decap_fib_index = ntohl(mp->decap_vrf_id); } + /* Check src & dst are different */ + if ((a->is_ip6 && memcmp(mp->local, mp->remote, 16) == 0) || + (!a->is_ip6 && memcmp(mp->local, mp->remote, 4) == 0)) { + rv = VNET_API_ERROR_SAME_SRC_DST; + goto out; + } memset (a, 0, sizeof (*a)); a->is_add = mp->is_add; + a->is_ip6 = mp->is_ipv6; /* ip addresses sent in network byte order */ - a->local.as_u32 = ntohl(mp->local); - a->remote.as_u32 = ntohl(mp->remote); + if (a->is_ip6) { + clib_memcpy(&(a->local.ip6), mp->local, 16); + clib_memcpy(&(a->remote.ip6), mp->remote, 16); + } else { + clib_memcpy(&(a->local.ip4), mp->local, 4); + clib_memcpy(&(a->remote.ip4), mp->remote, 4); + } a->encap_fib_index = encap_fib_index; a->decap_fib_index = decap_fib_index; a->protocol = protocol; diff --git a/vpp/api/custom_dump.c b/vpp/api/custom_dump.c index 47c9f662..ba4cf538 100644 --- a/vpp/api/custom_dump.c +++ b/vpp/api/custom_dump.c @@ -1580,8 +1580,9 @@ static void *vl_api_vxlan_gpe_add_del_tunnel_t_print s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel "); - s = format (s, "local %U remote %U ", format_ip4_address, &mp->local, - format_ip4_address, &mp->remote); + s = format (s, "local %U ", format_ip46_address, &mp->local, mp->is_ipv6); + + s = format (s, "remote %U ", format_ip46_address, &mp->remote, mp->is_ipv6); s = format (s, "protocol %d ", ntohl(mp->protocol)); diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api index 2a827d12..9c90c338 100644 --- a/vpp/api/vpe.api +++ b/vpp/api/vpe.api @@ -2113,8 +2113,9 @@ manual_java define l2_fib_table_dump { define vxlan_gpe_add_del_tunnel { u32 client_index; u32 context; - u32 local; - u32 remote; + u8 is_ipv6; + u8 local[16]; + u8 remote[16]; u32 encap_vrf_id; u32 decap_vrf_id; u8 protocol; |