X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vpp%2Fvpp-api%2Fapi.c;h=69f3af6fb4c4abcfae840ff8e5c8b27158aa2977;hb=1099b0db45a7a0bb597c4deb5b9387f5b6ae280f;hp=fc075501bd9db515435939bd3e4cef8072cc65d1;hpb=296b20162affd0b3bb4168ced045fe7bcb15b03b;p=vpp.git diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index fc075501bd9..69f3af6fb4c 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -71,7 +71,6 @@ #include #include #include -#include #include #include #include @@ -192,8 +191,6 @@ _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \ _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \ _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \ _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \ -_(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \ -_(GRE_TUNNEL_DUMP, gre_tunnel_dump) \ _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \ _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \ _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \ @@ -3049,109 +3046,6 @@ static void vl_api_vxlan_tunnel_dump_t_handler } } -static void vl_api_gre_add_del_tunnel_t_handler - (vl_api_gre_add_del_tunnel_t * mp) -{ - vl_api_gre_add_del_tunnel_reply_t *rmp; - int rv = 0; - vnet_gre_add_del_tunnel_args_t _a, *a = &_a; - u32 outer_fib_id; - uword *p; - ip4_main_t *im = &ip4_main; - u32 sw_if_index = ~0; - - p = hash_get (im->fib_index_by_table_id, ntohl (mp->outer_fib_id)); - if (!p) - { - rv = VNET_API_ERROR_NO_SUCH_FIB; - goto out; - } - outer_fib_id = 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->teb = mp->teb; - - /* ip addresses sent in network byte order */ - clib_memcpy (&(a->src), mp->src_address, 4); - clib_memcpy (&(a->dst), mp->dst_address, 4); - - a->outer_fib_id = outer_fib_id; - rv = vnet_gre_add_del_tunnel (a, &sw_if_index); - -out: - /* *INDENT-OFF* */ - REPLY_MACRO2(VL_API_GRE_ADD_DEL_TUNNEL_REPLY, - ({ - rmp->sw_if_index = ntohl (sw_if_index); - })); - /* *INDENT-ON* */ -} - -static void send_gre_tunnel_details - (gre_tunnel_t * t, unix_shared_memory_queue_t * q, u32 context) -{ - vl_api_gre_tunnel_details_t *rmp; - ip4_main_t *im = &ip4_main; - - rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_GRE_TUNNEL_DETAILS); - clib_memcpy (rmp->src_address, &(t->tunnel_src), 4); - clib_memcpy (rmp->dst_address, &(t->tunnel_dst), 4); - rmp->outer_fib_id = htonl (im->fibs[t->outer_fib_index].ft_table_id); - rmp->teb = (GRE_TUNNEL_TYPE_TEB == t->type); - rmp->sw_if_index = htonl (t->sw_if_index); - rmp->context = context; - - vl_msg_api_send_shmem (q, (u8 *) & rmp); -} - -static void -vl_api_gre_tunnel_dump_t_handler (vl_api_gre_tunnel_dump_t * mp) -{ - unix_shared_memory_queue_t *q; - gre_main_t *gm = &gre_main; - gre_tunnel_t *t; - u32 sw_if_index; - - q = vl_api_client_index_to_input_queue (mp->client_index); - if (q == 0) - { - return; - } - - sw_if_index = ntohl (mp->sw_if_index); - - if (~0 == sw_if_index) - { - /* *INDENT-OFF* */ - pool_foreach (t, gm->tunnels, - ({ - send_gre_tunnel_details(t, q, mp->context); - })); - /* *INDENT-ON* */ - } - else - { - if ((sw_if_index >= vec_len (gm->tunnel_index_by_sw_if_index)) || - (~0 == gm->tunnel_index_by_sw_if_index[sw_if_index])) - { - return; - } - t = &gm->tunnels[gm->tunnel_index_by_sw_if_index[sw_if_index]]; - send_gre_tunnel_details (t, q, mp->context); - } -} - static void vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t * mp) {