From aea54eb912e628fc58b74f9b8259ebcc4986a9c3 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Mon, 18 Jan 2021 19:37:55 +0100 Subject: ip: do not return uninitialized IPv6 ll attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Type: fix Change-Id: If35cf7da0c3d1b92532cc2e45c164d6b5a08592c Signed-off-by: Benoît Ganne --- src/vnet/ip/ip6_link.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/vnet/ip') 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); } -- cgit 1.2.3-korg