Hey all,

I was doing some work with dynamic neighbors in BGP, and found that I am
not able to use multiple protocol definitions with neighbor ranges.
Connections to the second and subsequent definitions are rejected.

The BGP protocol for the subsequent instances depend on a lock, but due to
the remote_addresses being the same (null) the subsequent protocols hang,
waiting for the first protocol.

Attached is a small patch which checks if the protocol is dynamic, and uses
the remote_range prefix instead of a zero remote_address for the lock.

Hope this helps.

Thanks,

Liam Nattrass
From 3a03c519d467fa00b73fd8e56bce2dd25e79f56b Mon Sep 17 00:00:00 2001
From: Liam Nattrass <liam.d.nattrass@gmail.com>
Date: Sun, 15 Sep 2019 17:32:58 -0400
Subject: [PATCH] Support multiple dynamic neighbors

---
 proto/bgp/bgp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index b26e5e87..6f507b98 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -1544,7 +1544,7 @@ bgp_start(struct proto *P)
    */
   struct object_lock *lock;
   lock = p->lock = olock_new(P->pool);
-  lock->addr = p->remote_ip;
+  lock->addr = bgp_is_dynamic(p) ? net_prefix(p->cf->remote_range) : p->remote_ip;
   lock->port = p->cf->remote_port;
   lock->iface = p->cf->iface;
   lock->vrf = p->cf->iface ? NULL : p->p.vrf;
-- 
2.15.1 (Apple Git-101)

Reply via email to