summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/one_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/lisp-cp/one_api.c')
-rw-r--r--src/vnet/lisp-cp/one_api.c89
1 files changed, 86 insertions, 3 deletions
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index 33b3a47a352..0def13c6db9 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -134,7 +134,14 @@ _(ONE_ADD_DEL_NDP_ENTRY, one_add_del_ndp_entry) \
_(ONE_NDP_BD_GET, one_ndp_bd_get) \
_(ONE_NDP_ENTRIES_GET, one_ndp_entries_get) \
_(ONE_SET_TRANSPORT_PROTOCOL, one_set_transport_protocol) \
-_(ONE_GET_TRANSPORT_PROTOCOL, one_get_transport_protocol)
+_(ONE_GET_TRANSPORT_PROTOCOL, one_get_transport_protocol) \
+_(ONE_ENABLE_DISABLE_XTR_MODE, one_enable_disable_xtr_mode) \
+_(ONE_SHOW_XTR_MODE, one_show_xtr_mode) \
+_(ONE_ENABLE_DISABLE_PITR_MODE, one_enable_disable_pitr_mode) \
+_(ONE_SHOW_PITR_MODE, one_show_pitr_mode) \
+_(ONE_ENABLE_DISABLE_PETR_MODE, one_enable_disable_petr_mode) \
+_(ONE_SHOW_PETR_MODE, one_show_petr_mode) \
+
static locator_t *
unformat_one_locs (vl_api_one_remote_locator_t * rmt_locs, u32 rloc_num)
@@ -630,6 +637,7 @@ static void
if (!mp->is_add)
{
vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+ memset (a, 0, sizeof (a[0]));
gid_address_copy (&a->reid, eid);
a->is_add = 0;
rv = vnet_lisp_add_del_adjacency (a);
@@ -1444,7 +1452,10 @@ vl_api_show_one_pitr_t_handler (vl_api_show_one_pitr_t * mp)
return;
}
- if (!lcm->lisp_pitr)
+ u8 is_enabled = (lcm->flags & LISP_FLAG_PITR_MODE)
+ && lcm->pitr_map_index != ~0;
+
+ if (!is_enabled)
{
tmp_str = format (0, "N/A");
}
@@ -1467,7 +1478,7 @@ vl_api_show_one_pitr_t_handler (vl_api_show_one_pitr_t * mp)
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
({
- rmp->status = lcm->lisp_pitr;
+ rmp->status = lcm->flags & LISP_FLAG_PITR_MODE;
strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
ARRAY_LEN(rmp->locator_set_name) - 1);
}));
@@ -1769,6 +1780,78 @@ vl_api_one_ndp_entries_get_t_handler (vl_api_one_ndp_entries_get_t * mp)
vec_free (entries);
}
+static void
+ vl_api_one_enable_disable_xtr_mode_t_handler
+ (vl_api_one_enable_disable_xtr_mode_t * mp)
+{
+ vl_api_one_enable_disable_xtr_mode_reply_t *rmp = 0;
+ int rv = vnet_lisp_enable_disable_xtr_mode (mp->is_en);
+
+ REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_XTR_MODE_REPLY);
+}
+
+static void
+vl_api_one_show_xtr_mode_t_handler (vl_api_one_show_xtr_mode_t * mp)
+{
+ vl_api_one_show_xtr_mode_reply_t *rmp = 0;
+ int rv = 0;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_ONE_SHOW_XTR_MODE_REPLY,
+ {
+ rmp->is_en = vnet_lisp_get_xtr_mode ();
+ });
+ /* *INDENT-ON* */
+}
+
+static void
+ vl_api_one_enable_disable_pitr_mode_t_handler
+ (vl_api_one_enable_disable_pitr_mode_t * mp)
+{
+ vl_api_one_enable_disable_pitr_mode_reply_t *rmp = 0;
+ int rv = vnet_lisp_enable_disable_pitr_mode (mp->is_en);
+
+ REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PITR_MODE_REPLY);
+}
+
+static void
+vl_api_one_show_pitr_mode_t_handler (vl_api_one_show_pitr_mode_t * mp)
+{
+ vl_api_one_show_pitr_mode_reply_t *rmp = 0;
+ int rv = 0;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_ONE_SHOW_PITR_MODE_REPLY,
+ {
+ rmp->is_en = vnet_lisp_get_pitr_mode ();
+ });
+ /* *INDENT-ON* */
+}
+
+static void
+ vl_api_one_enable_disable_petr_mode_t_handler
+ (vl_api_one_enable_disable_petr_mode_t * mp)
+{
+ vl_api_one_enable_disable_petr_mode_reply_t *rmp = 0;
+ int rv = vnet_lisp_enable_disable_petr_mode (mp->is_en);
+
+ REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_PETR_MODE_REPLY);
+}
+
+static void
+vl_api_one_show_petr_mode_t_handler (vl_api_one_show_petr_mode_t * mp)
+{
+ vl_api_one_show_petr_mode_reply_t *rmp = 0;
+ int rv = 0;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_ONE_SHOW_PETR_MODE_REPLY,
+ {
+ rmp->is_en = vnet_lisp_get_petr_mode ();
+ });
+ /* *INDENT-ON* */
+}
+
/*
* one_api_hookup
* Add vpe's API message handlers to the table.