summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Kotucek <pkotucek@cisco.com>2016-12-21 14:15:37 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-12-22 16:33:14 +0000
commitcfb7be88783d443a013d904de6d69a1ef169c5d2 (patch)
tree332dc8cf9239fde4438305dd9727a71b5bf528ae
parent56f32cc3a77d2c7d82e3ee57779abb30e1dd7586 (diff)
API refactoring : lisp
Change-Id: Ia1ebd03e5d55e5b20f244158366b9de15b1baae1 Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
-rw-r--r--vnet/Makefile.am20
-rw-r--r--vnet/vnet/lisp-cp/lisp.api857
-rw-r--r--vnet/vnet/lisp-cp/lisp_api.c1257
-rw-r--r--vnet/vnet/vnet_all_api_h.h1
-rw-r--r--vpp-api/java/Makefile.am4
-rw-r--r--vpp/vpp-api/api.c1221
-rw-r--r--vpp/vpp-api/vpe.api837
7 files changed, 2131 insertions, 2066 deletions
diff --git a/vnet/Makefile.am b/vnet/Makefile.am
index eaf31e25c11..c3ba6e72fd8 100644
--- a/vnet/Makefile.am
+++ b/vnet/Makefile.am
@@ -46,8 +46,10 @@ BUILT_SOURCES = \
vnet/bfd/bfd.api.json \
vnet/ipsec/ipsec.api.h \
vnet/ipsec/ipsec.api.json \
- vnet/ipsec-gre/ipsec_gre.api.h \
- vnet/ipsec-gre/ipsec_gre.api.json
+ vnet/ipsec-gre/ipsec_gre.api.h \
+ vnet/ipsec-gre/ipsec_gre.api.json \
+ vnet/lisp-cp/lisp.api.h \
+ vnet/lisp-cp/lisp.api.json
libvnet_la_SOURCES =
libvnetplugin_la_SOURCES =
@@ -568,7 +570,8 @@ libvnet_la_SOURCES += \
vnet/lisp-cp/control.c \
vnet/lisp-cp/gid_dictionary.c \
vnet/lisp-cp/lisp_msg_serdes.c \
- vnet/lisp-cp/packets.c
+ vnet/lisp-cp/packets.c \
+ vnet/lisp-cp/lisp_api.c
nobase_include_HEADERS += \
vnet/lisp-cp/lisp_types.h \
@@ -576,8 +579,8 @@ nobase_include_HEADERS += \
vnet/lisp-cp/gid_dictionary.h \
vnet/lisp-cp/lisp_cp_messages.h \
vnet/lisp-cp/lisp_msg_serdes.h \
- vnet/lisp-cp/control.h
-
+ vnet/lisp-cp/control.h \
+ vnet/lisp-cp/lisp.api.h
if ENABLE_TESTS
LDS = -lvppinfra -l:libvlib.a $(dpdk_libs) -l:libvlibmemory.a \
@@ -618,14 +621,14 @@ libvnet_la_SOURCES += \
vnet/lisp-gpe/lisp_gpe_fwd_entry.c \
vnet/lisp-gpe/lisp_gpe_tenant.c \
vnet/lisp-gpe/interface.c \
- vnet/lisp-gpe/decap.c
+ vnet/lisp-gpe/decap.c
nobase_include_HEADERS += \
vnet/lisp-gpe/lisp_gpe.h \
vnet/lisp-gpe/lisp_gpe_fwd_entry.h \
vnet/lisp-gpe/lisp_gpe_tenant.h \
vnet/lisp-gpe/lisp_gpe_packet.h \
- vnet/lisp-gpe/lisp_gpe_error.def
+ vnet/lisp-gpe/lisp_gpe_error.def
if ENABLE_TESTS
TESTS += test_test
@@ -988,7 +991,8 @@ api_DATA = \
vnet/vxlan-gpe/vxlan_gpe.api.json \
vnet/bfd/bfd.api.json \
vnet/ipsec/ipsec.api.json \
- vnet/ipsec-gre/ipsec_gre.api.json
+ vnet/ipsec-gre/ipsec_gre.api.json \
+ vnet/lisp-cp/lisp.api.json
# The actual %.api.h rule is in .../build-data/packages/suffix-rules.mk
# and requires a symbolic link at the top of the vnet source tree
diff --git a/vnet/vnet/lisp-cp/lisp.api b/vnet/vnet/lisp-cp/lisp.api
new file mode 100644
index 00000000000..26fa9bbeff6
--- /dev/null
+++ b/vnet/vnet/lisp-cp/lisp.api
@@ -0,0 +1,857 @@
+/*
+ * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** \brief add or delete locator_set
+ @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 name
+ @param locator_num - number of locators
+ @param locators - LISP locator records
+ Structure of one locator record is as follows:
+
+ define locator_t {
+ u32 sw_if_index;
+ u8 priority;
+ u8 weight;
+ }
+*/
+define lisp_add_del_locator_set
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 locator_set_name[64];
+ u32 locator_num;
+ u8 locators[0];
+};
+
+/** \brief Reply for locator_set add/del
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+ @param ls_index - locator set index
+*/
+define lisp_add_del_locator_set_reply
+{
+ u32 context;
+ i32 retval;
+ u32 ls_index;
+};
+
+/** \brief add or delete locator for locator_set
+ @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 - name of locator_set to add/del locator
+ @param sw_if_index - index of the interface
+ @param priority - priority of the lisp locator
+ @param weight - weight of the lisp locator
+*/
+define lisp_add_del_locator
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 locator_set_name[64];
+ u32 sw_if_index;
+ u8 priority;
+ u8 weight;
+};
+
+/** \brief Reply for locator add/del
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_add_del_locator_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief add or delete lisp eid-table
+ @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 eid_type:
+ 0 : ipv4
+ 1 : ipv6
+ 2 : mac
+ @param eid - EID can be ip4, ip6 or mac
+ @param prefix_len - prefix len
+ @param locator_set_name - name of locator_set to add/del eid-table
+ @param vni - virtual network instance
+ @param key_id
+ HMAC_NO_KEY 0
+ HMAC_SHA_1_96 1
+ HMAC_SHA_256_128 2
+ @param key - secret key
+*/
+define lisp_add_del_local_eid
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 eid_type;
+ u8 eid[16];
+ u8 prefix_len;
+ u8 locator_set_name[64];
+ u32 vni;
+ u16 key_id;
+ u8 key[64];
+};
+
+/** \brief Reply for local_eid add/del
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_add_del_local_eid_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Add/delete map server
+ @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; delete otherwise
+ @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+ @param ip_address - map server IP address
+*/
+define lisp_add_del_map_server
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 is_ipv6;
+ u8 ip_address[16];
+};
+
+/** \brief Reply for lisp_add_del_map_server
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_add_del_map_server_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief add or delete map-resolver
+ @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 is_ipv6 - if non-zero the address is ipv6, else ipv4
+ @param ip_address - array of address bytes
+*/
+define lisp_add_del_map_resolver
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 is_ipv6;
+ u8 ip_address[16];
+};
+
+/** \brief Reply for map_resolver add/del
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_add_del_map_resolver_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief enable or disable lisp-gpe protocol
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_en - enable protocol if non-zero, else disable
+*/
+define lisp_gpe_enable_disable
+{
+ u32 client_index;
+ u32 context;
+ u8 is_en;
+};
+
+/** \brief Reply for gpe enable/disable
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_gpe_enable_disable_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief enable or disable LISP feature
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_en - enable protocol if non-zero, else disable
+*/
+define lisp_enable_disable
+{
+ u32 client_index;
+ u32 context;
+ u8 is_en;
+};
+
+/** \brief Reply for gpe enable/disable
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_enable_disable_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief configure or disable LISP PITR node
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param ls_name - locator set name
+ @param is_add - add locator set if non-zero, else disable pitr
+*/
+define lisp_pitr_set_locator_set
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 ls_name[64];
+};
+
+/** \brief Reply for lisp_pitr_set_locator_set
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_pitr_set_locator_set_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Get state of LISP RLOC probing
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define show_lisp_rloc_probe_state
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Reply for show_lisp_rloc_probe_state
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+ @param is_enabled - state of RLOC probing
+*/
+define show_lisp_rloc_probe_state_reply
+{
+ u32 context;
+ i32 retval;
+ u8 is_enabled;
+};
+
+/** \brief enable/disable LISP RLOC probing
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_enable - enable if non-zero; disable otherwise
+*/
+define lisp_rloc_probe_enable_disable
+{
+ u32 client_index;
+ u32 context;
+ u8 is_enabled;
+};
+
+/** \brief Reply for lisp_rloc_probe_enable_disable
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_rloc_probe_enable_disable_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief enable/disable LISP map-register
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_enable - enable if non-zero; disable otherwise
+*/
+define lisp_map_register_enable_disable
+{
+ u32 client_index;
+ u32 context;
+ u8 is_enabled;
+};
+
+/** \brief Reply for lisp_map_register_enable_disable
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_map_register_enable_disable_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Get state of LISP map-register
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define show_lisp_map_register_state
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Reply for show_lisp_map_register_state
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define show_lisp_map_register_state_reply
+{
+ u32 context;
+ i32 retval;
+ u8 is_enabled;
+};
+
+/** \brief set LISP map-request mode. Based on configuration VPP will send
+ src/dest or just normal destination map requests.
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param mode - new map-request mode. Supported values are:
+ 0 - destination only
+ 1 - source/destaination
+*/
+define lisp_map_request_mode
+{
+ u32 client_index;
+ u32 context;
+ u8 mode;
+};
+
+/** \brief Reply for lisp_map_request_mode
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_map_request_mode_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Request for LISP map-request mode
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define show_lisp_map_request_mode
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Reply for show_lisp_map_request_mode
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+ @param mode - map-request mode
+*/
+define show_lisp_map_request_mode_reply
+{
+ u32 context;
+ i32 retval;
+ u8 mode;
+};
+
+/** \brief add or delete remote static mapping
+ @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 is_src_dst - flag indicating src/dst based routing policy
+ @param del_all - if set, delete all remote mappings
+ @param vni - virtual network instance
+ @param action - negative map-reply action
+ @param eid_type -
+ 0 : ipv4
+ 1 : ipv6
+ 2 : mac
+ @param deid - dst EID
+ @param seid - src EID, valid only if is_src_dst is enabled
+ @param rloc_num - number of remote locators
+ @param rlocs - remote locator records
+ Structure of remote locator:
+
+ define rloc_t {
+ u8 is_ip4;
+ u8 priority;
+ u8 weight;
+ u8 addr[16];
+ }
+*/
+define lisp_add_del_remote_mapping
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u8 is_src_dst;
+ u8 del_all;
+ u32 vni;
+ u8 action;
+ u8 eid_type;
+ u8 eid[16];
+ u8 eid_len;
+ u8 seid[16];
+ u8 seid_len;
+ u32 rloc_num;
+ u8 rlocs[0];
+};
+
+/** \brief Reply for lisp_add_del_remote_mapping
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_add_del_remote_mapping_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief add or delete LISP adjacency adjacency
+ @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 vni - virtual network instance
+ @param eid_type -
+ 0 : ipv4
+ 1 : ipv6
+ 2 : mac
+ @param reid - remote EID
+ @param leid - local EID
+*/
+define lisp_add_del_adjacency
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u32 vni;
+ u8 eid_type;
+ u8 reid[16];
+ u8 leid[16];
+ u8 reid_len;
+ u8 leid_len;
+};
+
+/** \brief Reply for lisp_add_del_adjacency
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_add_del_adjacency_reply
+{
+ u32 context;
+ 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 map/unmap vni/bd_index to vrf
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_add - add or delete mapping
+ @param dp_table - virtual network id/bridge domain index
+ @param vrf - vrf
+*/
+define lisp_eid_table_add_del_map
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u32 vni;
+ u32 dp_table;
+ u8 is_l2;
+};
+
+/** \brief Reply for lisp_eid_table_add_del_map
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define lisp_eid_table_add_del_map_reply
+{
+ u32 context;
+ i32 retval;
+};
+
+/** \brief Request for map lisp locator status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param locator_set_index - index of locator_set
+ @param ls_name - locator set name
+ @param is_index_set - flag indicating whether ls_name or ls_index is set
+ */
+define lisp_locator_dump
+{
+ u32 client_index;
+ u32 context;
+ u32 ls_index;
+ u8 ls_name[64];
+ u8 is_index_set;
+};
+
+/** \brief LISP locator_set status
+ @param local - if is set, then locator is local
+ @param locator_set_name - name of the locator_set
+ @param sw_if_index - sw_if_index of the locator
+ @param priority - locator priority
+ @param weight - locator weight
+ */
+define lisp_locator_details
+{
+ u32 context;
+ u8 local;
+ u32 sw_if_index;
+ u8 is_ipv6;
+ u8 ip_address[16];
+ u8 priority;
+ u8 weight;
+};
+
+/** \brief LISP locator_set status
+ @param context - sender context, to match reply w/ request
+ @param ls_index - locator set index
+ @param ls_name - name of the locator set
+ */
+define lisp_locator_set_details
+{
+ u32 context;
+ u32 ls_index;
+ u8 ls_name[64];
+};
+
+/** \brief Request for locator_set summary status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param filter - filter type
+ Supported values:
+ 0: all locator sets
+ 1: local locator sets
+ 2: remote locator sets
+ */
+define lisp_locator_set_dump
+{
+ u32 client_index;
+ u32 context;
+ u8 filter;
+};
+
+/** \brief Dump lisp eid-table
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param locator_set_index - index of locator_set, if ~0 then the mapping
+ is negative
+ @param action - negative map request action
+ @param is_local - local if non-zero, else remote
+ @param eid_type:
+ 0 : ipv4
+ 1 : ipv6
+ 2 : mac
+ @param is_src_dst - EID is type of source/destination
+ @param eid - EID can be ip4, ip6 or mac
+ @param eid_prefix_len - prefix length
+ @param seid - source EID can be ip4, ip6 or mac
+ @param seid_prefix_len - source prefix length
+ @param vni - virtual network instance
+ @param ttl - time to live
+ @param authoritative - authoritative
+ @param key_id
+ HMAC_NO_KEY 0
+ HMAC_SHA_1_96 1
+ HMAC_SHA_256_128 2
+ @param key - secret key
+*/
+
+define lisp_eid_table_details
+{
+ u32 context;
+ u32 locator_set_index;
+ u8 action;
+ u8 is_local;
+ u8 eid_type;
+ u8 is_src_dst;
+ u32 vni;
+ u8 eid[16];
+ u8 eid_prefix_len;
+ u8 seid[16];
+ u8 seid_prefix_len;
+ u32 ttl;
+ u8 authoritative;
+ u16 key_id;
+ u8 key[64];
+};
+
+/** \brief Request for eid table summary status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param eid_set - if non-zero request info about specific mapping
+ @param vni - virtual network instance; valid only if eid_set != 0
+ @param prefix_length - prefix length if EID is IP address;
+ valid only if eid_set != 0
+ @param eid_type - EID type; valid only if eid_set != 0
+ Supported values:
+ 0: EID is IPv4
+ 1: EID is IPv6
+ 2: EID is ethernet address
+ @param eid - endpoint identifier
+ @param filter - filter type;
+ Support values:
+ 0: all eid
+ 1: local eid
+ 2: remote eid
+ */
+define lisp_eid_table_dump
+{
+ u32 client_index;
+ u32 context;
+ u8 eid_set;
+ u8 prefix_length;
+ u32 vni;
+ u8 eid_type;
+ u8 eid[16];
+ u8 filter;
+};
+
+/** \brief LISP adjacency
+ @param eid_type -
+ 0 : ipv4
+ 1 : ipv6
+ 2 : mac
+ @param reid - remote EID
+ @param leid - local EID
+ @param reid_prefix_len - remote EID IP prefix length
+ @param leid_prefix_len - local EID IP prefix length
+ */
+typeonly manual_print manual_endian define lisp_adjacency
+{
+ u8 eid_type;
+ u8 reid[16];
+ u8 leid[16];
+ u8 reid_prefix_len;
+ u8 leid_prefix_len;
+};
+
+/** \brief LISP adjacency reply
+ @param count - number of adjacencies
+ @param adjacencies - array of adjacencies
+ */
+manual_endian manual_print define lisp_adjacencies_get_reply
+{
+ u32 context;
+ i32 retval;
+ u32 count;
+ vl_api_lisp_adjacency_t adjacencies[count];
+};
+
+/** \brief Request for LISP adjacencies
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param vni - filter adjacencies by VNI
+ */
+define lisp_adjacencies_get
+{
+ u32 client_index;
+ u32 context;
+ u32 vni;
+};
+
+/** \brief Shows relationship between vni and vrf/bd
+ @param dp_table - VRF index or bridge domain index
+ @param vni - vitual network instance
+ */
+define lisp_eid_table_map_details
+{
+ u32 context;
+ u32 vni;
+ u32 dp_table;
+};
+
+/** \brief Request for lisp_eid_table_map_details
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_l2 - if set dump vni/bd mappings else vni/vrf
+ */
+define lisp_eid_table_map_dump
+{
+ u32 client_index;
+ u32 context;
+ u8 is_l2;
+};
+
+/** \brief Dumps all VNIs used in mappings
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ */
+define lisp_eid_table_vni_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief reply to lisp_eid_table_vni_dump
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param vni - virtual network instance
+ */
+define lisp_eid_table_vni_details
+{
+ u32 client_index;
+ u32 context;
+ u32 vni;
+};
+
+/** \brief LISP map resolver status
+ @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+ @param ip_address - array of address bytes
+ */
+define lisp_map_resolver_details
+{
+ u32 context;
+ u8 is_ipv6;
+ u8 ip_address[16];
+};
+
+/** \brief Request for map resolver summary status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ */
+define lisp_map_resolver_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief LISP map server details
+ @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+ @param ip_address - array of address bytes
+ */
+define lisp_map_server_details
+{
+ u32 context;
+ u8 is_ipv6;
+ u8 ip_address[16];
+};
+
+/** \brief Request for map server summary status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ */
+define lisp_map_server_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Request for lisp-gpe protocol status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define show_lisp_status
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Status of lisp, enable or disable
+ @param context - sender context, to match reply w/ request
+ @param feature_status - lisp enable if non-zero, else disable
+ @param gpe_status - lisp enable if non-zero, else disable
+*/
+define show_lisp_status_reply
+{
+ u32 context;
+ i32 retval;
+ u8 feature_status;
+ u8 gpe_status;
+};
+
+/** \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];
+};
+
+/** \brief Request for lisp pitr status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define show_lisp_pitr
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Status of lisp pitr, enable or disable
+ @param context - sender context, to match reply w/ request
+ @param status - lisp pitr enable if non-zero, else disable
+ @param locator_set_name - name of the locator_set
+*/
+define show_lisp_pitr_reply
+{
+ u32 context;
+ i32 retval;
+ u8 status;
+ u8 locator_set_name[64];
+};
+
+/*
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
+ \ No newline at end of file
diff --git a/vnet/vnet/lisp-cp/lisp_api.c b/vnet/vnet/lisp-cp/lisp_api.c
new file mode 100644
index 00000000000..d3fc4627c5f
--- /dev/null
+++ b/vnet/vnet/lisp-cp/lisp_api.c
@@ -0,0 +1,1257 @@
+/*
+ *------------------------------------------------------------------
+ * lisp_api.c - lisp api
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <vnet/vnet.h>
+#include <vlibmemory/api.h>
+
+#include <vnet/interface.h>
+#include <vnet/api_errno.h>
+#include <vnet/lisp-cp/control.h>
+#include <vnet/lisp-gpe/lisp_gpe.h>
+
+#include <vnet/vnet_msg_enum.h>
+
+#define vl_typedefs /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_typedefs
+
+#define vl_endianfun /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vnet/vnet_all_api_h.h>
+#undef vl_printfun
+
+#include <vlibapi/api_helper_macros.h>
+
+#define foreach_vpe_api_msg \
+_(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
+_(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
+_(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
+_(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
+_(LISP_ADD_DEL_MAP_SERVER, lisp_add_del_map_server) \
+_(LISP_ENABLE_DISABLE, lisp_enable_disable) \
+_(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
+_(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
+_(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
+_(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
+_(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
+_(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
+_(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
+_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
+_(LISP_LOCATOR_DUMP, lisp_locator_dump) \
+_(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
+_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
+_(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
+_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
+_(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
+_(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
+_(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
+_(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
+_(SHOW_LISP_STATUS, show_lisp_status) \
+_(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) \
+_(SHOW_LISP_PITR, show_lisp_pitr) \
+_(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
+
+/** Used for transferring locators via VPP API */
+/* *INDENT-OFF* */
+typedef CLIB_PACKED (struct {
+ u8 is_ip4; /**< is locator an IPv4 address */
+ u8 priority; /**< locator priority */
+ u8 weight; /**< locator weight */
+ u8 addr[16]; /**< IPv4/IPv6 address */
+}) rloc_t;
+/* *INDENT-ON* */
+
+/** Used for transferring locators via VPP API */
+/* *INDENT-OFF* */
+typedef CLIB_PACKED (struct {
+ u32 sw_if_index; /**< locator sw_if_index */
+ u8 priority; /**< locator priority */
+ u8 weight; /**< locator weight */
+}) ls_locator_t;
+/* *INDENT-ON* */
+
+static locator_t *
+unformat_lisp_locs (void *rmt_locs, u32 rloc_num)
+{
+ u32 i;
+ locator_t *locs = 0, loc;
+ rloc_t *r;
+
+ for (i = 0; i < rloc_num; i++)
+ {
+ /* remote locators */
+ r = &((rloc_t *) rmt_locs)[i];
+ memset (&loc, 0, sizeof (loc));
+ gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
+
+ loc.priority = r->priority;
+ loc.weight = r->weight;
+
+ vec_add1 (locs, loc);
+ }
+ return locs;
+}
+
+static void
+vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t *
+ mp)
+{
+ vl_api_lisp_add_del_locator_set_reply_t *rmp;
+ int rv = 0;
+ vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+ locator_t locator;
+ ls_locator_t *ls_loc;
+ u32 ls_index = ~0, locator_num;
+ u8 *locator_name = NULL;
+ int i;
+
+ memset (a, 0, sizeof (a[0]));
+
+ locator_name = format (0, "%s", mp->locator_set_name);
+
+ a->name = locator_name;
+ a->is_add = mp->is_add;
+ a->local = 1;
+ locator_num = clib_net_to_host_u32 (mp->locator_num);
+
+ memset (&locator, 0, sizeof (locator));
+ for (i = 0; i < locator_num; i++)
+ {
+ ls_loc = &((ls_locator_t *) mp->locators)[i];
+ VALIDATE_SW_IF_INDEX (ls_loc);
+
+ locator.sw_if_index = htonl (ls_loc->sw_if_index);
+ locator.priority = ls_loc->priority;
+ locator.weight = ls_loc->weight;
+ locator.local = 1;
+ vec_add1 (a->locators, locator);
+ }
+
+ rv = vnet_lisp_add_del_locator_set (a, &ls_index);
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ vec_free (locator_name);
+ vec_free (a->locators);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_LISP_ADD_DEL_LOCATOR_SET_REPLY,
+ ({
+ rmp->ls_index = clib_host_to_net_u32 (ls_index);
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+vl_api_lisp_add_del_locator_t_handler (vl_api_lisp_add_del_locator_t * mp)
+{
+ vl_api_lisp_add_del_locator_reply_t *rmp;
+ int rv = 0;
+ locator_t locator, *locators = NULL;
+ vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+ u32 ls_index = ~0;
+ u8 *locator_name = NULL;
+
+ memset (&locator, 0, sizeof (locator));
+ memset (a, 0, sizeof (a[0]));
+
+ locator.sw_if_index = ntohl (mp->sw_if_index);
+ locator.priority = mp->priority;
+ locator.weight = mp->weight;
+ locator.local = 1;
+ vec_add1 (locators, locator);
+
+ locator_name = format (0, "%s", mp->locator_set_name);
+
+ a->name = locator_name;
+ a->locators = locators;
+ a->is_add = mp->is_add;
+ a->local = 1;
+
+ rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
+
+ vec_free (locators);
+ vec_free (locator_name);
+
+ REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCATOR_REPLY);
+}
+
+static int
+unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
+ u8 len)
+{
+ switch (type)
+ {
+ case 0: /* ipv4 */
+ gid_address_type (dst) = GID_ADDR_IP_PREFIX;
+ gid_address_ip_set (dst, src, IP4);
+ gid_address_ippref_len (dst) = len;
+ ip_prefix_normalize (&gid_address_ippref (dst));
+ break;
+ case 1: /* ipv6 */
+ gid_address_type (dst) = GID_ADDR_IP_PREFIX;
+ gid_address_ip_set (dst, src, IP6);
+ gid_address_ippref_len (dst) = len;
+ ip_prefix_normalize (&gid_address_ippref (dst));
+ break;
+ case 2: /* l2 mac */
+ gid_address_type (dst) = GID_ADDR_MAC;
+ clib_memcpy (&gid_address_mac (dst), src, 6);
+ break;
+ default:
+ /* unknown type */
+ return VNET_API_ERROR_INVALID_VALUE;
+ }
+
+ gid_address_vni (dst) = vni;
+
+ return 0;
+}
+
+static void
+vl_api_lisp_add_del_local_eid_t_handler (vl_api_lisp_add_del_local_eid_t * mp)
+{
+ vl_api_lisp_add_del_local_eid_reply_t *rmp;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ int rv = 0;
+ gid_address_t _eid, *eid = &_eid;
+ uword *p = NULL;
+ u32 locator_set_index = ~0, map_index = ~0;
+ vnet_lisp_add_del_mapping_args_t _a, *a = &_a;
+ u8 *name = NULL, *key = NULL;
+ memset (a, 0, sizeof (a[0]));
+ memset (eid, 0, sizeof (eid[0]));
+
+ rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
+ mp->eid_type, mp->eid, mp->prefix_len);
+ if (rv)
+ goto out;
+
+ name = format (0, "%s", mp->locator_set_name);
+ p = hash_get_mem (lcm->locator_set_index_by_name, name);
+ if (!p)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto out;
+ }
+ locator_set_index = p[0];
+
+ if (*mp->key)
+ key = format (0, "%s", mp->key);
+
+ /* XXX treat batch configuration */
+ a->is_add = mp->is_add;
+ gid_address_copy (&a->eid, eid);
+ a->locator_set_index = locator_set_index;
+ a->local = 1;
+ a->key = key;
+ a->key_id = clib_net_to_host_u16 (mp->key_id);
+
+ rv = vnet_lisp_add_del_local_mapping (a, &map_index);
+
+out:
+ vec_free (name);
+ vec_free (key);
+ gid_address_free (&a->eid);
+
+ REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY);
+}
+
+static void
+ vl_api_lisp_eid_table_add_del_map_t_handler
+ (vl_api_lisp_eid_table_add_del_map_t * mp)
+{
+ vl_api_lisp_eid_table_add_del_map_reply_t *rmp;
+ int rv = 0;
+ rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
+ clib_net_to_host_u32 (mp->dp_table),
+ mp->is_l2, mp->is_add);
+REPLY_MACRO (VL_API_LISP_EID_TABLE_ADD_DEL_MAP_REPLY)}
+
+static void
+vl_api_lisp_add_del_map_server_t_handler (vl_api_lisp_add_del_map_server_t
+ * mp)
+{
+ vl_api_lisp_add_del_map_server_reply_t *rmp;
+ int rv = 0;
+ ip_address_t addr;
+
+ memset (&addr, 0, sizeof (addr));
+
+ ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+ rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
+
+ REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY);
+}
+
+static void
+vl_api_lisp_add_del_map_resolver_t_handler (vl_api_lisp_add_del_map_resolver_t
+ * mp)
+{
+ vl_api_lisp_add_del_map_resolver_reply_t *rmp;
+ int rv = 0;
+ vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a;
+
+ memset (a, 0, sizeof (a[0]));
+
+ a->is_add = mp->is_add;
+ ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+
+ rv = vnet_lisp_add_del_map_resolver (a);
+
+ REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_RESOLVER_REPLY);
+}
+
+static void
+ vl_api_lisp_map_register_enable_disable_t_handler
+ (vl_api_lisp_map_register_enable_disable_t * mp)
+{
+ vl_api_lisp_map_register_enable_disable_reply_t *rmp;
+ int rv = 0;
+
+ vnet_lisp_map_register_enable_disable (mp->is_enabled);
+ REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
+}
+
+static void
+ vl_api_lisp_rloc_probe_enable_disable_t_handler
+ (vl_api_lisp_rloc_probe_enable_disable_t * mp)
+{
+ vl_api_lisp_rloc_probe_enable_disable_reply_t *rmp;
+ int rv = 0;
+
+ vnet_lisp_rloc_probe_enable_disable (mp->is_enabled);
+ REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
+}
+
+static void
+vl_api_lisp_enable_disable_t_handler (vl_api_lisp_enable_disable_t * mp)
+{
+ vl_api_lisp_enable_disable_reply_t *rmp;
+ int rv = 0;
+
+ vnet_lisp_enable_disable (mp->is_en);
+ REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
+}
+
+static void
+ vl_api_show_lisp_map_request_mode_t_handler
+ (vl_api_show_lisp_map_request_mode_t * mp)
+{
+ int rv = 0;
+ vl_api_show_lisp_map_request_mode_reply_t *rmp;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_SHOW_LISP_MAP_REQUEST_MODE_REPLY,
+ ({
+ rmp->mode = vnet_lisp_get_map_request_mode ();
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+vl_api_lisp_map_request_mode_t_handler (vl_api_lisp_map_request_mode_t * mp)
+{
+ vl_api_lisp_map_request_mode_reply_t *rmp;
+ int rv = 0;
+
+ rv = vnet_lisp_set_map_request_mode (mp->mode);
+
+ REPLY_MACRO (VL_API_LISP_MAP_REQUEST_MODE_REPLY);
+}
+
+static void
+vl_api_lisp_pitr_set_locator_set_t_handler (vl_api_lisp_pitr_set_locator_set_t
+ * mp)
+{
+ vl_api_lisp_pitr_set_locator_set_reply_t *rmp;
+ int rv = 0;
+ u8 *ls_name = 0;
+
+ ls_name = format (0, "%s", mp->ls_name);
+ rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
+ vec_free (ls_name);
+
+ 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);
+}
+
+static void
+ vl_api_lisp_add_del_remote_mapping_t_handler
+ (vl_api_lisp_add_del_remote_mapping_t * mp)
+{
+ locator_t *rlocs = 0;
+ vl_api_lisp_add_del_remote_mapping_reply_t *rmp;
+ int rv = 0;
+ gid_address_t _eid, *eid = &_eid;
+ u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
+
+ memset (eid, 0, sizeof (eid[0]));
+
+ rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
+ mp->eid_type, mp->eid, mp->eid_len);
+ if (rv)
+ goto send_reply;
+
+ rlocs = unformat_lisp_locs (mp->rlocs, rloc_num);
+
+ if (!mp->is_add)
+ {
+ vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+ gid_address_copy (&a->reid, eid);
+ a->is_add = 0;
+ rv = vnet_lisp_add_del_adjacency (a);
+ if (rv)
+ {
+ goto out;
+ }
+ }
+
+ /* NOTE: for now this works as a static remote mapping, i.e.,
+ * not authoritative and ttl infinite. */
+ rv = vnet_lisp_add_del_mapping (eid, rlocs, mp->action, 0, ~0,
+ mp->is_add, 1 /* is_static */ , 0);
+
+ if (mp->del_all)
+ vnet_lisp_clear_all_remote_adjacencies ();
+
+out:
+ vec_free (rlocs);
+send_reply:
+ REPLY_MACRO (VL_API_LISP_ADD_DEL_REMOTE_MAPPING_REPLY);
+}
+
+static void
+vl_api_lisp_add_del_adjacency_t_handler (vl_api_lisp_add_del_adjacency_t * mp)
+{
+ vl_api_lisp_add_del_adjacency_reply_t *rmp;
+ vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+
+ int rv = 0;
+ memset (a, 0, sizeof (a[0]));
+
+ rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
+ mp->eid_type, mp->leid, mp->leid_len);
+ rv |= unformat_lisp_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
+ mp->eid_type, mp->reid, mp->reid_len);
+
+ if (rv)
+ goto send_reply;
+
+ a->is_add = mp->is_add;
+ rv = vnet_lisp_add_del_adjacency (a);
+
+send_reply:
+ REPLY_MACRO (VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
+}
+
+static void
+send_lisp_locator_details (lisp_cp_main_t * lcm,
+ locator_t * loc,
+ unix_shared_memory_queue_t * q, u32 context)
+{
+ vl_api_lisp_locator_details_t *rmp;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
+ rmp->context = context;
+
+ rmp->local = loc->local;
+ if (loc->local)
+ {
+ rmp->sw_if_index = ntohl (loc->sw_if_index);
+ }
+ else
+ {
+ rmp->is_ipv6 = gid_address_ip_version (&loc->address);
+ ip_address_copy_addr (rmp->ip_address, &gid_address_ip (&loc->address));
+ }
+ rmp->priority = loc->priority;
+ rmp->weight = loc->weight;
+
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t * mp)
+{
+ u8 *ls_name = 0;
+ unix_shared_memory_queue_t *q = 0;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ locator_set_t *lsit = 0;
+ locator_t *loc = 0;
+ u32 ls_index = ~0, *locit = 0;
+ uword *p = 0;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ if (mp->is_index_set)
+ ls_index = htonl (mp->ls_index);
+ else
+ {
+ /* make sure we get a proper C-string */
+ mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
+ ls_name = format (0, "%s", mp->ls_name);
+ p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
+ if (!p)
+ goto out;
+ ls_index = p[0];
+ }
+
+ if (pool_is_free_index (lcm->locator_set_pool, ls_index))
+ return;
+
+ lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
+
+ vec_foreach (locit, lsit->locator_indices)
+ {
+ loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
+ send_lisp_locator_details (lcm, loc, q, mp->context);
+ };
+out:
+ vec_free (ls_name);
+}
+
+static void
+send_lisp_locator_set_details (lisp_cp_main_t * lcm,
+ locator_set_t * lsit,
+ unix_shared_memory_queue_t * q,
+ u32 context, u32 ls_index)
+{
+ vl_api_lisp_locator_set_details_t *rmp;
+ u8 *str = 0;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
+ rmp->context = context;
+
+ rmp->ls_index = htonl (ls_index);
+ if (lsit->local)
+ {
+ ASSERT (lsit->name != NULL);
+ strncpy ((char *) rmp->ls_name, (char *) lsit->name,
+ vec_len (lsit->name));
+ }
+ else
+ {
+ str = format (0, "<remote-%d>", ls_index);
+ strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
+ vec_free (str);
+ }
+
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t * mp)
+{
+ unix_shared_memory_queue_t *q = NULL;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ locator_set_t *lsit = NULL;
+ u8 filter;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ filter = mp->filter;
+ /* *INDENT-OFF* */
+ pool_foreach (lsit, lcm->locator_set_pool,
+ ({
+ if (filter && !((1 == filter && lsit->local) ||
+ (2 == filter && !lsit->local)))
+ {
+ continue;
+ }
+ send_lisp_locator_set_details (lcm, lsit, q, mp->context,
+ lsit - lcm->locator_set_pool);
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+lisp_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
+{
+ ASSERT (prefix_length);
+ ip_prefix_t *ippref = &fid_addr_ippref (src);
+
+ switch (fid_addr_type (src))
+ {
+ case FID_ADDR_IP_PREF:
+ if (ip_prefix_version (ippref) == IP4)
+ clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
+ else
+ clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
+ prefix_length[0] = ip_prefix_len (ippref);
+ break;
+
+ case FID_ADDR_MAC:
+ prefix_length[0] = 0;
+ clib_memcpy (dst, fid_addr_mac (src), 6);
+ break;
+
+ default:
+ clib_warning ("Unknown FID type %d!", fid_addr_type (src));
+ break;
+ }
+}
+
+static u8
+fid_type_to_api_type (fid_address_t * fid)
+{
+ ip_prefix_t *ippref;
+
+ switch (fid_addr_type (fid))
+ {
+ case FID_ADDR_IP_PREF:
+ ippref = &fid_addr_ippref (fid);
+ if (ip_prefix_version (ippref) == IP4)
+ return 0;
+ else if (ip_prefix_version (ippref) == IP6)
+ return 1;
+ else
+ return ~0;
+
+ case FID_ADDR_MAC:
+ return 2;
+ }
+
+ return ~0;
+}
+
+static void
+send_lisp_eid_table_details (mapping_t * mapit,
+ unix_shared_memory_queue_t * q,
+ u32 context, u8 filter)
+{
+ fid_address_t *fid;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ locator_set_t *ls = 0;
+ vl_api_lisp_eid_table_details_t *rmp = NULL;
+ gid_address_t *gid = NULL;
+ u8 *mac = 0;
+ ip_prefix_t *ip_prefix = NULL;
+
+ switch (filter)
+ {
+ case 0: /* all mappings */
+ break;
+
+ case 1: /* local only */
+ if (!mapit->local)
+ return;
+ break;
+ case 2: /* remote only */
+ if (mapit->local)
+ return;
+ break;
+ default:
+ clib_warning ("Filter error, unknown filter: %d", filter);
+ return;
+ }
+
+ gid = &mapit->eid;
+ ip_prefix = &gid_address_ippref (gid);
+ mac = gid_address_mac (gid);
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
+
+ ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index);
+ if (vec_len (ls->locator_indices) == 0)
+ rmp->locator_set_index = ~0;
+ else
+ rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
+
+ rmp->is_local = mapit->local;
+ rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
+ rmp->action = mapit->action;
+ rmp->authoritative = mapit->authoritative;
+
+ switch (gid_address_type (gid))
+ {
+ case GID_ADDR_SRC_DST:
+ rmp->is_src_dst = 1;
+ fid = &gid_address_sd_src (gid);
+ rmp->eid_type = fid_type_to_api_type (fid);
+ lisp_fid_put_api (rmp->seid, &gid_address_sd_src (gid),
+ &rmp->seid_prefix_len);
+ lisp_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
+ &rmp->eid_prefix_len);
+ break;
+ case GID_ADDR_IP_PREFIX:
+ rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
+ if (ip_prefix_version (ip_prefix) == IP4)
+ {
+ rmp->eid_type = 0; /* ipv4 type */
+ clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
+ sizeof (ip_prefix_v4 (ip_prefix)));
+ }
+ else
+ {
+ rmp->eid_type = 1; /* ipv6 type */
+ clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
+ sizeof (ip_prefix_v6 (ip_prefix)));
+ }
+ break;
+ case GID_ADDR_MAC:
+ rmp->eid_type = 2; /* l2 mac type */
+ clib_memcpy (rmp->eid, mac, 6);
+ break;
+ default:
+ ASSERT (0);
+ }
+ rmp->context = context;
+ rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
+ rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
+ memcpy (rmp->key, mapit->key, vec_len (mapit->key));
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
+{
+ u32 mi;
+ unix_shared_memory_queue_t *q = NULL;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ mapping_t *mapit = NULL;
+ gid_address_t _eid, *eid = &_eid;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ if (mp->eid_set)
+ {
+ memset (eid, 0, sizeof (*eid));
+
+ unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
+ mp->eid_type, mp->eid, mp->prefix_length);
+
+ mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, eid);
+ if ((u32) ~ 0 == mi)
+ return;
+
+ mapit = pool_elt_at_index (lcm->mapping_pool, mi);
+ send_lisp_eid_table_details (mapit, q, mp->context,
+ 0 /* ignore filter */ );
+ }
+ else
+ {
+ /* *INDENT-OFF* */
+ pool_foreach (mapit, lcm->mapping_pool,
+ ({
+ send_lisp_eid_table_details(mapit, q, mp->context,
+ mp->filter);
+ }));
+ /* *INDENT-ON* */
+ }
+}
+
+static void
+send_lisp_map_server_details (ip_address_t * ip,
+ unix_shared_memory_queue_t * q, u32 context)
+{
+ vl_api_lisp_map_server_details_t *rmp = NULL;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
+
+ switch (ip_addr_version (ip))
+ {
+ case IP4:
+ rmp->is_ipv6 = 0;
+ clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
+ sizeof (ip_addr_v4 (ip)));
+ break;
+
+ case IP6:
+ rmp->is_ipv6 = 1;
+ clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
+ sizeof (ip_addr_v6 (ip)));
+ break;
+
+ default:
+ ASSERT (0);
+ }
+ rmp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_lisp_map_server_dump_t_handler (vl_api_lisp_map_server_dump_t * mp)
+{
+ unix_shared_memory_queue_t *q = NULL;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ lisp_msmr_t *mr;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ vec_foreach (mr, lcm->map_servers)
+ {
+ send_lisp_map_server_details (&mr->address, q, mp->context);
+ }
+}
+
+static void
+send_lisp_map_resolver_details (ip_address_t * ip,
+ unix_shared_memory_queue_t * q, u32 context)
+{
+ vl_api_lisp_map_resolver_details_t *rmp = NULL;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS);
+
+ switch (ip_addr_version (ip))
+ {
+ case IP4:
+ rmp->is_ipv6 = 0;
+ clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
+ sizeof (ip_addr_v4 (ip)));
+ break;
+
+ case IP6:
+ rmp->is_ipv6 = 1;
+ clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
+ sizeof (ip_addr_v6 (ip)));
+ break;
+
+ default:
+ ASSERT (0);
+ }
+ rmp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_lisp_map_resolver_dump_t_handler (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 ();
+ lisp_msmr_t *mr;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ vec_foreach (mr, lcm->map_resolvers)
+ {
+ send_lisp_map_resolver_details (&mr->address, q, mp->context);
+ }
+}
+
+static void
+send_eid_table_map_pair (hash_pair_t * p,
+ unix_shared_memory_queue_t * q, u32 context)
+{
+ vl_api_lisp_eid_table_map_details_t *rmp = NULL;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
+
+ rmp->vni = clib_host_to_net_u32 (p->key);
+ rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
+ rmp->context = context;
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_lisp_eid_table_map_dump_t_handler (vl_api_lisp_eid_table_map_dump_t *
+ mp)
+{
+ unix_shared_memory_queue_t *q = NULL;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ hash_pair_t *p;
+ uword *vni_table = 0;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ if (mp->is_l2)
+ {
+ vni_table = lcm->bd_id_by_vni;
+ }
+ else
+ {
+ vni_table = lcm->table_id_by_vni;
+ }
+
+ /* *INDENT-OFF* */
+ hash_foreach_pair (p, vni_table,
+ ({
+ send_eid_table_map_pair (p, q, mp->context);
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
+send_eid_table_vni (u32 vni, unix_shared_memory_queue_t * q, u32 context)
+{
+ vl_api_lisp_eid_table_vni_details_t *rmp = 0;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
+ rmp->context = context;
+ rmp->vni = clib_host_to_net_u32 (vni);
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+lisp_adjacency_copy (vl_api_lisp_adjacency_t * dst, lisp_adjacency_t * adjs)
+{
+ lisp_adjacency_t *adj;
+ vl_api_lisp_adjacency_t a;
+ u32 i, n = vec_len (adjs);
+
+ for (i = 0; i < n; i++)
+ {
+ adj = vec_elt_at_index (adjs, i);
+ memset (&a, 0, sizeof (a));
+
+ switch (gid_address_type (&adj->reid))
+ {
+ case GID_ADDR_IP_PREFIX:
+ a.reid_prefix_len = gid_address_ippref_len (&adj->reid);
+ a.leid_prefix_len = gid_address_ippref_len (&adj->leid);
+ if (gid_address_ip_version (&adj->reid) == IP4)
+ {
+ a.eid_type = 0; /* ipv4 type */
+ clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
+ clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
+ }
+ else
+ {
+ a.eid_type = 1; /* ipv6 type */
+ clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
+ clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
+ }
+ break;
+ case GID_ADDR_MAC:
+ a.eid_type = 2; /* l2 mac type */
+ mac_copy (a.reid, gid_address_mac (&adj->reid));
+ mac_copy (a.leid, gid_address_mac (&adj->leid));
+ break;
+ default:
+ ASSERT (0);
+ }
+ dst[i] = a;
+ }
+}
+
+static void
+ vl_api_show_lisp_rloc_probe_state_t_handler
+ (vl_api_show_lisp_rloc_probe_state_t * mp)
+{
+ vl_api_show_lisp_rloc_probe_state_reply_t *rmp = 0;
+ int rv = 0;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_SHOW_LISP_RLOC_PROBE_STATE_REPLY,
+ {
+ rmp->is_enabled = vnet_lisp_rloc_probe_state_get ();
+ });
+ /* *INDENT-ON* */
+}
+
+static void
+ vl_api_show_lisp_map_register_state_t_handler
+ (vl_api_show_lisp_map_register_state_t * mp)
+{
+ vl_api_show_lisp_map_register_state_reply_t *rmp = 0;
+ int rv = 0;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2 (VL_API_SHOW_LISP_MAP_REGISTER_STATE_REPLY,
+ {
+ rmp->is_enabled = vnet_lisp_map_register_state_get ();
+ });
+ /* *INDENT-ON* */
+}
+
+static void
+vl_api_lisp_adjacencies_get_t_handler (vl_api_lisp_adjacencies_get_t * mp)
+{
+ vl_api_lisp_adjacencies_get_reply_t *rmp = 0;
+ lisp_adjacency_t *adjs = 0;
+ int rv = 0;
+ vl_api_lisp_adjacency_t a;
+ u32 size = ~0;
+ u32 vni = clib_net_to_host_u32 (mp->vni);
+
+ adjs = vnet_lisp_adjacencies_get_by_vni (vni);
+ size = vec_len (adjs) * sizeof (a);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO4 (VL_API_LISP_ADJACENCIES_GET_REPLY, size,
+ {
+ rmp->count = clib_host_to_net_u32 (vec_len (adjs));
+ lisp_adjacency_copy (rmp->adjacencies, adjs);
+ });
+ /* *INDENT-ON* */
+
+ vec_free (adjs);
+}
+
+static void
+vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t *
+ mp)
+{
+ hash_pair_t *p;
+ u32 *vnis = 0;
+ unix_shared_memory_queue_t *q = 0;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ /* *INDENT-OFF* */
+ hash_foreach_pair (p, lcm->table_id_by_vni,
+ ({
+ hash_set (vnis, p->key, 0);
+ }));
+
+ hash_foreach_pair (p, lcm->bd_id_by_vni,
+ ({
+ hash_set (vnis, p->key, 0);
+ }));
+
+ hash_foreach_pair (p, vnis,
+ ({
+ send_eid_table_vni (p->key, q, mp->context);
+ }));
+ /* *INDENT-ON* */
+
+ hash_free (vnis);
+}
+
+static void
+vl_api_show_lisp_status_t_handler (vl_api_show_lisp_status_t * mp)
+{
+ unix_shared_memory_queue_t *q = NULL;
+ vl_api_show_lisp_status_reply_t *rmp = NULL;
+ int rv = 0;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
+ ({
+ rmp->gpe_status = vnet_lisp_gpe_enable_disable_status ();
+ rmp->feature_status = vnet_lisp_enable_disable_status ();
+ }));
+ /* *INDENT-ON* */
+}
+
+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);
+ }
+
+ /* *INDENT-OFF* */
+ 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);
+ }));
+ /* *INDENT-ON* */
+
+ vec_free (tmp_str);
+}
+
+static void
+vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp)
+{
+ unix_shared_memory_queue_t *q = NULL;
+ vl_api_show_lisp_pitr_reply_t *rmp = NULL;
+ lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+ mapping_t *m;
+ locator_set_t *ls = 0;
+ u8 *tmp_str = 0;
+ int rv = 0;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ if (!lcm->lisp_pitr)
+ {
+ tmp_str = format (0, "N/A");
+ }
+ else
+ {
+ m = pool_elt_at_index (lcm->mapping_pool, lcm->pitr_map_index);
+ if (~0 != m->locator_set_index)
+ {
+ ls =
+ pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index);
+ tmp_str = format (0, "%s", ls->name);
+ }
+ else
+ {
+ tmp_str = format (0, "N/A");
+ }
+ }
+ vec_add1 (tmp_str, 0);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_SHOW_LISP_PITR_REPLY,
+ ({
+ rmp->status = lcm->lisp_pitr;
+ strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
+ ARRAY_LEN(rmp->locator_set_name) - 1);
+ }));
+ /* *INDENT-ON* */
+}
+
+/*
+ * lisp_api_hookup
+ * Add vpe's API message handlers to the table.
+ * vlib has alread mapped shared memory and
+ * added the client registration handlers.
+ * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
+ */
+#define vl_msg_name_crc_list
+#include <vnet/vnet_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+ foreach_vl_msg_name_crc_lisp;
+#undef _
+}
+
+static clib_error_t *
+lisp_api_hookup (vlib_main_t * vm)
+{
+ api_main_t *am = &api_main;
+
+#define _(N,n) \
+ vl_msg_api_set_handlers(VL_API_##N, #n, \
+ vl_api_##n##_t_handler, \
+ vl_noop_handler, \
+ vl_api_##n##_t_endian, \
+ vl_api_##n##_t_print, \
+ sizeof(vl_api_##n##_t), 1);
+ foreach_vpe_api_msg;
+#undef _
+
+ /*
+ * Set up the (msg_name, crc, message-id) table
+ */
+ setup_message_id_table (am);
+
+ return 0;
+}
+
+VLIB_API_INIT_FUNCTION (lisp_api_hookup);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vnet/vnet/vnet_all_api_h.h b/vnet/vnet/vnet_all_api_h.h
index da962a3b189..4143fad1620 100644
--- a/vnet/vnet/vnet_all_api_h.h
+++ b/vnet/vnet/vnet_all_api_h.h
@@ -45,6 +45,7 @@
#include <vnet/bfd/bfd.api.h>
#include <vnet/ipsec/ipsec.api.h>
#include <vnet/ipsec-gre/ipsec_gre.api.h>
+#include <vnet/lisp-cp/lisp.api.h>
/*
* fd.io coding-style-patch-verification: ON
diff --git a/vpp-api/java/Makefile.am b/vpp-api/java/Makefile.am
index ed2da7c4062..9b2081ed4e2 100644
--- a/vpp-api/java/Makefile.am
+++ b/vpp-api/java/Makefile.am
@@ -98,7 +98,8 @@ jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: \
$(prefix)/../vnet/vnet/tap.api.json \
$(prefix)/../vnet/vnet/bfd.api.json \
$(prefix)/../vnet/vnet/ipsec.api.json \
- $(prefix)/../vnet/vnet/ipsec_gre.api.json
+ $(prefix)/../vnet/vnet/ipsec_gre.api.json \
+ $(prefix)/../vnet/vnet/lisp.api.json
cp -rf @srcdir@/jvpp-core/* -t jvpp-core/
mkdir -p jvpp-core/target
cd jvpp-core \
@@ -121,6 +122,7 @@ jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: \
$(prefix)/../vnet/vnet/bfd.api.json \
$(prefix)/../vnet/vnet/ipsec.api.json \
$(prefix)/../vnet/vnet/ipsec_gre.api.json \
+ $(prefix)/../vnet/vnet/lisp.api.json \
&& cp -rf types dto future callfacade callback notification *.java -t $(packagedir_jvpp_core) \
&& rm -rf types dto future callfacade callback notification *.java
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 4ac0afd3026..2e080d6667a 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -75,7 +75,6 @@
#include <vnet/lisp-gpe/lisp_gpe.h>
#include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
-#include <vnet/lisp-cp/control.h>
#include <vnet/map/map.h>
#include <vnet/cop/cop.h>
#include <vnet/ip/ip6_hop_by_hop.h>
@@ -188,39 +187,9 @@ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
_(GET_NODE_GRAPH, get_node_graph) \
_(IOAM_ENABLE, ioam_enable) \
_(IOAM_DISABLE, ioam_disable) \
-_(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
-_(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
-_(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
-_(LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry) \
-_(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
-_(LISP_ADD_DEL_MAP_SERVER, lisp_add_del_map_server) \
_(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable) \
-_(LISP_ENABLE_DISABLE, lisp_enable_disable) \
-_(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
-_(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
_(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface) \
-_(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
-_(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
-_(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
-_(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
-_(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
-_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
-_(LISP_LOCATOR_DUMP, lisp_locator_dump) \
-_(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
-_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
-_(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
-_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
-_(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
-_(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
-_(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
-_(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
-_(SHOW_LISP_STATUS, show_lisp_status) \
-_(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) \
-_(SHOW_LISP_PITR, show_lisp_pitr) \
-_(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \
_(POLICER_ADD_DEL, policer_add_del) \
_(POLICER_DUMP, policer_dump) \
@@ -3010,317 +2979,6 @@ static void vl_api_vxlan_gpe_tunnel_dump_t_handler
}
}
-/** Used for transferring locators via VPP API */
-/* *INDENT-OFF* */
-typedef CLIB_PACKED (struct {
- u32 sw_if_index; /**< locator sw_if_index */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
-}) ls_locator_t;
-/* *INDENT-ON* */
-
-static void
-vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t *
- mp)
-{
- vl_api_lisp_add_del_locator_set_reply_t *rmp;
- int rv = 0;
- vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
- locator_t locator;
- ls_locator_t *ls_loc;
- u32 ls_index = ~0, locator_num;
- u8 *locator_name = NULL;
- int i;
-
- memset (a, 0, sizeof (a[0]));
-
- locator_name = format (0, "%s", mp->locator_set_name);
-
- a->name = locator_name;
- a->is_add = mp->is_add;
- a->local = 1;
- locator_num = clib_net_to_host_u32 (mp->locator_num);
-
- memset (&locator, 0, sizeof (locator));
- for (i = 0; i < locator_num; i++)
- {
- ls_loc = &((ls_locator_t *) mp->locators)[i];
- VALIDATE_SW_IF_INDEX (ls_loc);
-
- locator.sw_if_index = htonl (ls_loc->sw_if_index);
- locator.priority = ls_loc->priority;
- locator.weight = ls_loc->weight;
- locator.local = 1;
- vec_add1 (a->locators, locator);
- }
-
- rv = vnet_lisp_add_del_locator_set (a, &ls_index);
-
- BAD_SW_IF_INDEX_LABEL;
-
- vec_free (locator_name);
- vec_free (a->locators);
-
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_LISP_ADD_DEL_LOCATOR_SET_REPLY,
- ({
- rmp->ls_index = clib_host_to_net_u32 (ls_index);
- }));
- /* *INDENT-ON* */
-}
-
-static void
-vl_api_lisp_add_del_locator_t_handler (vl_api_lisp_add_del_locator_t * mp)
-{
- vl_api_lisp_add_del_locator_reply_t *rmp;
- int rv = 0;
- locator_t locator, *locators = NULL;
- vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
- u32 ls_index = ~0;
- u8 *locator_name = NULL;
-
- memset (&locator, 0, sizeof (locator));
- memset (a, 0, sizeof (a[0]));
-
- locator.sw_if_index = ntohl (mp->sw_if_index);
- locator.priority = mp->priority;
- locator.weight = mp->weight;
- locator.local = 1;
- vec_add1 (locators, locator);
-
- locator_name = format (0, "%s", mp->locator_set_name);
-
- a->name = locator_name;
- a->locators = locators;
- a->is_add = mp->is_add;
- a->local = 1;
-
- rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
-
- vec_free (locators);
- vec_free (locator_name);
-
- REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCATOR_REPLY);
-}
-
-static int
-unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
- u8 len)
-{
- switch (type)
- {
- case 0: /* ipv4 */
- gid_address_type (dst) = GID_ADDR_IP_PREFIX;
- gid_address_ip_set (dst, src, IP4);
- gid_address_ippref_len (dst) = len;
- ip_prefix_normalize (&gid_address_ippref (dst));
- break;
- case 1: /* ipv6 */
- gid_address_type (dst) = GID_ADDR_IP_PREFIX;
- gid_address_ip_set (dst, src, IP6);
- gid_address_ippref_len (dst) = len;
- ip_prefix_normalize (&gid_address_ippref (dst));
- break;
- case 2: /* l2 mac */
- gid_address_type (dst) = GID_ADDR_MAC;
- clib_memcpy (&gid_address_mac (dst), src, 6);
- break;
- default:
- /* unknown type */
- return VNET_API_ERROR_INVALID_VALUE;
- }
-
- gid_address_vni (dst) = vni;
-
- return 0;
-}
-
-static void
-vl_api_lisp_add_del_local_eid_t_handler (vl_api_lisp_add_del_local_eid_t * mp)
-{
- vl_api_lisp_add_del_local_eid_reply_t *rmp;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- int rv = 0;
- gid_address_t _eid, *eid = &_eid;
- uword *p = NULL;
- u32 locator_set_index = ~0, map_index = ~0;
- vnet_lisp_add_del_mapping_args_t _a, *a = &_a;
- u8 *name = NULL, *key = NULL;
- memset (a, 0, sizeof (a[0]));
- memset (eid, 0, sizeof (eid[0]));
-
- rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
- mp->eid_type, mp->eid, mp->prefix_len);
- if (rv)
- goto out;
-
- name = format (0, "%s", mp->locator_set_name);
- p = hash_get_mem (lcm->locator_set_index_by_name, name);
- if (!p)
- {
- rv = VNET_API_ERROR_INVALID_VALUE;
- goto out;
- }
- locator_set_index = p[0];
-
- if (*mp->key)
- key = format (0, "%s", mp->key);
-
- /* XXX treat batch configuration */
- a->is_add = mp->is_add;
- gid_address_copy (&a->eid, eid);
- a->locator_set_index = locator_set_index;
- a->local = 1;
- a->key = key;
- a->key_id = clib_net_to_host_u16 (mp->key_id);
-
- rv = vnet_lisp_add_del_local_mapping (a, &map_index);
-
-out:
- vec_free (name);
- vec_free (key);
- gid_address_free (&a->eid);
-
- REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY);
-}
-
-static void
- vl_api_lisp_eid_table_add_del_map_t_handler
- (vl_api_lisp_eid_table_add_del_map_t * mp)
-{
- vl_api_lisp_eid_table_add_del_map_reply_t *rmp;
- int rv = 0;
- rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
- clib_net_to_host_u32 (mp->dp_table),
- mp->is_l2, mp->is_add);
-REPLY_MACRO (VL_API_LISP_EID_TABLE_ADD_DEL_MAP_REPLY)}
-
-/** Used for transferring locators via VPP API */
-/* *INDENT-OFF* */
-typedef CLIB_PACKED (struct {
- u8 is_ip4; /**< is locator an IPv4 address */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
- u8 addr[16]; /**< IPv4/IPv6 address */
-}) rloc_t;
-/* *INDENT-ON* */
-
-static locator_pair_t *
-unformat_lisp_loc_pairs (void *lcl_locs, void *rmt_locs, u32 rloc_num)
-{
- u32 i;
- locator_pair_t *pairs = 0, pair;
- rloc_t *r;
-
- for (i = 0; i < rloc_num; i++)
- {
- /* local locator */
- r = &((rloc_t *) lcl_locs)[i];
- memset (&pair.lcl_loc, 0, sizeof (pair.lcl_loc));
- ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
-
- /* remote locators */
- r = &((rloc_t *) rmt_locs)[i];
- memset (&pair.rmt_loc, 0, sizeof (pair.rmt_loc));
- ip_address_set (&pair.rmt_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
-
- pair.priority = r->priority;
- pair.weight = r->weight;
-
- vec_add1 (pairs, pair);
- }
- return pairs;
-}
-
-static locator_t *
-unformat_lisp_locs (void *rmt_locs, u32 rloc_num)
-{
- u32 i;
- locator_t *locs = 0, loc;
- rloc_t *r;
-
- for (i = 0; i < rloc_num; i++)
- {
- /* remote locators */
- r = &((rloc_t *) rmt_locs)[i];
- memset (&loc, 0, sizeof (loc));
- gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
-
- loc.priority = r->priority;
- loc.weight = r->weight;
-
- vec_add1 (locs, loc);
- }
- return locs;
-}
-
-static void
- vl_api_lisp_gpe_add_del_fwd_entry_t_handler
- (vl_api_lisp_gpe_add_del_fwd_entry_t * mp)
-{
- vl_api_lisp_gpe_add_del_fwd_entry_reply_t *rmp;
- vnet_lisp_gpe_add_del_fwd_entry_args_t _a, *a = &_a;
- locator_pair_t *pairs = 0;
- int rv = 0;
-
- memset (a, 0, sizeof (a[0]));
-
- rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, mp->eid_type,
- mp->rmt_eid, mp->rmt_len);
- rv |= unformat_lisp_eid_api (&a->lcl_eid, mp->vni, mp->eid_type,
- mp->lcl_eid, mp->lcl_len);
-
- pairs = unformat_lisp_loc_pairs (mp->lcl_locs, mp->rmt_locs, mp->loc_num);
-
- if (rv || 0 == pairs)
- goto send_reply;
-
- a->is_add = mp->is_add;
- a->locator_pairs = pairs;
- a->dp_table = mp->dp_table;
- a->vni = mp->vni;
- a->action = mp->action;
-
- rv = vnet_lisp_gpe_add_del_fwd_entry (a, 0);
- vec_free (pairs);
-send_reply:
- REPLY_MACRO (VL_API_LISP_GPE_ADD_DEL_FWD_ENTRY_REPLY);
-}
-
-static void
-vl_api_lisp_add_del_map_server_t_handler (vl_api_lisp_add_del_map_server_t
- * mp)
-{
- vl_api_lisp_add_del_map_server_reply_t *rmp;
- int rv = 0;
- ip_address_t addr;
-
- memset (&addr, 0, sizeof (addr));
-
- ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
- rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
-
- REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY);
-}
-
-static void
-vl_api_lisp_add_del_map_resolver_t_handler (vl_api_lisp_add_del_map_resolver_t
- * mp)
-{
- vl_api_lisp_add_del_map_resolver_reply_t *rmp;
- int rv = 0;
- vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a;
-
- memset (a, 0, sizeof (a[0]));
-
- a->is_add = mp->is_add;
- ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
-
- rv = vnet_lisp_add_del_map_resolver (a);
-
- REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_RESOLVER_REPLY);
-}
-
static void
vl_api_lisp_gpe_enable_disable_t_handler (vl_api_lisp_gpe_enable_disable_t *
mp)
@@ -3336,38 +2994,6 @@ vl_api_lisp_gpe_enable_disable_t_handler (vl_api_lisp_gpe_enable_disable_t *
}
static void
- vl_api_lisp_map_register_enable_disable_t_handler
- (vl_api_lisp_map_register_enable_disable_t * mp)
-{
- vl_api_lisp_map_register_enable_disable_reply_t *rmp;
- int rv = 0;
-
- vnet_lisp_map_register_enable_disable (mp->is_enabled);
- REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
-}
-
-static void
- vl_api_lisp_rloc_probe_enable_disable_t_handler
- (vl_api_lisp_rloc_probe_enable_disable_t * mp)
-{
- vl_api_lisp_rloc_probe_enable_disable_reply_t *rmp;
- int rv = 0;
-
- vnet_lisp_rloc_probe_enable_disable (mp->is_enabled);
- REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
-}
-
-static void
-vl_api_lisp_enable_disable_t_handler (vl_api_lisp_enable_disable_t * mp)
-{
- vl_api_lisp_enable_disable_reply_t *rmp;
- int rv = 0;
-
- vnet_lisp_enable_disable (mp->is_en);
- REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY);
-}
-
-static void
vl_api_lisp_gpe_add_del_iface_t_handler (vl_api_lisp_gpe_add_del_iface_t * mp)
{
vl_api_lisp_gpe_add_del_iface_reply_t *rmp;
@@ -3400,451 +3026,6 @@ vl_api_lisp_gpe_add_del_iface_t_handler (vl_api_lisp_gpe_add_del_iface_t * mp)
}
static void
- vl_api_show_lisp_map_request_mode_t_handler
- (vl_api_show_lisp_map_request_mode_t * mp)
-{
- int rv = 0;
- vl_api_show_lisp_map_request_mode_reply_t *rmp;
-
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_SHOW_LISP_MAP_REQUEST_MODE_REPLY,
- ({
- rmp->mode = vnet_lisp_get_map_request_mode ();
- }));
- /* *INDENT-ON* */
-}
-
-static void
-vl_api_lisp_map_request_mode_t_handler (vl_api_lisp_map_request_mode_t * mp)
-{
- vl_api_lisp_map_request_mode_reply_t *rmp;
- int rv = 0;
-
- rv = vnet_lisp_set_map_request_mode (mp->mode);
-
- REPLY_MACRO (VL_API_LISP_MAP_REQUEST_MODE_REPLY);
-}
-
-static void
-vl_api_lisp_pitr_set_locator_set_t_handler (vl_api_lisp_pitr_set_locator_set_t
- * mp)
-{
- vl_api_lisp_pitr_set_locator_set_reply_t *rmp;
- int rv = 0;
- u8 *ls_name = 0;
-
- ls_name = format (0, "%s", mp->ls_name);
- rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
- vec_free (ls_name);
-
- 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);
-}
-
-static void
- vl_api_lisp_add_del_remote_mapping_t_handler
- (vl_api_lisp_add_del_remote_mapping_t * mp)
-{
- locator_t *rlocs = 0;
- vl_api_lisp_add_del_remote_mapping_reply_t *rmp;
- int rv = 0;
- gid_address_t _eid, *eid = &_eid;
- u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
-
- memset (eid, 0, sizeof (eid[0]));
-
- rv = unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
- mp->eid_type, mp->eid, mp->eid_len);
- if (rv)
- goto send_reply;
-
- rlocs = unformat_lisp_locs (mp->rlocs, rloc_num);
-
- if (!mp->is_add)
- {
- vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
- gid_address_copy (&a->reid, eid);
- a->is_add = 0;
- rv = vnet_lisp_add_del_adjacency (a);
- if (rv)
- {
- goto out;
- }
- }
-
- /* NOTE: for now this works as a static remote mapping, i.e.,
- * not authoritative and ttl infinite. */
- rv = vnet_lisp_add_del_mapping (eid, rlocs, mp->action, 0, ~0,
- mp->is_add, 1 /* is_static */ , 0);
-
- if (mp->del_all)
- vnet_lisp_clear_all_remote_adjacencies ();
-
-out:
- vec_free (rlocs);
-send_reply:
- REPLY_MACRO (VL_API_LISP_ADD_DEL_REMOTE_MAPPING_REPLY);
-}
-
-static void
-vl_api_lisp_add_del_adjacency_t_handler (vl_api_lisp_add_del_adjacency_t * mp)
-{
- vl_api_lisp_add_del_adjacency_reply_t *rmp;
- vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
-
- int rv = 0;
- memset (a, 0, sizeof (a[0]));
-
- rv = unformat_lisp_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
- mp->eid_type, mp->leid, mp->leid_len);
- rv |= unformat_lisp_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
- mp->eid_type, mp->reid, mp->reid_len);
-
- if (rv)
- goto send_reply;
-
- a->is_add = mp->is_add;
- rv = vnet_lisp_add_del_adjacency (a);
-
-send_reply:
- REPLY_MACRO (VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
-}
-
-static void
-send_lisp_locator_details (lisp_cp_main_t * lcm,
- locator_t * loc,
- unix_shared_memory_queue_t * q, u32 context)
-{
- vl_api_lisp_locator_details_t *rmp;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
- rmp->context = context;
-
- rmp->local = loc->local;
- if (loc->local)
- {
- rmp->sw_if_index = ntohl (loc->sw_if_index);
- }
- else
- {
- rmp->is_ipv6 = gid_address_ip_version (&loc->address);
- ip_address_copy_addr (rmp->ip_address, &gid_address_ip (&loc->address));
- }
- rmp->priority = loc->priority;
- rmp->weight = loc->weight;
-
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_locator_dump_t_handler (vl_api_lisp_locator_dump_t * mp)
-{
- u8 *ls_name = 0;
- unix_shared_memory_queue_t *q = 0;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- locator_set_t *lsit = 0;
- locator_t *loc = 0;
- u32 ls_index = ~0, *locit = 0;
- uword *p = 0;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- if (mp->is_index_set)
- ls_index = htonl (mp->ls_index);
- else
- {
- /* make sure we get a proper C-string */
- mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
- ls_name = format (0, "%s", mp->ls_name);
- p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
- if (!p)
- goto out;
- ls_index = p[0];
- }
-
- if (pool_is_free_index (lcm->locator_set_pool, ls_index))
- return;
-
- lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
-
- vec_foreach (locit, lsit->locator_indices)
- {
- loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
- send_lisp_locator_details (lcm, loc, q, mp->context);
- };
-out:
- vec_free (ls_name);
-}
-
-static void
-send_lisp_locator_set_details (lisp_cp_main_t * lcm,
- locator_set_t * lsit,
- unix_shared_memory_queue_t * q,
- u32 context, u32 ls_index)
-{
- vl_api_lisp_locator_set_details_t *rmp;
- u8 *str = 0;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
- rmp->context = context;
-
- rmp->ls_index = htonl (ls_index);
- if (lsit->local)
- {
- ASSERT (lsit->name != NULL);
- strncpy ((char *) rmp->ls_name, (char *) lsit->name,
- vec_len (lsit->name));
- }
- else
- {
- str = format (0, "<remote-%d>", ls_index);
- strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
- vec_free (str);
- }
-
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t * mp)
-{
- unix_shared_memory_queue_t *q = NULL;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- locator_set_t *lsit = NULL;
- u8 filter;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- filter = mp->filter;
- /* *INDENT-OFF* */
- pool_foreach (lsit, lcm->locator_set_pool,
- ({
- if (filter && !((1 == filter && lsit->local) ||
- (2 == filter && !lsit->local)))
- {
- continue;
- }
- send_lisp_locator_set_details (lcm, lsit, q, mp->context,
- lsit - lcm->locator_set_pool);
- }));
- /* *INDENT-ON* */
-}
-
-static void
-lisp_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
-{
- ASSERT (prefix_length);
- ip_prefix_t *ippref = &fid_addr_ippref (src);
-
- switch (fid_addr_type (src))
- {
- case FID_ADDR_IP_PREF:
- if (ip_prefix_version (ippref) == IP4)
- clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
- else
- clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
- prefix_length[0] = ip_prefix_len (ippref);
- break;
-
- case FID_ADDR_MAC:
- prefix_length[0] = 0;
- clib_memcpy (dst, fid_addr_mac (src), 6);
- break;
-
- default:
- clib_warning ("Unknown FID type %d!", fid_addr_type (src));
- break;
- }
-}
-
-static u8
-fid_type_to_api_type (fid_address_t * fid)
-{
- ip_prefix_t *ippref;
-
- switch (fid_addr_type (fid))
- {
- case FID_ADDR_IP_PREF:
- ippref = &fid_addr_ippref (fid);
- if (ip_prefix_version (ippref) == IP4)
- return 0;
- else if (ip_prefix_version (ippref) == IP6)
- return 1;
- else
- return ~0;
-
- case FID_ADDR_MAC:
- return 2;
- }
-
- return ~0;
-}
-
-static void
-send_lisp_eid_table_details (mapping_t * mapit,
- unix_shared_memory_queue_t * q,
- u32 context, u8 filter)
-{
- fid_address_t *fid;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- locator_set_t *ls = 0;
- vl_api_lisp_eid_table_details_t *rmp = NULL;
- gid_address_t *gid = NULL;
- u8 *mac = 0;
- ip_prefix_t *ip_prefix = NULL;
-
- switch (filter)
- {
- case 0: /* all mappings */
- break;
-
- case 1: /* local only */
- if (!mapit->local)
- return;
- break;
- case 2: /* remote only */
- if (mapit->local)
- return;
- break;
- default:
- clib_warning ("Filter error, unknown filter: %d", filter);
- return;
- }
-
- gid = &mapit->eid;
- ip_prefix = &gid_address_ippref (gid);
- mac = gid_address_mac (gid);
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
-
- ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index);
- if (vec_len (ls->locator_indices) == 0)
- rmp->locator_set_index = ~0;
- else
- rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
-
- rmp->is_local = mapit->local;
- rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
- rmp->action = mapit->action;
- rmp->authoritative = mapit->authoritative;
-
- switch (gid_address_type (gid))
- {
- case GID_ADDR_SRC_DST:
- rmp->is_src_dst = 1;
- fid = &gid_address_sd_src (gid);
- rmp->eid_type = fid_type_to_api_type (fid);
- lisp_fid_put_api (rmp->seid, &gid_address_sd_src (gid),
- &rmp->seid_prefix_len);
- lisp_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
- &rmp->eid_prefix_len);
- break;
- case GID_ADDR_IP_PREFIX:
- rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
- if (ip_prefix_version (ip_prefix) == IP4)
- {
- rmp->eid_type = 0; /* ipv4 type */
- clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
- sizeof (ip_prefix_v4 (ip_prefix)));
- }
- else
- {
- rmp->eid_type = 1; /* ipv6 type */
- clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
- sizeof (ip_prefix_v6 (ip_prefix)));
- }
- break;
- case GID_ADDR_MAC:
- rmp->eid_type = 2; /* l2 mac type */
- clib_memcpy (rmp->eid, mac, 6);
- break;
- default:
- ASSERT (0);
- }
- rmp->context = context;
- rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
- rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
- memcpy (rmp->key, mapit->key, vec_len (mapit->key));
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
-{
- u32 mi;
- unix_shared_memory_queue_t *q = NULL;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- mapping_t *mapit = NULL;
- gid_address_t _eid, *eid = &_eid;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- if (mp->eid_set)
- {
- memset (eid, 0, sizeof (*eid));
-
- unformat_lisp_eid_api (eid, clib_net_to_host_u32 (mp->vni),
- mp->eid_type, mp->eid, mp->prefix_length);
-
- mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, eid);
- if ((u32) ~ 0 == mi)
- return;
-
- mapit = pool_elt_at_index (lcm->mapping_pool, mi);
- send_lisp_eid_table_details (mapit, q, mp->context,
- 0 /* ignore filter */ );
- }
- else
- {
- /* *INDENT-OFF* */
- pool_foreach (mapit, lcm->mapping_pool,
- ({
- send_lisp_eid_table_details(mapit, q, mp->context,
- mp->filter);
- }));
- /* *INDENT-ON* */
- }
-}
-
-static void
send_lisp_gpe_fwd_entry_details (lisp_gpe_fwd_entry_t * lfe,
unix_shared_memory_queue_t * q, u32 context)
{
@@ -3898,408 +3079,6 @@ vl_api_lisp_gpe_tunnel_dump_t_handler (vl_api_lisp_gpe_tunnel_dump_t * mp)
}
static void
-send_lisp_map_server_details (ip_address_t * ip,
- unix_shared_memory_queue_t * q, u32 context)
-{
- vl_api_lisp_map_server_details_t *rmp = NULL;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
-
- switch (ip_addr_version (ip))
- {
- case IP4:
- rmp->is_ipv6 = 0;
- clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
- sizeof (ip_addr_v4 (ip)));
- break;
-
- case IP6:
- rmp->is_ipv6 = 1;
- clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
- sizeof (ip_addr_v6 (ip)));
- break;
-
- default:
- ASSERT (0);
- }
- rmp->context = context;
-
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_map_server_dump_t_handler (vl_api_lisp_map_server_dump_t * mp)
-{
- unix_shared_memory_queue_t *q = NULL;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- lisp_msmr_t *mr;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- vec_foreach (mr, lcm->map_servers)
- {
- send_lisp_map_server_details (&mr->address, q, mp->context);
- }
-}
-
-static void
-send_lisp_map_resolver_details (ip_address_t * ip,
- unix_shared_memory_queue_t * q, u32 context)
-{
- vl_api_lisp_map_resolver_details_t *rmp = NULL;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS);
-
- switch (ip_addr_version (ip))
- {
- case IP4:
- rmp->is_ipv6 = 0;
- clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
- sizeof (ip_addr_v4 (ip)));
- break;
-
- case IP6:
- rmp->is_ipv6 = 1;
- clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
- sizeof (ip_addr_v6 (ip)));
- break;
-
- default:
- ASSERT (0);
- }
- rmp->context = context;
-
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_map_resolver_dump_t_handler (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 ();
- lisp_msmr_t *mr;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- vec_foreach (mr, lcm->map_resolvers)
- {
- send_lisp_map_resolver_details (&mr->address, q, mp->context);
- }
-}
-
-static void
-send_eid_table_map_pair (hash_pair_t * p,
- unix_shared_memory_queue_t * q, u32 context)
-{
- vl_api_lisp_eid_table_map_details_t *rmp = NULL;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
-
- rmp->vni = clib_host_to_net_u32 (p->key);
- rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
- rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_eid_table_map_dump_t_handler (vl_api_lisp_eid_table_map_dump_t *
- mp)
-{
- unix_shared_memory_queue_t *q = NULL;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- hash_pair_t *p;
- uword *vni_table = 0;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- if (mp->is_l2)
- {
- vni_table = lcm->bd_id_by_vni;
- }
- else
- {
- vni_table = lcm->table_id_by_vni;
- }
-
- /* *INDENT-OFF* */
- hash_foreach_pair (p, vni_table,
- ({
- send_eid_table_map_pair (p, q, mp->context);
- }));
- /* *INDENT-ON* */
-}
-
-static void
-send_eid_table_vni (u32 vni, unix_shared_memory_queue_t * q, u32 context)
-{
- vl_api_lisp_eid_table_vni_details_t *rmp = 0;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
- rmp->context = context;
- rmp->vni = clib_host_to_net_u32 (vni);
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-lisp_adjacency_copy (vl_api_lisp_adjacency_t * dst, lisp_adjacency_t * adjs)
-{
- lisp_adjacency_t *adj;
- vl_api_lisp_adjacency_t a;
- u32 i, n = vec_len (adjs);
-
- for (i = 0; i < n; i++)
- {
- adj = vec_elt_at_index (adjs, i);
- memset (&a, 0, sizeof (a));
-
- switch (gid_address_type (&adj->reid))
- {
- case GID_ADDR_IP_PREFIX:
- a.reid_prefix_len = gid_address_ippref_len (&adj->reid);
- a.leid_prefix_len = gid_address_ippref_len (&adj->leid);
- if (gid_address_ip_version (&adj->reid) == IP4)
- {
- a.eid_type = 0; /* ipv4 type */
- clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
- clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
- }
- else
- {
- a.eid_type = 1; /* ipv6 type */
- clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
- clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
- }
- break;
- case GID_ADDR_MAC:
- a.eid_type = 2; /* l2 mac type */
- mac_copy (a.reid, gid_address_mac (&adj->reid));
- mac_copy (a.leid, gid_address_mac (&adj->leid));
- break;
- default:
- ASSERT (0);
- }
- dst[i] = a;
- }
-}
-
-static void
- vl_api_show_lisp_rloc_probe_state_t_handler
- (vl_api_show_lisp_rloc_probe_state_t * mp)
-{
- vl_api_show_lisp_rloc_probe_state_reply_t *rmp = 0;
- int rv = 0;
-
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_SHOW_LISP_RLOC_PROBE_STATE_REPLY,
- {
- rmp->is_enabled = vnet_lisp_rloc_probe_state_get ();
- });
- /* *INDENT-ON* */
-}
-
-static void
- vl_api_show_lisp_map_register_state_t_handler
- (vl_api_show_lisp_map_register_state_t * mp)
-{
- vl_api_show_lisp_map_register_state_reply_t *rmp = 0;
- int rv = 0;
-
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_SHOW_LISP_MAP_REGISTER_STATE_REPLY,
- {
- rmp->is_enabled = vnet_lisp_map_register_state_get ();
- });
- /* *INDENT-ON* */
-}
-
-static void
-vl_api_lisp_adjacencies_get_t_handler (vl_api_lisp_adjacencies_get_t * mp)
-{
- vl_api_lisp_adjacencies_get_reply_t *rmp = 0;
- lisp_adjacency_t *adjs = 0;
- int rv = 0;
- vl_api_lisp_adjacency_t a;
- u32 size = ~0;
- u32 vni = clib_net_to_host_u32 (mp->vni);
-
- adjs = vnet_lisp_adjacencies_get_by_vni (vni);
- size = vec_len (adjs) * sizeof (a);
-
- /* *INDENT-OFF* */
- REPLY_MACRO4 (VL_API_LISP_ADJACENCIES_GET_REPLY, size,
- {
- rmp->count = clib_host_to_net_u32 (vec_len (adjs));
- lisp_adjacency_copy (rmp->adjacencies, adjs);
- });
- /* *INDENT-ON* */
-
- vec_free (adjs);
-}
-
-static void
-vl_api_lisp_eid_table_vni_dump_t_handler (vl_api_lisp_eid_table_vni_dump_t *
- mp)
-{
- hash_pair_t *p;
- u32 *vnis = 0;
- unix_shared_memory_queue_t *q = 0;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- /* *INDENT-OFF* */
- hash_foreach_pair (p, lcm->table_id_by_vni,
- ({
- hash_set (vnis, p->key, 0);
- }));
-
- hash_foreach_pair (p, lcm->bd_id_by_vni,
- ({
- hash_set (vnis, p->key, 0);
- }));
-
- hash_foreach_pair (p, vnis,
- ({
- send_eid_table_vni (p->key, q, mp->context);
- }));
- /* *INDENT-ON* */
-
- hash_free (vnis);
-}
-
-static void
-vl_api_show_lisp_status_t_handler (vl_api_show_lisp_status_t * mp)
-{
- unix_shared_memory_queue_t *q = NULL;
- vl_api_show_lisp_status_reply_t *rmp = NULL;
- int rv = 0;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_SHOW_LISP_STATUS_REPLY,
- ({
- rmp->gpe_status = vnet_lisp_gpe_enable_disable_status ();
- rmp->feature_status = vnet_lisp_enable_disable_status ();
- }));
- /* *INDENT-ON* */
-}
-
-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);
- }
-
- /* *INDENT-OFF* */
- 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);
- }));
- /* *INDENT-ON* */
-
- vec_free (tmp_str);
-}
-
-static void
-vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp)
-{
- unix_shared_memory_queue_t *q = NULL;
- vl_api_show_lisp_pitr_reply_t *rmp = NULL;
- lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
- mapping_t *m;
- locator_set_t *ls = 0;
- u8 *tmp_str = 0;
- int rv = 0;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- if (!lcm->lisp_pitr)
- {
- tmp_str = format (0, "N/A");
- }
- else
- {
- m = pool_elt_at_index (lcm->mapping_pool, lcm->pitr_map_index);
- if (~0 != m->locator_set_index)
- {
- ls =
- pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index);
- tmp_str = format (0, "%s", ls->name);
- }
- else
- {
- tmp_str = format (0, "N/A");
- }
- }
- vec_add1 (tmp_str, 0);
-
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_SHOW_LISP_PITR_REPLY,
- ({
- rmp->status = lcm->lisp_pitr;
- strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
- ARRAY_LEN(rmp->locator_set_name) - 1);
- }));
- /* *INDENT-ON* */
-}
-
-static void
vl_api_interface_name_renumber_t_handler (vl_api_interface_name_renumber_t *
mp)
{
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index 52254cd3b3e..9c173653b1d 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -35,6 +35,7 @@
* BFD APIs: see .../vnet/vnet/bfd/{bfd.api, bfd_api.c}
* IPSEC APIs: see .../vnet/vnet/ipsec/{ipsec.api, ipsec_api.c}
* IPSEC-GRE APIs: see .../vnet/vnet/ipsec-gre/{ipsec_gre.api, ipsec_gre_api.c}
+ * LISP APIs: see .../vnet/vnet/lisp/{lisp.api, lisp_api.c}
*/
/** \brief Create a new subinterface with the given vlan id
@@ -1490,115 +1491,6 @@ define l2_fib_table_dump
u32 bd_id;
};
-/** \brief add or delete locator_set
- @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 name
- @param locator_num - number of locators
- @param locators - LISP locator records
- Structure of one locator record is as follows:
-
- define locator_t {
- u32 sw_if_index;
- u8 priority;
- u8 weight;
- }
-*/
-define lisp_add_del_locator_set
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 locator_set_name[64];
- u32 locator_num;
- u8 locators[0];
-};
-
-/** \brief Reply for locator_set add/del
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
- @param ls_index - locator set index
-*/
-define lisp_add_del_locator_set_reply
-{
- u32 context;
- i32 retval;
- u32 ls_index;
-};
-
-/** \brief add or delete locator for locator_set
- @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 - name of locator_set to add/del locator
- @param sw_if_index - index of the interface
- @param priority - priority of the lisp locator
- @param weight - weight of the lisp locator
-*/
-define lisp_add_del_locator
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 locator_set_name[64];
- u32 sw_if_index;
- u8 priority;
- u8 weight;
-};
-
-/** \brief Reply for locator add/del
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_add_del_locator_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief add or delete lisp eid-table
- @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 eid_type:
- 0 : ipv4
- 1 : ipv6
- 2 : mac
- @param eid - EID can be ip4, ip6 or mac
- @param prefix_len - prefix len
- @param locator_set_name - name of locator_set to add/del eid-table
- @param vni - virtual network instance
- @param key_id
- HMAC_NO_KEY 0
- HMAC_SHA_1_96 1
- HMAC_SHA_256_128 2
- @param key - secret key
-*/
-define lisp_add_del_local_eid
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 eid_type;
- u8 eid[16];
- u8 prefix_len;
- u8 locator_set_name[64];
- u32 vni;
- u16 key_id;
- u8 key[64];
-};
-
-/** \brief Reply for local_eid add/del
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_add_del_local_eid_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief add or delete lisp gpe tunnel
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1646,102 +1538,6 @@ define lisp_gpe_add_del_fwd_entry_reply
i32 retval;
};
-/** \brief Add/delete map server
- @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; delete otherwise
- @param is_ipv6 - if non-zero the address is ipv6, else ipv4
- @param ip_address - map server IP address
-*/
-define lisp_add_del_map_server
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 is_ipv6;
- u8 ip_address[16];
-};
-
-/** \brief Reply for lisp_add_del_map_server
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_add_del_map_server_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief add or delete map-resolver
- @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 is_ipv6 - if non-zero the address is ipv6, else ipv4
- @param ip_address - array of address bytes
-*/
-define lisp_add_del_map_resolver
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 is_ipv6;
- u8 ip_address[16];
-};
-
-/** \brief Reply for map_resolver add/del
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_add_del_map_resolver_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief enable or disable lisp-gpe protocol
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_en - enable protocol if non-zero, else disable
-*/
-define lisp_gpe_enable_disable
-{
- u32 client_index;
- u32 context;
- u8 is_en;
-};
-
-/** \brief Reply for gpe enable/disable
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_gpe_enable_disable_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief enable or disable LISP feature
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_en - enable protocol if non-zero, else disable
-*/
-define lisp_enable_disable
-{
- u32 client_index;
- u32 context;
- u8 is_en;
-};
-
-/** \brief Reply for gpe enable/disable
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_enable_disable_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief add or delete gpe_iface
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1767,530 +1563,6 @@ define lisp_gpe_add_del_iface_reply
i32 retval;
};
-/** \brief configure or disable LISP PITR node
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param ls_name - locator set name
- @param is_add - add locator set if non-zero, else disable pitr
-*/
-define lisp_pitr_set_locator_set
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 ls_name[64];
-};
-
-/** \brief Reply for lisp_pitr_set_locator_set
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_pitr_set_locator_set_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief Get state of LISP RLOC probing
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-define show_lisp_rloc_probe_state
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief Reply for show_lisp_rloc_probe_state
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
- @param is_enabled - state of RLOC probing
-*/
-define show_lisp_rloc_probe_state_reply
-{
- u32 context;
- i32 retval;
- u8 is_enabled;
-};
-
-/** \brief enable/disable LISP RLOC probing
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_enable - enable if non-zero; disable otherwise
-*/
-define lisp_rloc_probe_enable_disable
-{
- u32 client_index;
- u32 context;
- u8 is_enabled;
-};
-
-/** \brief Reply for lisp_rloc_probe_enable_disable
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_rloc_probe_enable_disable_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief enable/disable LISP map-register
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_enable - enable if non-zero; disable otherwise
-*/
-define lisp_map_register_enable_disable
-{
- u32 client_index;
- u32 context;
- u8 is_enabled;
-};
-
-/** \brief Reply for lisp_map_register_enable_disable
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_map_register_enable_disable_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief Get state of LISP map-register
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-define show_lisp_map_register_state
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief Reply for show_lisp_map_register_state
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define show_lisp_map_register_state_reply
-{
- u32 context;
- i32 retval;
- u8 is_enabled;
-};
-
-/** \brief set LISP map-request mode. Based on configuration VPP will send
- src/dest or just normal destination map requests.
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param mode - new map-request mode. Supported values are:
- 0 - destination only
- 1 - source/destaination
-*/
-define lisp_map_request_mode
-{
- u32 client_index;
- u32 context;
- u8 mode;
-};
-
-/** \brief Reply for lisp_map_request_mode
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_map_request_mode_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief Request for LISP map-request mode
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-define show_lisp_map_request_mode
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief Reply for show_lisp_map_request_mode
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
- @param mode - map-request mode
-*/
-define show_lisp_map_request_mode_reply
-{
- u32 context;
- i32 retval;
- u8 mode;
-};
-
-/** \brief add or delete remote static mapping
- @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 is_src_dst - flag indicating src/dst based routing policy
- @param del_all - if set, delete all remote mappings
- @param vni - virtual network instance
- @param action - negative map-reply action
- @param eid_type -
- 0 : ipv4
- 1 : ipv6
- 2 : mac
- @param deid - dst EID
- @param seid - src EID, valid only if is_src_dst is enabled
- @param rloc_num - number of remote locators
- @param rlocs - remote locator records
- Structure of remote locator:
-
- define rloc_t {
- u8 is_ip4;
- u8 priority;
- u8 weight;
- u8 addr[16];
- }
-*/
-define lisp_add_del_remote_mapping
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u8 is_src_dst;
- u8 del_all;
- u32 vni;
- u8 action;
- u8 eid_type;
- u8 eid[16];
- u8 eid_len;
- u8 seid[16];
- u8 seid_len;
- u32 rloc_num;
- u8 rlocs[0];
-};
-
-/** \brief Reply for lisp_add_del_remote_mapping
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_add_del_remote_mapping_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief add or delete LISP adjacency adjacency
- @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 vni - virtual network instance
- @param eid_type -
- 0 : ipv4
- 1 : ipv6
- 2 : mac
- @param reid - remote EID
- @param leid - local EID
-*/
-define lisp_add_del_adjacency
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u32 vni;
- u8 eid_type;
- u8 reid[16];
- u8 leid[16];
- u8 reid_len;
- u8 leid_len;
-};
-
-/** \brief Reply for lisp_add_del_adjacency
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_add_del_adjacency_reply
-{
- u32 context;
- 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 map/unmap vni/bd_index to vrf
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_add - add or delete mapping
- @param dp_table - virtual network id/bridge domain index
- @param vrf - vrf
-*/
-define lisp_eid_table_add_del_map
-{
- u32 client_index;
- u32 context;
- u8 is_add;
- u32 vni;
- u32 dp_table;
- u8 is_l2;
-};
-
-/** \brief Reply for lisp_eid_table_add_del_map
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define lisp_eid_table_add_del_map_reply
-{
- u32 context;
- i32 retval;
-};
-
-/** \brief Request for map lisp locator status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param locator_set_index - index of locator_set
- @param ls_name - locator set name
- @param is_index_set - flag indicating whether ls_name or ls_index is set
- */
-define lisp_locator_dump
-{
- u32 client_index;
- u32 context;
- u32 ls_index;
- u8 ls_name[64];
- u8 is_index_set;
-};
-
-/** \brief LISP locator_set status
- @param local - if is set, then locator is local
- @param locator_set_name - name of the locator_set
- @param sw_if_index - sw_if_index of the locator
- @param priority - locator priority
- @param weight - locator weight
- */
-define lisp_locator_details
-{
- u32 context;
- u8 local;
- u32 sw_if_index;
- u8 is_ipv6;
- u8 ip_address[16];
- u8 priority;
- u8 weight;
-};
-
-/** \brief LISP locator_set status
- @param context - sender context, to match reply w/ request
- @param ls_index - locator set index
- @param ls_name - name of the locator set
- */
-define lisp_locator_set_details
-{
- u32 context;
- u32 ls_index;
- u8 ls_name[64];
-};
-
-/** \brief Request for locator_set summary status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param filter - filter type
- Supported values:
- 0: all locator sets
- 1: local locator sets
- 2: remote locator sets
- */
-define lisp_locator_set_dump
-{
- u32 client_index;
- u32 context;
- u8 filter;
-};
-
-/** \brief Dump lisp eid-table
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param locator_set_index - index of locator_set, if ~0 then the mapping
- is negative
- @param action - negative map request action
- @param is_local - local if non-zero, else remote
- @param eid_type:
- 0 : ipv4
- 1 : ipv6
- 2 : mac
- @param is_src_dst - EID is type of source/destination
- @param eid - EID can be ip4, ip6 or mac
- @param eid_prefix_len - prefix length
- @param seid - source EID can be ip4, ip6 or mac
- @param seid_prefix_len - source prefix length
- @param vni - virtual network instance
- @param ttl - time to live
- @param authoritative - authoritative
- @param key_id
- HMAC_NO_KEY 0
- HMAC_SHA_1_96 1
- HMAC_SHA_256_128 2
- @param key - secret key
-*/
-
-define lisp_eid_table_details
-{
- u32 context;
- u32 locator_set_index;
- u8 action;
- u8 is_local;
- u8 eid_type;
- u8 is_src_dst;
- u32 vni;
- u8 eid[16];
- u8 eid_prefix_len;
- u8 seid[16];
- u8 seid_prefix_len;
- u32 ttl;
- u8 authoritative;
- u16 key_id;
- u8 key[64];
-};
-
-/** \brief Request for eid table summary status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param eid_set - if non-zero request info about specific mapping
- @param vni - virtual network instance; valid only if eid_set != 0
- @param prefix_length - prefix length if EID is IP address;
- valid only if eid_set != 0
- @param eid_type - EID type; valid only if eid_set != 0
- Supported values:
- 0: EID is IPv4
- 1: EID is IPv6
- 2: EID is ethernet address
- @param eid - endpoint identifier
- @param filter - filter type;
- Support values:
- 0: all eid
- 1: local eid
- 2: remote eid
- */
-define lisp_eid_table_dump
-{
- u32 client_index;
- u32 context;
- u8 eid_set;
- u8 prefix_length;
- u32 vni;
- u8 eid_type;
- u8 eid[16];
- u8 filter;
-};
-
-/** \brief LISP adjacency
- @param eid_type -
- 0 : ipv4
- 1 : ipv6
- 2 : mac
- @param reid - remote EID
- @param leid - local EID
- @param reid_prefix_len - remote EID IP prefix length
- @param leid_prefix_len - local EID IP prefix length
- */
-typeonly manual_print manual_endian define lisp_adjacency
-{
- u8 eid_type;
- u8 reid[16];
- u8 leid[16];
- u8 reid_prefix_len;
- u8 leid_prefix_len;
-};
-
-/** \brief LISP adjacency reply
- @param count - number of adjacencies
- @param adjacencies - array of adjacencies
- */
-manual_endian manual_print define lisp_adjacencies_get_reply
-{
- u32 context;
- i32 retval;
- u32 count;
- vl_api_lisp_adjacency_t adjacencies[count];
-};
-
-/** \brief Request for LISP adjacencies
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param vni - filter adjacencies by VNI
- */
-define lisp_adjacencies_get
-{
- u32 client_index;
- u32 context;
- u32 vni;
-};
-
-/** \brief Shows relationship between vni and vrf/bd
- @param dp_table - VRF index or bridge domain index
- @param vni - vitual network instance
- */
-define lisp_eid_table_map_details
-{
- u32 context;
- u32 vni;
- u32 dp_table;
-};
-
-/** \brief Request for lisp_eid_table_map_details
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param is_l2 - if set dump vni/bd mappings else vni/vrf
- */
-define lisp_eid_table_map_dump
-{
- u32 client_index;
- u32 context;
- u8 is_l2;
-};
-
-/** \brief Dumps all VNIs used in mappings
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- */
-define lisp_eid_table_vni_dump
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief reply to lisp_eid_table_vni_dump
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param vni - virtual network instance
- */
-define lisp_eid_table_vni_details
-{
- u32 client_index;
- u32 context;
- u32 vni;
-};
-
define lisp_gpe_tunnel_details
{
u32 context;
@@ -2319,113 +1591,6 @@ define lisp_gpe_tunnel_dump
u32 context;
};
-/** \brief LISP map resolver status
- @param is_ipv6 - if non-zero the address is ipv6, else ipv4
- @param ip_address - array of address bytes
- */
-define lisp_map_resolver_details
-{
- u32 context;
- u8 is_ipv6;
- u8 ip_address[16];
-};
-
-/** \brief Request for map resolver summary status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- */
-define lisp_map_resolver_dump
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief LISP map server details
- @param is_ipv6 - if non-zero the address is ipv6, else ipv4
- @param ip_address - array of address bytes
- */
-define lisp_map_server_details
-{
- u32 context;
- u8 is_ipv6;
- u8 ip_address[16];
-};
-
-/** \brief Request for map server summary status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- */
-define lisp_map_server_dump
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief Request for lisp-gpe protocol status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-define show_lisp_status
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief Status of lisp, enable or disable
- @param context - sender context, to match reply w/ request
- @param feature_status - lisp enable if non-zero, else disable
- @param gpe_status - lisp enable if non-zero, else disable
-*/
-define show_lisp_status_reply
-{
- u32 context;
- i32 retval;
- u8 feature_status;
- u8 gpe_status;
-};
-
-/** \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];
-};
-
-/** \brief Request for lisp pitr status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-define show_lisp_pitr
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief Status of lisp pitr, enable or disable
- @param context - sender context, to match reply w/ request
- @param status - lisp pitr enable if non-zero, else disable
- @param locator_set_name - name of the locator_set
-*/
-define show_lisp_pitr_reply
-{
- u32 context;
- i32 retval;
- u8 status;
- u8 locator_set_name[64];
-};
-
/* Gross kludge, DGMS */
define interface_name_renumber
{