From 2743cc40de083389e594b7c871ba9c90169358f7 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Sun, 29 Jan 2017 16:42:20 -0800 Subject: Fix LISP Coverity warnings Change-Id: Iaca2ff453872e638ee83b11fc16472e44deb9a7e Signed-off-by: Florin Coras --- src/vnet/lisp-cp/control.c | 1 + src/vnet/lisp-cp/lisp_api.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/vnet/lisp-cp') diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c index c3406d8c..8d37cabc 100644 --- a/src/vnet/lisp-cp/control.c +++ b/src/vnet/lisp-cp/control.c @@ -1321,6 +1321,7 @@ vnet_lisp_use_petr (ip_address_t * ip, u8 is_add) gid_address_from_ip (&loc.address, ip); loc.priority = 1; loc.state = loc.weight = 1; + loc.local = 0; ls_args->is_add = 1; ls_args->index = ~0; diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c index 767f4c6f..6f34d02c 100644 --- a/src/vnet/lisp-cp/lisp_api.c +++ b/src/vnet/lisp-cp/lisp_api.c @@ -422,7 +422,9 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp) mapping_t *m; locator_set_t *ls = 0; int rv = 0; - locator_t *loc; + locator_t *loc = 0; + u8 status = 0; + gid_address_t addr; q = vl_api_client_index_to_input_queue (mp->client_index); if (q == 0) @@ -430,8 +432,9 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp) return; } - rmp->status = lcm->flags & LISP_FLAG_USE_PETR; - if (rmp->status) + memset (&addr, 0, sizeof (addr)); + status = lcm->flags & LISP_FLAG_USE_PETR; + if (status) { m = pool_elt_at_index (lcm->mapping_pool, lcm->petr_map_index); if (~0 != m->locator_set_index) @@ -439,12 +442,18 @@ vl_api_show_lisp_use_petr_t_handler (vl_api_show_lisp_use_petr_t * mp) ls = pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index); loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]); - gid_address_put (rmp->address, &loc->address); - rmp->is_ip4 = (gid_address_ip_version (&loc->address) == IP4); + gid_address_copy (&addr, &loc->address); } } - REPLY_MACRO (VL_API_SHOW_LISP_USE_PETR_REPLY); + /* *INDENT-OFF* */ + REPLY_MACRO2 (VL_API_SHOW_LISP_USE_PETR_REPLY, + { + rmp->status = status; + gid_address_put (rmp->address, &addr); + rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4); + }); + /* *INDENT-ON* */ } static void -- cgit 1.2.3-korg