From: David Lamparter Date: Thu, 11 Aug 2016 15:28:58 +0000 (+0200) Subject: bgpd: only try to identify VRF on Linux X-Git-Tag: frr-2.0-rc1~391 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=120c658793d960796030793b74385a9fe9888ebb;p=mirror%2Ffrr.git bgpd: only try to identify VRF on Linux 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 Signed-off-by: David Lamparter --- diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 61972aabf1..bafc666a19 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -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. */