]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: only try to identify VRF on Linux
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 11 Aug 2016 15:28:58 +0000 (17:28 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 16 Aug 2016 14:10:52 +0000 (16:10 +0200)
Only Linux has SO_BINDTODEVICE, but that's not a problem since the whole
VRF use case in that instance is currently Linux-specific.  Other OS's
VRF implementations will need different code.

Reported-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_network.c

index 61972aabf1f145cb4afacacb6a3833c55dfc605f..bafc666a192be8a2b86fabc420723c7eeccd0246 100644 (file)
@@ -228,6 +228,17 @@ bgp_set_socket_ttl (struct peer *peer, int bgp_sock)
 static int
 bgp_get_instance_for_inc_conn (int sock, struct bgp **bgp_inst)
 {
+#ifndef SO_BINDTODEVICE
+  /* only Linux has SO_BINDTODEVICE, but we're in Linux-specific code here
+   * anyway since the assumption is that the interface name returned by
+   * getsockopt() is useful in identifying the VRF, particularly with Linux's
+   * VRF l3master device.  The whole mechanism is specific to Linux, so...
+   * when other platforms add VRF support, this will need handling here as
+   * well.  (or, some restructuring) */
+  *bgp_inst = bgp_get_default ();
+  return !*bgp_inst;
+
+#else
   char name[VRF_NAMSIZ + 1];
   socklen_t name_len = VRF_NAMSIZ;
   struct bgp *bgp;
@@ -275,6 +286,7 @@ bgp_get_instance_for_inc_conn (int sock, struct bgp **bgp_inst)
 
   /* We didn't match to either an instance or an interface. */
   return -1;
+#endif
 }
 
 /* Accept bgp connection. */