mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
When protocols go down, prune the neighbor list.
This commit is contained in:
25
nest/iface.c
25
nest/iface.c
@@ -23,7 +23,6 @@ static void auto_router_id(void);
|
||||
* Neighbor Cache
|
||||
*
|
||||
* FIXME: Use hashing to get some real speed.
|
||||
* FIXME: Cleanup when a protocol goes down.
|
||||
*/
|
||||
|
||||
static slab *neigh_slab;
|
||||
@@ -160,6 +159,30 @@ neigh_if_down(struct iface *i)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
neigh_prune(void)
|
||||
{
|
||||
neighbor *n, *m, **N;
|
||||
struct iface *i;
|
||||
|
||||
DBG("Pruning neighbors\n");
|
||||
WALK_LIST(i, iface_list)
|
||||
{
|
||||
N = &i->neigh;
|
||||
while (n = *N)
|
||||
{
|
||||
if (n->proto->core_state == FS_HUNGRY || n->proto->core_state == FS_FLUSHING)
|
||||
{
|
||||
*N = n->sibling;
|
||||
rem_node(&n->n);
|
||||
sl_free(neigh_slab, n);
|
||||
continue;
|
||||
}
|
||||
N = &n->sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The Interface List
|
||||
*/
|
||||
|
Reference in New Issue
Block a user