aboutsummaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2016-07-10 20:09:32 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2016-07-11 23:02:43 +0000
commit71893ac8b765dd997452fc58aedb6e0bd7b79a25 (patch)
tree5cbc8afaeec4333e556cfb0b93543181c699b961 /vpp
parentefc33309594bc1e13dd30534b7658191c2abbca7 (diff)
Simplify API to add LISP adjacencies
The API to add an adjacency requires that two things be provided 1) a local and a remote eid 2) the whole remote mapping for the remote eid. Since the API to add remote mappings can be used for 2), 1) in combination with this API are enough to add an adjacency. Change-Id: Ibe7474924bc3f28b6aed19cefa78fdb812de5eac Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/vpp-api/api.c63
-rw-r--r--vpp/vpp-api/vpe.api6
2 files changed, 18 insertions, 51 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 1f415ce4..4d4c71c6 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -5097,29 +5097,24 @@ vl_api_lisp_add_del_remote_mapping_t_handler (
vec_add1 (rlocs, rloc);
}
- /* TODO Uncomment once https://gerrit.fd.io/r/#/c/1802 is merged and CSIT
- * is switched to lisp_add_del_adjacency */
-// if (!mp->is_add) {
-// vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
-// gid_address_copy(&a->deid, deid);
-// a->is_add = 0;
-// rv = vnet_lisp_add_del_adjacency (a);
-// } else {
-// /* NOTE: for now this works as a static remote mapping, i.e.,
-// * not authoritative and ttl infinite. */
-// rv = vnet_lisp_add_del_mapping (deid, rlocs, mp->action, 0, ~0,
-// mp->is_add, 0);
-// }
-
- /* TODO: remove once the above is merged */
- vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
- a->is_add = mp->is_add;
- a->authoritative = 0;
- a->action = mp->action;
- a->locators = rlocs;
- gid_address_copy(&a->seid, seid);
- gid_address_copy(&a->deid, deid);
- rv = vnet_lisp_add_del_adjacency (a);
+ if (!mp->is_add) {
+ vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
+ gid_address_copy(&a->deid, deid);
+ a->is_add = 0;
+ rv = vnet_lisp_add_del_adjacency (a);
+ } else {
+ /* NOTE: for now this works as a static remote mapping, i.e.,
+ * not authoritative and ttl infinite. */
+ rv = vnet_lisp_add_del_mapping (deid, rlocs, mp->action, 0, ~0,
+ mp->is_add, 0);
+
+ /* TODO remove once CSIT switched to lisp_add_del_adjacency */
+ vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
+ gid_address_copy(&a->seid, seid);
+ gid_address_copy(&a->deid, deid);
+ a->is_add = 1;
+ vnet_lisp_add_del_adjacency (a);
+ }
if (mp->del_all)
vnet_lisp_clear_all_remote_adjacencies ();
@@ -5133,8 +5128,6 @@ static void
vl_api_lisp_add_del_adjacency_t_handler (
vl_api_lisp_add_del_adjacency_t *mp)
{
- u32 i;
- locator_t rloc;
vl_api_lisp_add_del_adjacency_reply_t * rmp;
vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
@@ -5178,29 +5171,9 @@ vl_api_lisp_add_del_adjacency_t_handler (
goto send_reply;
}
- for (i = 0; i < mp->rloc_num; i++) {
- rloc_t * r = &((rloc_t *) mp->rlocs)[i];
- memset(&rloc, 0, sizeof(rloc));
- ip_address_set(&gid_address_ip(&rloc.address), &r->addr,
- r->is_ip4 ? IP4 : IP6);
- gid_address_ippref_len(&rloc.address) = r->is_ip4 ? 32: 128;
- gid_address_type(&rloc.address) = GID_ADDR_IP_PREFIX;
- rloc.priority = r->priority;
- rloc.weight = r->weight;
- vec_add1 (a->locators, rloc);
- }
-
- a->action = mp->action;
a->is_add = mp->is_add;
-
- /* NOTE: the remote mapping is static, i.e., not authoritative and
- * ttl is infinite. */
- a->authoritative = 0;
- a->ttl = ~0;
-
rv = vnet_lisp_add_del_adjacency (a);
- vec_free (a->locators);
send_reply:
REPLY_MACRO(VL_API_LISP_ADD_DEL_ADJACENCY_REPLY);
}
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index e36240f4..63ca8477 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -2417,29 +2417,23 @@ define lisp_add_del_remote_mapping_reply {
@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 mapping action
@param eid_type -
0 : ipv4
1 : ipv6
2 : mac
@param deid - destination EID
@param seid - source EID
- @param rloc_num - number of remote locators
- @param rlocs - remote locator data
*/
define lisp_add_del_adjacency {
u32 client_index;
u32 context;
u8 is_add;
u32 vni;
- u8 action;
u8 eid_type;
u8 deid[16];
u8 seid[16];
u8 deid_len;
u8 seid_len;
- u32 rloc_num;
- u8 rlocs[0];
};
/** \brief Reply for lisp_add_del_adjacency