summaryrefslogtreecommitdiff
path: root/nest/iface.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-02-13 20:55:08 +0000
committerMartin Mares <mj@ucw.cz>1999-02-13 20:55:08 +0000
commit783f8b689a29aaffbe75e964fdd09a3c219ea81c (patch)
tree556bb1e5180d85a1ce97316239e3f75a6971593c /nest/iface.c
parent013a9b91fe495371cbf9a5690613de45b634e3af (diff)
When protocols go down, prune the neighbor list.
Diffstat (limited to 'nest/iface.c')
-rw-r--r--nest/iface.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/nest/iface.c b/nest/iface.c
index a3dff4af..28e7739b 100644
--- a/nest/iface.c
+++ b/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
*/