aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip-neighbor/ip_neighbor.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2020-11-20 13:05:59 +0000
committerNeale Ranns <nranns@cisco.com>2020-11-25 12:57:16 +0000
commit4ac36bcb190b85e6541d27072157fdcee42bee23 (patch)
tree8c3da48e217bcef492b56deacd2e3c333ff5a683 /src/vnet/ip-neighbor/ip_neighbor.c
parent38340fa32c96e9c6cb1593f03117dd504efbd5f4 (diff)
ip-neighbor: Send API event when neighbor is removed
Type: fix Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: I9952497a108bac26445af95c28d4eed46099c2fc
Diffstat (limited to 'src/vnet/ip-neighbor/ip_neighbor.c')
-rw-r--r--src/vnet/ip-neighbor/ip_neighbor.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/vnet/ip-neighbor/ip_neighbor.c b/src/vnet/ip-neighbor/ip_neighbor.c
index 12ce0d6a271..5786775dc98 100644
--- a/src/vnet/ip-neighbor/ip_neighbor.c
+++ b/src/vnet/ip-neighbor/ip_neighbor.c
@@ -386,7 +386,7 @@ ip_neighbor_mk_incomplete_walk (adj_index_t ai, void *ctx)
}
static void
-ip_neighbor_free (ip_neighbor_t * ipn)
+ip_neighbor_destroy (ip_neighbor_t * ipn)
{
ip_address_family_t af;
@@ -395,6 +395,9 @@ ip_neighbor_free (ip_neighbor_t * ipn)
IP_NEIGHBOR_DBG ("free: %U", format_ip_neighbor,
ip_neighbor_get_index (ipn));
+ ip_neighbor_publish (ip_neighbor_get_index (ipn),
+ IP_NEIGHBOR_EVENT_REMOVED);
+
adj_nbr_walk_nh (ipn->ipn_key->ipnk_sw_if_index,
ip_address_family_to_fib_proto (af),
&ip_addr_46 (&ipn->ipn_key->ipnk_ip),
@@ -426,7 +429,7 @@ ip_neighbor_force_reuse (ip_address_family_t af)
return (false);
elt = clib_llist_prev (ip_neighbor_elt_pool, ipne_anchor, head);
- ip_neighbor_free (ip_neighbor_get (elt->ipne_index));
+ ip_neighbor_destroy (ip_neighbor_get (elt->ipne_index));
return (true);
}
@@ -556,7 +559,7 @@ ip_neighbor_add (const ip_address_t * ip,
check_customers:
/* Customer(s) requesting event for this address? */
- ip_neighbor_publish (ip_neighbor_get_index (ipn));
+ ip_neighbor_publish (ip_neighbor_get_index (ipn), IP_NEIGHBOR_EVENT_ADDED);
if (stats_index)
*stats_index = adj_nbr_find (fproto,
@@ -588,7 +591,7 @@ ip_neighbor_del (const ip_address_t * ip, u32 sw_if_index)
if (NULL == ipn)
return (VNET_API_ERROR_NO_SUCH_ENTRY);
- ip_neighbor_free (ipn);
+ ip_neighbor_destroy (ipn);
return (0);
}
@@ -623,7 +626,8 @@ ip_neighbor_del_all (ip_address_family_t af, u32 sw_if_index)
ip_neighbor_walk (af, sw_if_index, ip_neighbor_del_all_walk_cb, &ctx);
- vec_foreach (ipni, ctx.ipn_del) ip_neighbor_free (ip_neighbor_get (*ipni));
+ vec_foreach (ipni,
+ ctx.ipn_del) ip_neighbor_destroy (ip_neighbor_get (*ipni));
vec_free (ctx.ipn_del);
}
@@ -1220,7 +1224,7 @@ ip_neighbor_flush (ip_address_family_t af, u32 sw_if_index)
}));
/* *INDENT-ON* */
- vec_foreach (ipni, ipnis) ip_neighbor_free (ip_neighbor_get (*ipni));
+ vec_foreach (ipni, ipnis) ip_neighbor_destroy (ip_neighbor_get (*ipni));
vec_free (ipnis);
}
@@ -1273,7 +1277,7 @@ ip_neighbor_sweep (ip_address_family_t af)
vec_foreach (ipni, ctx.ipnsc_stale)
{
- ip_neighbor_free (ip_neighbor_get (*ipni));
+ ip_neighbor_destroy (ip_neighbor_get (*ipni));
}
vec_free (ctx.ipnsc_stale);
}
@@ -1407,7 +1411,7 @@ ip_neighbor_add_del_interface_address_v4 (ip4_main_t * im,
ip_neighbor_walk (AF_IP4, sw_if_index, ip_neighbor_walk_covered, &ctx);
vec_foreach (ipni, ctx.ipnis)
- ip_neighbor_free (ip_neighbor_get (*ipni));
+ ip_neighbor_destroy (ip_neighbor_get (*ipni));
vec_free (ctx.ipnis);
}
@@ -1449,7 +1453,7 @@ ip_neighbor_add_del_interface_address_v6 (ip6_main_t * im,
ip_neighbor_walk (AF_IP6, sw_if_index, ip_neighbor_walk_covered, &ctx);
vec_foreach (ipni, ctx.ipnis)
- ip_neighbor_free (ip_neighbor_get (*ipni));
+ ip_neighbor_destroy (ip_neighbor_get (*ipni));
vec_free (ctx.ipnis);
}
@@ -1623,7 +1627,7 @@ ip_neighbor_age_loop (vlib_main_t * vm,
else if (IP_NEIGHBOR_AGE_DEAD == res) {
/* the oldest neighbor is dead, pop it, then restart the walk
* again from the back */
- ip_neighbor_free (ip_neighbor_get(elt->ipne_index));
+ ip_neighbor_destroy (ip_neighbor_get(elt->ipne_index));
goto restart;
}