From 18991be8d334f1e6f6e82305d9472d2925b7a1ba Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Thu, 15 Jul 2021 08:57:02 -0700 Subject: ip-neighbor: GARP sent to bogus ip address The function ip4_neighbor_advertise may be called with NULL addr. In that case, it looks up addr from fib by calling fib_sas4_get which returns true or false to indicate whether there is an ip address associated with the interface or not. But the caller to fib_sas4_get does not check the return code and blindly assumes there is always an ip address associated with the interface. As a result, it ends up sending GARP to the bogus ip address if there is no ip address associated with the interface. Type: fix Signed-off-by: Steven Luong Change-Id: I7aa0270766c3943ed8ca8f8a092cae34567fd30e --- src/vnet/ip-neighbor/ip4_neighbor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vnet/ip-neighbor/ip4_neighbor.c') diff --git a/src/vnet/ip-neighbor/ip4_neighbor.c b/src/vnet/ip-neighbor/ip4_neighbor.c index 94848259b8c..9dda50ee911 100644 --- a/src/vnet/ip-neighbor/ip4_neighbor.c +++ b/src/vnet/ip-neighbor/ip4_neighbor.c @@ -79,8 +79,8 @@ ip4_neighbor_advertise (vlib_main_t * vm, if (NULL == addr) { - fib_sas4_get (sw_if_index, NULL, &tmp); - addr = &tmp; + if (fib_sas4_get (sw_if_index, NULL, &tmp)) + addr = &tmp; } if (addr) -- cgit 1.2.3-korg