aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-01-18 19:37:55 +0100
committerDamjan Marion <dmarion@me.com>2021-01-21 13:31:15 +0000
commitaea54eb912e628fc58b74f9b8259ebcc4986a9c3 (patch)
tree8ded01c85ada65c51915168a6159263d4b55a1eb
parent7559418657b81e802e6582422d01188c01cf5079 (diff)
ip: do not return uninitialized IPv6 ll attributes
Type: fix Change-Id: If35cf7da0c3d1b92532cc2e45c164d6b5a08592c Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vnet/ip/ip6_link.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vnet/ip/ip6_link.c b/src/vnet/ip/ip6_link.c
index 082033a9de9..0527b2ffc52 100644
--- a/src/vnet/ip/ip6_link.c
+++ b/src/vnet/ip/ip6_link.c
@@ -319,9 +319,10 @@ ip6_get_link_local_address (u32 sw_if_index)
{
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 @@ ip6_link_get_mcast_adj (u32 sw_if_index)
{
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);
}