summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/lisp-cp/control.c22
-rw-r--r--vnet/vnet/lisp-cp/lisp_types.c8
-rw-r--r--vnet/vnet/lisp-gpe/interface.c5
3 files changed, 11 insertions, 24 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c
index 5ef7889d2a7..b2a009e5f46 100644
--- a/vnet/vnet/lisp-cp/control.c
+++ b/vnet/vnet/lisp-cp/control.c
@@ -971,7 +971,6 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
gid_address_t eid;
u8 * dmac = gid_address_mac (&eid);
u8 eid_set = 0;
- u8 * s = 0;
u32 vni, action = ~0, p, w;
int rv;
@@ -1024,22 +1023,9 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
vec_add1 (rlocs, rloc);
curr_rloc = &rlocs[vec_len (rlocs) - 1];
}
- else if (unformat (line_input, "action %s", &s))
- {
- if (!strcmp ((char *)s, "no-action"))
- action = LISP_NO_ACTION;
- if (!strcmp ((char *)s, "natively-forward"))
- action = LISP_FORWARD_NATIVE;
- if (!strcmp ((char *)s, "send-map-request"))
- action = LISP_SEND_MAP_REQUEST;
- else if (!strcmp ((char *)s, "drop"))
- action = LISP_DROP;
- else
- {
- clib_warning ("invalid action: '%s'", s);
- goto done;
- }
- }
+ else if (unformat (line_input, "action %U",
+ unformat_negative_mapping_action, &action))
+ ;
else
{
clib_warning ("parse error");
@@ -1093,8 +1079,6 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
done:
vec_free (rlocs);
unformat_free (line_input);
- if (s)
- vec_free (s);
return error;
}
diff --git a/vnet/vnet/lisp-cp/lisp_types.c b/vnet/vnet/lisp-cp/lisp_types.c
index f0926594c2b..196010e2556 100644
--- a/vnet/vnet/lisp-cp/lisp_types.c
+++ b/vnet/vnet/lisp-cp/lisp_types.c
@@ -238,13 +238,11 @@ unformat_negative_mapping_action (unformat_input_t * input, va_list * args)
if (unformat (input, "%s", &s))
{
- int len = vec_len(s);
- clib_warning ("len = %d", len);
if (!strcmp ((char *) s, "no-action"))
action[0] = LISP_NO_ACTION;
- if (!strcmp ((char *) s, "natively-forward"))
+ else if (!strcmp ((char *) s, "natively-forward"))
action[0] = LISP_FORWARD_NATIVE;
- if (!strcmp ((char *) s, "send-map-request"))
+ else if (!strcmp ((char *) s, "send-map-request"))
action[0] = LISP_SEND_MAP_REQUEST;
else if (!strcmp ((char *) s, "drop"))
action[0] = LISP_DROP;
@@ -252,12 +250,12 @@ unformat_negative_mapping_action (unformat_input_t * input, va_list * args)
{
clib_warning("invalid action: '%s'", s);
action[0] = LISP_DROP;
- return 0;
}
}
else
return 0;
+ vec_free(s);
return 1;
}
diff --git a/vnet/vnet/lisp-gpe/interface.c b/vnet/vnet/lisp-gpe/interface.c
index 1f40ea86bbf..77ad9a33171 100644
--- a/vnet/vnet/lisp-gpe/interface.c
+++ b/vnet/vnet/lisp-gpe/interface.c
@@ -832,6 +832,11 @@ remove_lisp_gpe_iface (lisp_gpe_main_t * lgm, u32 hi_index, u32 dp_table,
/* clean tunnel termination and vni to sw_if_index binding */
vnip = hash_get(tuns->vni_by_sw_if_index, hi->sw_if_index);
+ if (0 == vnip)
+ {
+ clib_warning ("No vni associated to interface %d", hi->sw_if_index);
+ return;
+ }
hash_unset(tuns->sw_if_index_by_vni, vnip[0]);
hash_unset(tuns->vni_by_sw_if_index, hi->sw_if_index);
}