]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Fix VRF for listening socket
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Fri, 26 Oct 2018 17:11:33 +0000 (19:11 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Fri, 26 Oct 2018 17:11:33 +0000 (19:11 +0200)
Listening socket should be bound to specified interface and VRF.

Thanks to Alexander Zubkov for the bugreport.

proto/bgp/bgp.c

index e7479df7875d14ae27707962ac768ce83a9ceb03..e2a571372fdec16cf0037337aeb030c5c16091b5 100644 (file)
@@ -159,7 +159,8 @@ bgp_open(struct bgp_proto *p)
   /* We assume that cf->iface is defined iff cf->local_ip is link-local */
 
   WALK_LIST(bs, bgp_sockets)
-    if (ipa_equal(bs->sk->saddr, addr) && (bs->sk->iface == ifa) && (bs->sk->sport == port))
+    if (ipa_equal(bs->sk->saddr, addr) && (bs->sk->sport == port) &&
+       (bs->sk->iface == ifa) && (bs->sk->vrf == p->p.vrf))
     {
       bs->uc++;
       p->sock = bs;
@@ -171,6 +172,8 @@ bgp_open(struct bgp_proto *p)
   sk->ttl = 255;
   sk->saddr = addr;
   sk->sport = port;
+  sk->iface = ifa;
+  sk->vrf = p->p.vrf;
   sk->flags = 0;
   sk->tos = IP_PREC_INTERNET_CONTROL;
   sk->rbsize = BGP_RX_BUFFER_SIZE;