summaryrefslogtreecommitdiffstats
path: root/vpp/vpp-api/api.c
diff options
context:
space:
mode:
authorAndrej Kozemcak <akozemca@cisco.com>2016-07-22 12:54:12 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-07-28 10:52:34 +0000
commit438109d576bd47a2095f2889b708306d37067d50 (patch)
treea9f4f2e2afe9904a913b9b00f32a76bcacf78dd0 /vpp/vpp-api/api.c
parentd983118bf6a5c5f09941946083e654f994b579fb (diff)
LISP - Bug fix, can`t remove static remote mapping
Fix bug, can`t remove static remote mapping, small update in LISP remote mapping API. Change-Id: Ide32485a1a0d2cf08829d544500fa2755214b8cc Signed-off-by: Andrej Kozemcak <akozemca@cisco.com>
Diffstat (limited to 'vpp/vpp-api/api.c')
-rw-r--r--vpp/vpp-api/api.c74
1 files changed, 33 insertions, 41 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 1f630651..c06045f7 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -4902,11 +4902,13 @@ vl_api_lisp_add_del_local_eid_t_handler(
gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
ip_address_set(ip_eid, mp->eid, IP4);
ip_prefix_len(prefp) = mp->prefix_len;
+ ip_prefix_normalize(prefp);
break;
case 1: /* ipv6 */
gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
ip_address_set(ip_eid, mp->eid, IP6);
ip_prefix_len(prefp) = mp->prefix_len;
+ ip_prefix_normalize(prefp);
break;
case 2: /* l2 mac */
gid_address_type (&eid) = GID_ADDR_MAC;
@@ -4974,6 +4976,7 @@ lisp_gpe_add_del_fwd_entry_set_address(
ip_addr_version(ip_eid) = IP4;
}
ip_prefix_len(prefp) = mp->eid_prefix_len;
+ ip_prefix_normalize(prefp);
if (mp->address_is_ipv6) {
clib_memcpy(&ip_addr_v6(slocator), mp->source_ip_address,
@@ -5136,42 +5139,30 @@ vl_api_lisp_add_del_remote_mapping_t_handler (
locator_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);
-
- /* TODO remove seid from API */
- memset (seid, 0, sizeof (seid[0]));
- memset (deid, 0, sizeof (deid[0]));
- 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;
- u8 * seid_mac = gid_address_mac (seid);
- u8 * deid_mac = gid_address_mac (deid);
- gid_address_vni (seid) = ntohl (mp->vni);
- gid_address_vni (deid) = ntohl (mp->vni);
+ gid_address_t _eid, * eid = &_eid;
+ ip_prefix_t * eid_pref = &gid_address_ippref(eid);
+
+ memset (eid, 0, sizeof (eid[0]));
+ ip_address_t * eid_addr = &ip_prefix_addr(eid_pref);
+ ip_prefix_len(eid_pref) = mp->eid_len;
+ u8 * eid_mac = gid_address_mac (eid);
+ gid_address_vni (eid) = ntohl (mp->vni);
switch (mp->eid_type)
{
case 0: /* ipv4 */
- gid_address_type(seid) = GID_ADDR_IP_PREFIX;
- gid_address_type(deid) = GID_ADDR_IP_PREFIX;
- ip_address_set (seid_addr, mp->seid, IP4);
- ip_address_set (deid_addr, mp->deid, IP4);
+ gid_address_type(eid) = GID_ADDR_IP_PREFIX;
+ ip_address_set (eid_addr, mp->eid, IP4);
+ ip_prefix_normalize (eid_pref);
break;
case 1: /* ipv6 */
- gid_address_type(seid) = GID_ADDR_IP_PREFIX;
- gid_address_type(deid) = GID_ADDR_IP_PREFIX;
- ip_address_set (seid_addr, mp->seid, IP6);
- ip_address_set (deid_addr, mp->deid, IP6);
+ gid_address_type(eid) = GID_ADDR_IP_PREFIX;
+ ip_address_set (eid_addr, mp->eid, IP6);
+ ip_prefix_normalize (eid_pref);
break;
case 2: /* l2 mac */
- gid_address_type(seid) = GID_ADDR_MAC;
- gid_address_type(deid) = GID_ADDR_MAC;
- clib_memcpy (seid_mac, mp->seid, 6);
- clib_memcpy (deid_mac, mp->deid, 6);
+ gid_address_type(eid) = GID_ADDR_MAC;
+ clib_memcpy (eid_mac, mp->eid, 6);
break;
default:
rv = VNET_API_ERROR_INVALID_EID_TYPE;
@@ -5192,26 +5183,23 @@ vl_api_lisp_add_del_remote_mapping_t_handler (
if (!mp->is_add) {
vnet_lisp_add_del_adjacency_args_t _a, * a = &_a;
- gid_address_copy(&a->deid, deid);
+ gid_address_copy(&a->deid, eid);
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 (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, 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);
@@ -5246,12 +5234,16 @@ vl_api_lisp_add_del_adjacency_t_handler (
gid_address_type(&a->deid) = GID_ADDR_IP_PREFIX;
ip_address_set (seid_addr, mp->seid, IP4);
ip_address_set (deid_addr, mp->deid, IP4);
+ ip_prefix_normalize (seid_pref);
+ ip_prefix_normalize (deid_pref);
break;
case 1: /* ipv6 */
gid_address_type(&a->seid) = GID_ADDR_IP_PREFIX;
gid_address_type(&a->deid) = GID_ADDR_IP_PREFIX;
ip_address_set (seid_addr, mp->seid, IP6);
ip_address_set (deid_addr, mp->deid, IP6);
+ ip_prefix_normalize (seid_pref);
+ ip_prefix_normalize (deid_pref);
break;
case 2: /* l2 mac */
gid_address_type(&a->seid) = GID_ADDR_MAC;