ip-neighbor: Send API event when neighbor is removed
Type: fix
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Change-Id: I9952497a108bac26445af95c28d4eed46099c2fc
diff --git a/src/vnet/ip-neighbor/ip_neighbor.c b/src/vnet/ip-neighbor/ip_neighbor.c
index 12ce0d6..5786775 100644
--- a/src/vnet/ip-neighbor/ip_neighbor.c
+++ b/src/vnet/ip-neighbor/ip_neighbor.c
@@ -386,7 +386,7 @@
}
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_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 @@
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 @@
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 @@
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_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 @@
}));
/* *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 @@
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_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_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 @@
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;
}