bgpd: fix O_NONBLOCK on outgoing connects

BGP was setting sockets to be non-blocking only for the accepted passive
peers.  As a fix, setting the BGP sockets to be non-blocking even for
the active peers.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
[DL: patch split, this is item 1.]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
Vipin Kumar 2014-01-09 00:31:22 +00:00 committed by David Lamparter
parent 6aa136f1ea
commit 48fc05fb7e

View File

@ -306,6 +306,8 @@ bgp_connect (struct peer *peer)
if (peer->fd < 0) if (peer->fd < 0)
return -1; return -1;
set_nonblocking (peer->fd);
/* If we can get socket for the peer, adjest TTL and make connection. */ /* If we can get socket for the peer, adjest TTL and make connection. */
if (peer->sort == BGP_PEER_EBGP) { if (peer->sort == BGP_PEER_EBGP) {
sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl); sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl);