From b6e4d3990ed694fd0aeaa2e4a75c1b4602cf0379 Mon Sep 17 00:00:00 2001 From: Andrej Kozemcak Date: Tue, 14 Jun 2016 13:55:57 +0200 Subject: New LISP API map-request itr-rloc API to constrain source locator when sending map-requests. lisp map-request itr-rloc Change-Id: I19f3a1aa8a387ca8662ccf3a4ad774ea7d655f80 Signed-off-by: Andrej Kozemcak --- vpp/api/api.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- vpp/api/vpe.api | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) (limited to 'vpp') diff --git a/vpp/api/api.c b/vpp/api/api.c index 77635a9d..f99d9ce2 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -340,6 +340,9 @@ _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \ _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \ _(LISP_ENABLE_DISABLE_STATUS_DUMP, \ lisp_enable_disable_status_dump) \ +_(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \ + lisp_add_del_map_request_itr_rlocs) \ +_(LISP_GET_MAP_REQUEST_ITR_RLOCS, lisp_get_map_request_itr_rlocs) \ _(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \ _(AF_PACKET_CREATE, af_packet_create) \ _(AF_PACKET_DELETE, af_packet_delete) \ @@ -4934,6 +4937,27 @@ vl_api_lisp_pitr_set_locator_set_t_handler( REPLY_MACRO(VL_API_LISP_PITR_SET_LOCATOR_SET_REPLY); } +static void +vl_api_lisp_add_del_map_request_itr_rlocs_t_handler +(vl_api_lisp_add_del_map_request_itr_rlocs_t *mp) +{ + vl_api_lisp_add_del_map_request_itr_rlocs_reply_t *rmp; + int rv = 0; + u8 * locator_set_name = NULL; + vnet_lisp_add_del_mreq_itr_rloc_args_t _a, * a = &_a; + + locator_set_name = format (0, "%s", mp->locator_set_name); + + a->is_add = mp->is_add; + a->locator_set_name = locator_set_name; + + rv = vnet_lisp_add_del_mreq_itr_rlocs(a); + + vec_free(locator_set_name); + + REPLY_MACRO(VL_API_LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY); +} + /** Used for transferring locators via VPP API */ typedef CLIB_PACKED(struct { @@ -5240,7 +5264,7 @@ send_lisp_map_resolver_details (ip_address_t *ip, static void vl_api_lisp_map_resolver_dump_t_handler ( - vl_api_lisp_local_eid_table_dump_t *mp) + vl_api_lisp_map_resolver_dump_t *mp) { unix_shared_memory_queue_t * q = NULL; lisp_cp_main_t * lcm = vnet_lisp_cp_get_main(); @@ -5288,6 +5312,38 @@ vl_api_lisp_enable_disable_status_dump_t_handler send_lisp_enable_disable_details(q, mp->context); } +static void +vl_api_lisp_get_map_request_itr_rlocs_t_handler ( + vl_api_lisp_get_map_request_itr_rlocs_t *mp) +{ + unix_shared_memory_queue_t * q = NULL; + vl_api_lisp_get_map_request_itr_rlocs_reply_t *rmp = NULL; + lisp_cp_main_t * lcm = vnet_lisp_cp_get_main(); + locator_set_t * loc_set = 0; + u8 * tmp_str = 0; + int rv = 0; + + q = vl_api_client_index_to_input_queue (mp->client_index); + if (q == 0) { + return; + } + + if (~0 == lcm->mreq_itr_rlocs) { + tmp_str = format(0, " "); + } else { + loc_set = pool_elt_at_index (lcm->locator_set_pool, lcm->mreq_itr_rlocs); + tmp_str = format(0, "%s", loc_set->name); + } + + REPLY_MACRO2(VL_API_LISP_GET_MAP_REQUEST_ITR_RLOCS_REPLY, + ({ + strncpy((char *) rmp->locator_set_name, (char *) tmp_str, + ARRAY_LEN(rmp->locator_set_name) - 1); + })); + + vec_free(tmp_str); +} + static void vl_api_interface_name_renumber_t_handler (vl_api_interface_name_renumber_t *mp) { diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api index 71783a46..14664fdb 100644 --- a/vpp/api/vpe.api +++ b/vpp/api/vpe.api @@ -2404,6 +2404,29 @@ define lisp_add_del_remote_mapping_reply { i32 retval; }; +/** \brief add or delete map request itr rlocs + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param is_add - add address if non-zero, else delete + @param locator_set_name - locator set name +*/ +define lisp_add_del_map_request_itr_rlocs { + u32 client_index; + u32 context; + u8 is_add; + u8 locator_set_name[64]; +}; + +/** \brief Reply for lisp_add_del_map_request_itr_rlocs + @param context - returned sender context, to match reply w/ request + @param retval - return code +*/ + +define lisp_add_del_map_request_itr_rlocs_reply { + u32 context; + i32 retval; +}; + /** \brief LISP locator_set status @param locator_set_name - name of the locator_set @param sw_if_index - sw_if_index of the locator @@ -2519,6 +2542,23 @@ define lisp_enable_disable_status_dump { u32 context; }; +/** \brief Get LISP map request itr rlocs status + @param context - sender context, to match reply w/ request + @param locator_set_name - name of the locator_set + */ +define lisp_get_map_request_itr_rlocs { + u32 client_index; + u32 context; +}; + +/** \brief Request for map request itr rlocs summary status + */ +define lisp_get_map_request_itr_rlocs_reply { + u32 context; + i32 retval; + u8 locator_set_name[64]; +}; + /* Gross kludge, DGMS */ define interface_name_renumber { u32 client_index; -- cgit 1.2.3-korg