aboutsummaryrefslogtreecommitdiffstats
path: root/vpp/api
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-05-13 17:37:35 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-05-15 15:02:51 +0000
commit195bceec5685cb367519e37f22b36f5f99819827 (patch)
treec2b2a67bf18647986d36bf81d46e7434b392ba04 /vpp/api
parent75a37b372efc2b4a324aa38b53487b8168358a63 (diff)
ONE-13: Add CLI/API for LISP static remote mappings
Change-Id: Ic4c717af9629541bac0a0e6c65d0157619c8f578 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vpp/api')
-rw-r--r--vpp/api/api.c64
-rw-r--r--vpp/api/vpe.api37
2 files changed, 101 insertions, 0 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c
index 24f7d9c0..0d5f2241 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -326,6 +326,7 @@ _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
_(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable) \
_(LISP_ENABLE_DISABLE, lisp_enable_disable) \
_(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface) \
+_(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
_(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump) \
_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
@@ -4823,6 +4824,13 @@ vl_api_lisp_gpe_add_del_iface_t_handler(
REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
}
+/** Used for transferring locators via VPP API */
+typedef CLIB_PACKED(struct
+{
+ u8 is_ip4; /**< is locator an IPv4 address */
+ u8 addr[16]; /**< IPv4/IPv6 address */
+}) rloc_t;
+
static void
send_lisp_locator_set_details_set_address
(vl_api_lisp_locator_set_details_t *rmp,
@@ -4841,6 +4849,62 @@ send_lisp_locator_set_details_set_address
}
static void
+vl_api_lisp_add_del_remote_mapping_t_handler (
+ vl_api_lisp_add_del_remote_mapping_t *mp)
+{
+ u32 i;
+ ip_address_t rloc, * rlocs = 0;
+ vl_api_lisp_add_del_remote_mapping_reply_t * rmp;
+ int rv = 0;
+ gid_address_t _seid, * seid = &_seid;
+ gid_address_t _deid, * deid = &_deid;
+ ip_prefix_t * seid_pref = &gid_address_ippref(seid);
+ ip_prefix_t * deid_pref = &gid_address_ippref(deid);
+
+ gid_address_type(seid) = GID_ADDR_IP_PREFIX;
+ gid_address_type(deid) = GID_ADDR_IP_PREFIX;
+ ip_address_t * seid_addr = &ip_prefix_addr(seid_pref);
+ ip_address_t * deid_addr = &ip_prefix_addr(deid_pref);
+ ip_prefix_len(seid_pref) = mp->seid_len;
+ ip_prefix_len(deid_pref) = mp->deid_len;
+ gid_address_set_vni (seid, ntohl (mp->vni));
+ gid_address_set_vni (deid, ntohl (mp->vni));
+
+ if (mp->eid_is_ip4) {
+ ip_prefix_version(seid_pref) = IP4;
+ ip_prefix_version(deid_pref) = IP4;
+ clib_memcpy (&ip_addr_v4(seid_addr),
+ mp->seid, sizeof (ip_addr_v4(seid_addr)));
+ clib_memcpy (&ip_addr_v4(deid_addr),
+ mp->deid, sizeof (ip_addr_v4(deid_addr)));
+ } else {
+ ip_prefix_version(seid_pref) = IP6;
+ ip_prefix_version(deid_pref) = IP6;
+ clib_memcpy (&ip_addr_v6(seid_addr),
+ mp->seid, sizeof (ip_addr_v6(seid_addr)));
+ clib_memcpy (&ip_addr_v6(deid_addr),
+ mp->deid, sizeof (ip_addr_v6(deid_addr)));
+ }
+
+ for (i = 0; i < mp->rloc_num; i++) {
+ rloc_t * r = &((rloc_t *) mp->rlocs)[i];
+ if (r->is_ip4) {
+ clib_memcpy (&ip_addr_v4(&rloc), &r->addr, sizeof (rloc_t));
+ ip_addr_version (&rloc) = IP4;
+ } else {
+ clib_memcpy (&ip_addr_v6(&rloc), &r->addr, sizeof (rloc_t));
+ ip_addr_version (&rloc) = IP6;
+ }
+ vec_add1 (rlocs, rloc);
+ }
+
+ rv = vnet_lisp_add_del_remote_mapping (deid, seid, rlocs,
+ mp->action, mp->is_add);
+ vec_free (rlocs);
+ REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
+}
+
+static void
send_lisp_locator_set_details (lisp_cp_main_t *lcm,
locator_set_t *lsit,
unix_shared_memory_queue_t *q,
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index fadecfb1..df3b2af0 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -2377,6 +2377,43 @@ define lisp_gpe_add_del_iface_reply {
i32 retval;
};
+/** \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 vni - virtual network instance
+ @param action - negative map-reply action
+ @param eid_is_ip4 - ipv4/6 of source and destination EIDs
+ @param deid - destination EID
+ @param seid - source EID
+ @param rloc_num - number of remote locators
+ @param rlocs - remote locator data
+*/
+define lisp_add_del_remote_mapping {
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ u32 vni;
+ u8 action;
+ u8 eid_is_ip4;
+ u8 deid[16];
+ u8 seid[16];
+ u8 deid_len;
+ 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 LISP locator_set status
@param locator_set_name - name of the locator_set
@param sw_if_index - sw_if_index of the locator