+static void
+arp_adj_fib_remove (ethernet_arp_ip4_entry_t * e, u32 fib_index)
+{
+ if (FIB_NODE_INDEX_INVALID != e->fib_entry_index)
+ {
+ fib_prefix_t pfx = {
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr.ip4 = e->ip4_address,
+ };
+ u32 fib_index;
+
+ fib_index = ip4_fib_table_get_index_for_sw_if_index (e->sw_if_index);
+
+ fib_table_entry_path_remove (fib_index, &pfx,
+ FIB_SOURCE_ADJ,
+ DPO_PROTO_IP4,
+ &pfx.fp_addr,
+ e->sw_if_index, ~0, 1,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ fib_table_unlock (fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_ADJ);
+ }
+}
+
+static ethernet_arp_ip4_entry_t *
+force_reuse_arp_entry (void)
+{
+ ethernet_arp_ip4_entry_t *e;
+ ethernet_arp_main_t *am = ðernet_arp_main;
+ u32 count = 0;
+ u32 index = pool_next_index (am->ip4_entry_pool, am->arp_delete_rotor);
+ if (index == ~0) /* Try again from elt 0 */
+ index = pool_next_index (am->ip4_entry_pool, index);
+
+ /* Find a non-static random entry to free up for reuse */
+ do
+ {
+ if ((count++ == 100) || (index == ~0))
+ return NULL; /* give up after 100 entries */
+ e = pool_elt_at_index (am->ip4_entry_pool, index);
+ am->arp_delete_rotor = index;
+ index = pool_next_index (am->ip4_entry_pool, index);
+ }
+ while (e->flags & ETHERNET_ARP_IP4_ENTRY_FLAG_STATIC);
+
+ /* Remove ARP entry from its interface and update fib */
+ hash_unset
+ (am->ethernet_arp_by_sw_if_index[e->sw_if_index].arp_entries,
+ e->ip4_address.as_u32);
+ arp_adj_fib_remove
+ (e, ip4_fib_table_get_index_for_sw_if_index (e->sw_if_index));
+ adj_nbr_walk_nh4 (e->sw_if_index,
+ &e->ip4_address, arp_mk_incomplete_walk, e);
+ return e;
+}
+