summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/services/protocols/bgp/core.py3
-rw-r--r--ryu/services/protocols/bgp/peer.py3
2 files changed, 3 insertions, 3 deletions
diff --git a/ryu/services/protocols/bgp/core.py b/ryu/services/protocols/bgp/core.py
index f38ece13..06557cf7 100644
--- a/ryu/services/protocols/bgp/core.py
+++ b/ryu/services/protocols/bgp/core.py
@@ -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:
diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py
index 0ee39be3..2f25d3dc 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -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),'