summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2014-05-02 06:30:03 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-05-10 01:14:56 +0900
commit6da9cf0187367e25cc256123d947d129ea2c1b3d (patch)
tree9084e4d53d515955bbee076e53abbf855562df5a
parent2d00b7d4247e83aef57e73a589e01082a4ea616e (diff)
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>
-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),'