summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/lisp-cp/control.c21
-rw-r--r--src/vnet/lisp-cp/control.h11
-rw-r--r--src/vnet/lisp-cp/one_api.c30
3 files changed, 62 insertions, 0 deletions
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c
index 42b5b8b01b4..0d6d453de00 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/vnet/lisp-cp/control.c
@@ -4351,6 +4351,7 @@ lisp_cp_init (vlib_main_t * vm)
lcm->map_register_ttl = MAP_REGISTER_DEFAULT_TTL;
lcm->max_expired_map_registers = MAX_EXPIRED_MAP_REGISTERS_DEFAULT;
lcm->expired_map_registers = 0;
+ lcm->transport_protocol = LISP_TRANSPORT_PROTOCOL_UDP;
return 0;
}
@@ -4720,6 +4721,26 @@ VLIB_REGISTER_NODE (lisp_retry_service_node,static) = {
};
/* *INDENT-ON* */
+u32
+vnet_lisp_set_transport_protocol (u8 protocol)
+{
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+ if (protocol < LISP_TRANSPORT_PROTOCOL_UDP ||
+ protocol > LISP_TRANSPORT_PROTOCOL_API)
+ return VNET_API_ERROR_INVALID_ARGUMENT;
+
+ lcm->transport_protocol = protocol;
+ return 0;
+}
+
+lisp_transport_protocol_t
+vnet_lisp_get_transport_protocol (void)
+{
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ return lcm->transport_protocol;
+}
+
VLIB_INIT_FUNCTION (lisp_cp_init);
/*
diff --git a/src/vnet/lisp-cp/control.h b/src/vnet/lisp-cp/control.h
index 0df18f4284d..a6da81880db 100644
--- a/src/vnet/lisp-cp/control.h
+++ b/src/vnet/lisp-cp/control.h
@@ -140,6 +140,12 @@ typedef struct
u32 bd;
} lisp_l2_arp_key_t;
+typedef enum
+{
+ LISP_TRANSPORT_PROTOCOL_UDP = 1,
+ LISP_TRANSPORT_PROTOCOL_API
+} lisp_transport_protocol_t;
+
typedef struct
{
u64 nonce;
@@ -271,6 +277,9 @@ typedef struct
u32 max_expired_map_registers;
u32 expired_map_registers;
+ /** either UDP based or binary API. Default is UDP */
+ lisp_transport_protocol_t transport_protocol;
+
/* commodity */
ip4_main_t *im4;
ip6_main_t *im6;
@@ -404,6 +413,8 @@ int vnet_lisp_map_register_fallback_threshold_set (u32 value);
u32 vnet_lisp_map_register_fallback_threshold_get (void);
u32 *vnet_lisp_ndp_bds_get (void);
lisp_api_ndp_entry_t *vnet_lisp_ndp_entries_get_by_bd (u32 bd);
+u32 vnet_lisp_set_transport_protocol (u8 protocol);
+lisp_transport_protocol_t vnet_lisp_get_transport_protocol (void);
map_records_arg_t *parse_map_reply (vlib_buffer_t * b);
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index ae52381b06f..e3a2afe78cf 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -133,6 +133,8 @@ _(ONE_ADD_DEL_L2_ARP_ENTRY, one_add_del_l2_arp_entry) \
_(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)
static locator_t *
unformat_one_locs (vl_api_one_remote_locator_t * rmt_locs, u32 rloc_num)
@@ -1698,6 +1700,34 @@ static void
}
static void
+ vl_api_one_set_transport_protocol_t_handler
+ (vl_api_one_set_transport_protocol_t * mp)
+{
+ vl_api_one_set_transport_protocol_reply_t *rmp;
+ int rv = 0;
+
+ rv = vnet_lisp_set_transport_protocol (mp->protocol);
+
+ REPLY_MACRO (VL_API_ONE_SET_TRANSPORT_PROTOCOL_REPLY);
+}
+
+static void
+ vl_api_one_get_transport_protocol_t_handler
+ (vl_api_one_get_transport_protocol_t * mp)
+{
+ vl_api_one_get_transport_protocol_reply_t *rmp;
+ int rv = 0;
+ u8 proto = (u8) vnet_lisp_get_transport_protocol ();
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_ONE_GET_TRANSPORT_PROTOCOL_REPLY,
+ ({
+ rmp->protocol = proto;
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
vl_api_one_ndp_entries_get_t_handler (vl_api_one_ndp_entries_get_t * mp)
{
vl_api_one_ndp_entries_get_reply_t *rmp = 0;