]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixes a bug with neighbor cache and overlapping IP prefixes.
authorOndrej Zajicek <santiago@crfreenet.org>
Thu, 16 Aug 2012 11:09:26 +0000 (13:09 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 16 Aug 2012 11:09:26 +0000 (13:09 +0200)
When there are overlapping IP prefixes and one disappears,
neighbors associated with it was removed even if there
is another covering IP prefix.

nest/neighbor.c

index 506d9bdee4618b76d2171c4dbeb54bc50ffb2072..9dce811941df9814d4f9db9193648a6895bdb3ab 100644 (file)
@@ -114,7 +114,7 @@ neighbor *
 neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
 {
   neighbor *n;
-  int class, scope = -1;       ;
+  int class, scope = -1;
   unsigned int h = neigh_hash(p, a);
   struct iface *i;
 
@@ -240,7 +240,21 @@ neigh_down(neighbor *n)
     n->proto->neigh_notify(n);
   rem_node(&n->n);
   if (n->flags & NEF_STICKY)
-    add_tail(&sticky_neigh_list, &n->n);
+    {
+      add_tail(&sticky_neigh_list, &n->n);
+
+      /* Respawn neighbor if there is another matching prefix */
+      struct iface *i;
+      int scope;
+
+      if (!n->iface)
+       WALK_LIST(i, iface_list)
+         if ((scope = if_connected(&n->addr, i)) >= 0)
+           {
+             neigh_up(n, i, scope);
+             return;
+           }
+    }
   else
     sl_free(neigh_slab, n);
 }