Fix new LISP Coverity warnings

Change-Id: I60ef5218110e596f77d11e3949284a7a7af7dedb
Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:
Florin Coras
2016-08-01 15:35:20 +02:00
committed by Chris Luke
parent cb34a1fb3b
commit f7643fd9e1
3 changed files with 11 additions and 24 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);
}