summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/services/protocols/bgp/core.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ryu/services/protocols/bgp/core.py b/ryu/services/protocols/bgp/core.py
index 06557cf7..53882169 100644
--- a/ryu/services/protocols/bgp/core.py
+++ b/ryu/services/protocols/bgp/core.py
@@ -400,10 +400,7 @@ 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:
@@ -427,4 +424,7 @@ class CoreService(Factory, Activity):
subcode = BGP_ERROR_SUB_CONNECTION_COLLISION_RESOLUTION
bgp_proto.send_notification(code, subcode)
else:
+ bind_ip, bind_port = socket.getsockname()
+ peer._host_bind_ip = bind_ip
+ peer._host_bind_port = bind_port
self._spawn_activity(bgp_proto, peer)