From: Anna Neiman Date: Tue, 27 May 2025 12:28:53 +0000 (+0300) Subject: arp: checks for null in add neighbor X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F43045%2F12;p=vpp.git arp: checks for null in add neighbor Type: fix Details: I have the situation that ip_neighbor_learn is called for an already deleted interface. The reproduction sequence is following 1. arp_input -> arp_reply on some worker 2. call ip_neighbor_learn_dp , so request to perform ip_neighbor_learn on the vpp_main thread 3. the vpp_main thread is very busy - at the same moment we remove most of l2 interfaces and vrfs under barrier sync, including the TX interface of arp_reply 4. call ip_neighbor_learn in the main thread , when the appropriate interface is already deleted Change-Id: I69b167ba919d57f19d6b941260243bca889c31c1 Signed-off-by: Anna Neiman --- diff --git a/src/vnet/ip-neighbor/ip_neighbor.c b/src/vnet/ip-neighbor/ip_neighbor.c index 73fa0b30317..ab3bd7eac4c 100644 --- a/src/vnet/ip-neighbor/ip_neighbor.c +++ b/src/vnet/ip-neighbor/ip_neighbor.c @@ -335,6 +335,8 @@ ip_neighbor_adj_fib_add (ip_neighbor_t * ipn, u32 fib_index) } else { + if (INDEX_INVALID == fib_index) + return; fib_protocol_t fproto; fproto = ip_address_family_to_fib_proto (af); @@ -552,6 +554,9 @@ ip_neighbor_add (const ip_address_t * ip, /* main thread only */ ASSERT (0 == vlib_get_thread_index ()); + if (!vnet_sw_interface_is_valid (vnet_get_main (), sw_if_index)) + return 0; + fproto = ip_address_family_to_fib_proto (ip_addr_version (ip)); const ip_neighbor_key_t key = {