From 5002e7f26f4f2f94af56e0d4b26124fb876e2a3f Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Mon, 23 Dec 2019 16:25:11 -0600 Subject: ip-neighbor: ip_neighbor_advertise() handles null Type: fix Fixes: cbe25aab3b ip_neighbor_advertise() was calling one of both of ip4_neighbor_advertise() and/or ip6_neighbor_advertise() with &addr->{ip4|ip6} as an argument. If addr is null, which is likely a requirement when the type is IP46_TYPE_BOTH, this results in a SEGV. Check addr and pass a pointer to one of it's members if it is not null, otherwise pass null. Change-Id: I6261bb8fe947365fe3d6c58788ea27d5cb28ff05 Signed-off-by: Matthew Smith --- src/vnet/ip-neighbor/ip_neighbor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/ip-neighbor/ip_neighbor.c b/src/vnet/ip-neighbor/ip_neighbor.c index 11684eb9de5..ceec3732c77 100644 --- a/src/vnet/ip-neighbor/ip_neighbor.c +++ b/src/vnet/ip-neighbor/ip_neighbor.c @@ -976,9 +976,9 @@ ip_neighbor_advertise (vlib_main_t * vm, vnet_main_t *vnm = vnet_get_main (); if (type == IP46_TYPE_IP4 || type == IP46_TYPE_BOTH) - ip4_neighbor_advertise (vm, vnm, sw_if_index, &addr->ip4); + ip4_neighbor_advertise (vm, vnm, sw_if_index, (addr) ? &addr->ip4 : NULL); if (type == IP46_TYPE_IP6 || type == IP46_TYPE_BOTH) - ip6_neighbor_advertise (vm, vnm, sw_if_index, &addr->ip6); + ip6_neighbor_advertise (vm, vnm, sw_if_index, (addr) ? &addr->ip6 : NULL); } void -- cgit 1.2.3-korg