Static routes after `configure` CLI command

Vladimir Osmolovskiy vladimir.osmolovskiy at gmail.com
Mon Dec 3 11:06:02 CET 2018


 Hello!
In CLI command line, after 'configure'  command, pointer to static routes
in neighbor structure not valid.



This patch delete heighbors. Perhaps there is a better solution.

diff --git a/nest/neighbor.c b/nest/neighbor.c
index f8159d3..7fc449a 100644
--- a/nest/neighbor.c
+++ b/nest/neighbor.c
@@ -379,6 +379,37 @@ neigh_prune_one(neighbor *n)
   sl_free(neigh_slab, n);
 }
.
+
+void
+neigh_prune_proto(struct proto *p)
+{
+  neighbor *n;
+  node *m;
+  int i;
+
+  for(i=0; i<NEIGH_HASH_SIZE; i++)
+    WALK_LIST_DELSAFE(n, m, neigh_hash_table[i])
+    if (n->proto == p )
+    {
+      rem_node(&n->n);
+      if (n->scope >= 0)
+        rem_node(&n->if_n);
+      sl_free(neigh_slab, n);
+    }
+  WALK_LIST_DELSAFE(n, m, sticky_neigh_list)
+  if (n->proto == p )
+    {
+      rem_node(&n->n);
+      if (n->scope >= 0)
+        rem_node(&n->if_n);
+      sl_free(neigh_slab, n);
+    }
+}
+
+
+
+
+
 /**
  * neigh_prune - prune neighbor cache
  *
diff --git a/proto/static/static.c b/proto/static/static.c
index 849067b..8a7d1a0 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -559,6 +559,8 @@ static_reconfigure(struct proto *p, struct proto_config
*new)
   WALK_LIST(r, o->other_routes)
     static_match(p, r, n);
.
+  neigh_prune_proto(p);
+
   /* Now add all new routes, those not changed will be ignored by
static_install() */
   WALK_LIST(r, n->iface_routes)
     {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20181203/e4f7d0a0/attachment.html>


More information about the Bird-users mailing list