diff options
author | 2016-07-10 20:09:32 +0200 | |
---|---|---|
committer | 2016-07-11 23:02:43 +0000 | |
commit | 71893ac8b765dd997452fc58aedb6e0bd7b79a25 (patch) | |
tree | 5cbc8afaeec4333e556cfb0b93543181c699b961 /vpp/vpp-api/api.c | |
parent | efc33309594bc1e13dd30534b7658191c2abbca7 (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/vpp-api/api.c')
-rw-r--r-- | vpp/vpp-api/api.c | 63 |
1 files changed, 18 insertions, 45 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); } |