ip: do not return uninitialized IPv6 ll attributes
Type: fix
Change-Id: If35cf7da0c3d1b92532cc2e45c164d6b5a08592c
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/vnet/ip/ip6_link.c b/src/vnet/ip/ip6_link.c
index 082033a..0527b2f 100644
--- a/src/vnet/ip/ip6_link.c
+++ b/src/vnet/ip/ip6_link.c
@@ -319,9 +319,10 @@
{
const ip6_link_t *il;
- vec_validate (ip6_links, sw_if_index);
+ il = ip6_link_get (sw_if_index);
- il = &ip6_links[sw_if_index];
+ if (NULL == il)
+ return (NULL);
return (&il->il_ll_addr);
}
@@ -331,7 +332,10 @@
{
const ip6_link_t *il;
- il = &ip6_links[sw_if_index];
+ il = ip6_link_get (sw_if_index);
+
+ if (NULL == il)
+ return (INDEX_INVALID);
return (il->il_mcast_adj);
}