From: Donald Sharp Date: Fri, 9 Sep 2016 12:48:23 +0000 (-0400) Subject: bgpd: Fix standalone to better handle getsockopt failure X-Git-Tag: frr-2.0-rc1~322 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=bc06d287d100c0845eb065b96838c81aebf83468;p=matthieu%2Ffrr.git bgpd: Fix standalone to better handle getsockopt failure When getsockopt(...,SO_BINDTODEVICE,...); fails assume the bgp instance we are interested is the default one. Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index ecfc3f9fe8..a6e9b7de00 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -257,13 +257,14 @@ bgp_get_instance_for_inc_conn (int sock, struct bgp **bgp_inst) zlog_err ("[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d", safe_strerror (errno), sock); return -1; -#else - strcpy (name, VRF_DEFAULT_NAME); #endif } if (!strlen(name)) - return 0; /* default instance. */ + { + *bgp_inst = bgp_get_default (); + return 0; /* default instance. */ + } /* First try match to instance; if that fails, check for interfaces. */ bgp = bgp_lookup_by_name (name);