]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: VRF support for neighbor cache and olock code
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 12 Sep 2017 13:49:36 +0000 (15:49 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Tue, 12 Sep 2017 13:49:36 +0000 (15:49 +0200)
Actually much simpler than expected.

nest/locks.c
nest/locks.h
nest/neighbor.c
proto/bgp/bgp.c
proto/radv/radv.c

index 84b8b0aefe2f938c564f07bf3e77eaabe29432eb..86c9ff1469747e1752f299bb18fa515922087a63 100644 (file)
@@ -45,6 +45,7 @@ olock_same(struct object_lock *x, struct object_lock *y)
   return
     x->type == y->type &&
     x->iface == y->iface &&
+    x->vrf == y->vrf &&
     x->port == y->port &&
     x->inst == y->inst &&
     ipa_equal(x->addr, y->addr);
index 3d58c8ed200712fc72712322fe4711352a994359..37026c68c1a7dd82df8b3e9f3708d5d4ec96489e 100644 (file)
@@ -30,6 +30,7 @@ struct object_lock {
   uint port;           /* ... port number */
   uint inst;           /* ... instance ID */
   struct iface *iface; /* ... interface */
+  struct iface *vrf;   /* ... or VRF (if iface is unknown) */
   void (*hook)(struct object_lock *);  /* Called when the lock succeeds */
   void *data;          /* User data */
   /* ... internal to lock manager, don't touch ... */
index d974fa519fc9181d8d311f87d94a13e18cd81e2c..f8159d35d4ecb0618bf3827d66e8a47de2f5e23e 100644 (file)
@@ -30,7 +30,8 @@
  * when the protocol has explicitly requested it via the %NEF_STICKY
  * flag because it wishes to be notified when the node will again become
  * a neighbor. Such entries are enqueued in a special list which is walked
- * whenever an interface changes its state to up.
+ * whenever an interface changes its state to up. Neighbor entry VRF
+ * association is implied by respective protocol.
  *
  * When a neighbor event occurs (a neighbor gets disconnected or a sticky
  * inactive neighbor becomes connected), the protocol hook neigh_notify()
@@ -152,8 +153,9 @@ neigh_find2(struct proto *p, ip_addr *a, struct iface *ifa, unsigned flags)
     }
   else
     WALK_LIST(i, iface_list)
-      if ((scope = if_connected(a, i, &addr)) >= 0)
-       {
+      if ((!p->vrf || p->vrf == i->master) &&
+         ((scope = if_connected(a, i, &addr)) >= 0))
+        {
          ifa = i;
          break;
        }
index 913685a45011add99d6df6502b7325d87173d76d..8a6b2f028a3e2652a14ad947b7adbb379dd1d2d3 100644 (file)
@@ -1181,6 +1181,7 @@ bgp_start(struct proto *P)
   lock->addr = p->cf->remote_ip;
   lock->port = p->cf->remote_port;
   lock->iface = p->cf->iface;
+  lock->vrf = p->cf->iface ? NULL : p->p.vrf;
   lock->type = OBJLOCK_TCP;
   lock->hook = bgp_start_locked;
   lock->data = p;
index 227c8ef6230562887972129a1d8162b739e85a0a..c53a0a95267a9b6c38fea6b8325403e6705b6a09 100644 (file)
@@ -321,7 +321,6 @@ radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_conf
   ifa->timer = tm;
 
   struct object_lock *lock = olock_new(pool);
-  lock->addr = IPA_NONE;
   lock->type = OBJLOCK_IP;
   lock->port = ICMPV6_PROTO;
   lock->iface = iface;