bgp: bug fix when the peer initiated the connection.

set binded ip and port properly regardless of the direction of connection

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
ISHIDA Wataru 2014-05-02 06:30:03 +00:00 committed by FUJITA Tomonori
parent 2d00b7d424
commit 6da9cf0187
2 changed files with 3 additions and 3 deletions

View File

@ -400,7 +400,10 @@ class CoreService(Factory, Activity):
"""
assert socket
peer_addr, peer_port = socket.getpeername()
bind_ip, bind_port = socket.getsockname()
peer = self._peer_manager.get_by_addr(peer_addr)
peer._host_bind_ip = bind_ip
peer._host_bind_port = bind_port
bgp_proto = self.build_protocol(socket)
# We reject this connection request from peer:

View File

@ -818,9 +818,6 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
client_factory,
time_out=tcp_conn_timeout,
bind_address=bind_addr)
bind_ip, bind_port = sock.getpeername()
self._host_bind_ip = bind_ip
self._host_bind_port = bind_port
except socket.error:
self.state.bgp_state = const.BGP_FSM_ACTIVE
LOG.debug('Socket could not be created in time (%s secs),'