summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-05-27 11:28:14 -0700
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-05-27 13:27:51 -0700
commita1416d6205aafec2b1e748ed3c446dda6a7a9eed (patch)
tree596b9cfc0c9d3c9a7429427a3dc9c351b44e093f
parent3dedb06c16e670e8ea7cb7e6e2cf7faf1b2f1987 (diff)
bgp: fix non configured peer exception
peer is None if the connection comes from non configured bgp peer. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-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)