diff options
author | 2016-11-24 19:42:43 +0200 | |
---|---|---|
committer | 2016-11-30 16:31:32 +0000 | |
commit | c5b136004543b9861a203af335d1ce61a976382d (patch) | |
tree | 5a4ad365f4086103afc65892a603a78be2ffbef1 /vpp/vpp-api | |
parent | aff7077d2031545a15efd12e7f65eac723799491 (diff) |
VXLAN multicast dst (remote) address support
Added support for multicast vxlan tunnels which are used for bridge domain flooding instead
of flooding the all unicast tunnels in the bridge domain.
features added:
* conditional flooding to some of the BD members - based on existance of multicast tunnel member
* added local multicast adjacency - multicast packets are handled as the same as unicast - based on src (unicast) address
* refactored some of vxlan tunnel creation code - to unify ip4/6 handling
Change-Id: I60cca4124265a8dd4f6b2d6ea8701e52e7c1baa4
Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'vpp/vpp-api')
-rw-r--r-- | vpp/vpp-api/api.c | 34 | ||||
-rw-r--r-- | vpp/vpp-api/custom_dump.c | 29 | ||||
-rw-r--r-- | vpp/vpp-api/vpe.api | 2 |
3 files changed, 29 insertions, 36 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index bbe1963a..8f0165a1 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -4679,31 +4679,22 @@ static void vl_api_vxlan_add_del_tunnel_t_handler goto out; } encap_fib_index = p[0]; - - /* Check src & dst are different */ - if ((mp->is_ipv6 && memcmp (mp->src_address, mp->dst_address, 16) == 0) || - (!mp->is_ipv6 && memcmp (mp->src_address, mp->dst_address, 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 */ - if (a->is_ip6) - { - memcpy (&(a->src.ip6), mp->src_address, 16); - memcpy (&(a->dst.ip6), mp->dst_address, 16); - } - else + ip46_from_addr_buf (mp->is_ipv6, mp->dst_address, &a->dst); + ip46_from_addr_buf (mp->is_ipv6, mp->src_address, &a->src); + + /* Check src & dst are different */ + if (ip46_address_cmp (&a->dst, &a->src) == 0) { - memcpy (&(a->src.ip4), mp->src_address, 4); - memcpy (&(a->dst.ip4), mp->dst_address, 4); + rv = VNET_API_ERROR_SAME_SRC_DST; + goto out; } - + a->mcast_sw_if_index = ntohl (mp->mcast_sw_if_index); a->encap_fib_index = encap_fib_index; a->decap_next_index = ntohl (mp->decap_next_index); a->vni = ntohl (mp->vni); @@ -4731,16 +4722,17 @@ static void send_vxlan_tunnel_details rmp->_vl_msg_id = ntohs (VL_API_VXLAN_TUNNEL_DETAILS); if (is_ipv6) { - memcpy (rmp->src_address, &(t->src.ip6), 16); - memcpy (rmp->dst_address, &(t->dst.ip6), 16); + memcpy (rmp->src_address, t->src.ip6.as_u8, 16); + memcpy (rmp->dst_address, t->dst.ip6.as_u8, 16); rmp->encap_vrf_id = htonl (im6->fibs[t->encap_fib_index].ft_table_id); } else { - memcpy (rmp->src_address, &(t->src.ip4), 4); - memcpy (rmp->dst_address, &(t->dst.ip4), 4); + memcpy (rmp->src_address, t->src.ip4.as_u8, 4); + memcpy (rmp->dst_address, t->dst.ip4.as_u8, 4); rmp->encap_vrf_id = htonl (im4->fibs[t->encap_fib_index].ft_table_id); } + rmp->mcast_sw_if_index = htonl (t->mcast_sw_if_index); rmp->vni = htonl (t->vni); /* decap_next_index is deprecated, hard code to l2-input */ rmp->decap_next_index = htonl (VXLAN_INPUT_NEXT_L2_INPUT); diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c index 6c181eec..2a9fd741 100644 --- a/vpp/vpp-api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -1410,23 +1410,22 @@ static void *vl_api_vxlan_add_del_tunnel_t_print (vl_api_vxlan_add_del_tunnel_t * mp, void *handle) { u8 *s; - s = format (0, "SCRIPT: vxlan_add_del_tunnel "); - if (mp->is_ipv6) - { - s = format (s, "src %U ", format_ip6_address, - (ip6_address_t *) mp->src_address); - s = format (s, "dst %U ", format_ip6_address, - (ip6_address_t *) mp->dst_address); - } - else - { - s = format (s, "src %U ", format_ip4_address, - (ip4_address_t *) mp->src_address); - s = format (s, "dst %U ", format_ip4_address, - (ip4_address_t *) mp->dst_address); - } + ip46_address_t src, dst; + + ip46_from_addr_buf (mp->is_ipv6, mp->dst_address, &dst); + ip46_from_addr_buf (mp->is_ipv6, mp->src_address, &src); + + u8 is_grp = ip46_address_is_multicast (&dst); + char *dst_name = is_grp ? "group" : "dst"; + + s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY); + s = format (s, "%s %U ", dst_name, format_ip46_address, + &dst, IP46_TYPE_ANY); + + if (is_grp) + s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index)); if (mp->encap_vrf_id) s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id)); diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api index 0e2f2292..69648afc 100644 --- a/vpp/vpp-api/vpe.api +++ b/vpp/vpp-api/vpe.api @@ -2126,6 +2126,7 @@ define vxlan_add_del_tunnel u8 is_ipv6; u8 src_address[16]; u8 dst_address[16]; + u32 mcast_sw_if_index; u32 encap_vrf_id; u32 decap_next_index; u32 vni; @@ -2151,6 +2152,7 @@ define vxlan_tunnel_details u32 sw_if_index; u8 src_address[16]; u8 dst_address[16]; + u32 mcast_sw_if_index; u32 encap_vrf_id; u32 decap_next_index; u32 vni; |