summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vat/api_format.c34
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.api9
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.h3
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_api.c7
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c3
5 files changed, 53 insertions, 3 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 3eff8ef0a20..79be42c8ba7 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1694,6 +1694,39 @@ static void vl_api_l2tpv3_create_tunnel_reply_t_handler_json
vam->result_ready = 1;
}
+static void vl_api_gpe_add_del_fwd_entry_reply_t_handler
+ (vl_api_gpe_add_del_fwd_entry_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+static void vl_api_gpe_add_del_fwd_entry_reply_t_handler_json
+ (vl_api_gpe_add_del_fwd_entry_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t node;
+
+ vat_json_init_object (&node);
+ vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+ vat_json_object_add_uint (&node, "fwd_entry_index",
+ clib_net_to_host_u32 (mp->fwd_entry_index));
+
+ vat_json_print (vam->ofp, &node);
+ vat_json_free (&node);
+
+ vam->retval = ntohl (mp->retval);
+ vam->result_ready = 1;
+}
static void vl_api_one_add_del_locator_set_reply_t_handler
(vl_api_one_add_del_locator_set_reply_t * mp)
@@ -4390,7 +4423,6 @@ _(one_use_petr_reply) \
_(one_stats_enable_disable_reply) \
_(one_add_del_l2_arp_entry_reply) \
_(one_stats_flush_reply) \
-_(gpe_add_del_fwd_entry_reply) \
_(gpe_enable_disable_reply) \
_(gpe_set_encap_mode_reply) \
_(gpe_add_del_iface_reply) \
diff --git a/src/vnet/lisp-gpe/lisp_gpe.api b/src/vnet/lisp-gpe/lisp_gpe.api
index 7af153355b7..706f20d4585 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.api
+++ b/src/vnet/lisp-gpe/lisp_gpe.api
@@ -43,7 +43,7 @@ typeonly manual_print manual_endian define gpe_locator
@param loc_num - number of locators
@param locs - array of remote locators
*/
-autoreply manual_print manual_endian define gpe_add_del_fwd_entry
+manual_print manual_endian define gpe_add_del_fwd_entry
{
u32 client_index;
u32 context;
@@ -60,6 +60,13 @@ autoreply manual_print manual_endian define gpe_add_del_fwd_entry
vl_api_gpe_locator_t locs[loc_num];
};
+define gpe_add_del_fwd_entry_reply
+{
+ i32 retval;
+ u32 context;
+ u32 fwd_entry_index;
+};
+
/** \brief enable or disable gpe protocol
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
diff --git a/src/vnet/lisp-gpe/lisp_gpe.h b/src/vnet/lisp-gpe/lisp_gpe.h
index d86a225f5f8..f0405644b11 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.h
+++ b/src/vnet/lisp-gpe/lisp_gpe.h
@@ -221,6 +221,9 @@ typedef enum
/** */
typedef struct
{
+ /** forwarding entry index of */
+ u32 fwd_entry_index;
+
u8 is_src_dst;
u8 is_add;
diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c
index e2c055bafaf..ab081b350d1 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_api.c
@@ -358,7 +358,12 @@ vl_api_gpe_add_del_fwd_entry_t_handler (vl_api_gpe_add_del_fwd_entry_t * mp)
rv = vnet_lisp_gpe_add_del_fwd_entry (a, 0);
vec_free (pairs);
send_reply:
- REPLY_MACRO (VL_API_GPE_ADD_DEL_FWD_ENTRY_REPLY);
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_GPE_ADD_DEL_FWD_ENTRY_REPLY,
+ {
+ rmp->fwd_entry_index = clib_host_to_net_u32 (a->fwd_entry_index);
+ });
+ /* *INDENT-ON* */
}
static void
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index c898b9f7c31..c1fea804c56 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -478,6 +478,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm,
hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
lfe - lgm->lisp_fwd_entry_pool);
+ a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
@@ -791,6 +792,7 @@ add_l2_fwd_entry (lisp_gpe_main_t * lgm,
hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
lfe - lgm->lisp_fwd_entry_pool);
+ a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
lfe->type = (a->is_negative ?
LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :
@@ -1064,6 +1066,7 @@ add_nsh_fwd_entry (lisp_gpe_main_t * lgm,
hash_set_mem (lgm->lisp_gpe_fwd_entries, lfe->key,
lfe - lgm->lisp_fwd_entry_pool);
+ a->fwd_entry_index = lfe - lgm->lisp_fwd_entry_pool;
lfe->type = (a->is_negative ?
LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE :