diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-28 18:24:26 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-28 18:24:26 +0000 |
commit | 99c333490439b9b5c41c1fdeb718a6640c120583 (patch) | |
tree | c4ba3f9078ae4d6482518898a63ef2b29ceb0e29 /usr.sbin | |
parent | 3b45540c2325f5da3d40b2b83b514a6a722a0c91 (diff) |
repair the bind() in session_connect; only used if local-addr was specified
got broken in the sockaddr_in -> bgpd_addr conversion
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/session.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 8ecf10aed3c..09525f8174d 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.98 2004/01/28 18:19:32 henning Exp $ */ +/* $OpenBSD: session.c,v 1.99 2004/01/28 18:24:25 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -755,13 +755,14 @@ session_connect(struct peer *peer) peer->wbuf.sock = peer->sock; /* if update source is set we need to bind() */ - if (peer->conf.local_addr.af) - if (bind(peer->sock, addr2sa(&peer->conf.local_addr, 0), - sizeof(peer->conf.local_addr))) { + if (peer->conf.local_addr.af) { + sa = addr2sa(&peer->conf.local_addr, 0); + if (bind(peer->sock, sa, sa->sa_len) == -1) { log_peer_warn(&peer->conf, "session_connect bind"); bgp_fsm(peer, EVNT_CON_OPENFAIL); return (-1); } + } if (session_setup_socket(peer)) { bgp_fsm(peer, EVNT_CON_OPENFAIL); |