aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/control.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-02-15 16:40:35 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-02-16 08:09:56 +0000
commit272c69eb0d8a0ef000ef6d94ee38bdd8009b13ed (patch)
tree082ec96b18ba8f6bdcb3d9a554dc7d1c31b98bde /src/vnet/lisp-cp/control.c
parentf3fe820fd840173df2571a49c929a7f193b68508 (diff)
LISP: minor enhacements
* use RLOC for IP version detection * don't check whether RLOC is local when deleting Change-Id: Icdb84025dd5511eb5348b654bf7b373def15406c Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/lisp-cp/control.c')
-rw-r--r--src/vnet/lisp-cp/control.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c
index f0383e16..66b560e4 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/vnet/lisp-cp/control.c
@@ -1038,18 +1038,6 @@ vnet_lisp_add_del_mapping (gid_address_t * eid, locator_t * rlocs, u8 action,
return VNET_API_ERROR_LISP_DISABLED;
}
- /* check if none of the locators match localy configured address */
- vec_foreach (loc, rlocs)
- {
- ip_prefix_t *p = &gid_address_ippref (&loc->address);
- if (is_local_ip (lcm, &ip_prefix_addr (p)))
- {
- clib_warning ("RLOC %U matches a local address!",
- format_gid_address, &loc->address);
- return VNET_API_ERROR_LISP_RLOC_LOCAL;
- }
- }
-
if (res_map_index)
res_map_index[0] = ~0;
@@ -1063,6 +1051,18 @@ vnet_lisp_add_del_mapping (gid_address_t * eid, locator_t * rlocs, u8 action,
if (is_add)
{
+ /* check if none of the locators match localy configured address */
+ vec_foreach (loc, rlocs)
+ {
+ ip_prefix_t *p = &gid_address_ippref (&loc->address);
+ if (is_local_ip (lcm, &ip_prefix_addr (p)))
+ {
+ clib_warning ("RLOC %U matches a local address!",
+ format_gid_address, &loc->address);
+ return VNET_API_ERROR_LISP_RLOC_LOCAL;
+ }
+ }
+
/* overwrite: if mapping already exists, decide if locators should be
* updated and be done */
if (old_map && gid_address_cmp (&old_map->eid, eid) == 0)
@@ -2313,7 +2313,7 @@ send_rloc_probe (lisp_cp_main_t * lcm, gid_address_t * deid,
vnet_buffer (b)->sw_if_index[VLIB_TX] = 0;
- next_index = (ip_addr_version (&lcm->active_map_resolver) == IP4) ?
+ next_index = (ip_addr_version (rloc) == IP4) ?
ip4_lookup_node.index : ip6_lookup_node.index;
f = vlib_get_frame_to_node (lcm->vlib_main, next_index);