Workaround. Needs to clean up get_peername and get_sockname usage.
Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/services/protocols/bgp/core.py | 5 ++++-
ryu/services/protocols/bgp/peer.py | 4 ++--
ryu/services/protocols/bgp/speaker.py | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/ryu/services/protocols/bgp/core.py
b/ryu/services/protocols/bgp/core.py
index 09c058c..b64f92a 100644
--- a/ryu/services/protocols/bgp/core.py
+++ b/ryu/services/protocols/bgp/core.py
@@ -20,6 +20,7 @@
peers and maintains VRFs and Global tables.
"""
import logging
+import netaddr
from ryu.lib.packet.bgp import BGP_ERROR_CEASE
from ryu.lib.packet.bgp import BGP_ERROR_SUB_CONNECTION_RESET
@@ -426,7 +427,9 @@ class CoreService(Factory, Activity):
subcode = BGP_ERROR_SUB_CONNECTION_COLLISION_RESOLUTION
bgp_proto.send_notification(code, subcode)
else:
- bind_ip, bind_port = socket.getsockname()[0:2]
+ bind_ip, bind_port = socket.getsockname()[:2]
+ if 'ffff:'in bind_ip:
+ bind_ip = str(netaddr.IPAddress(bind_ip).ipv4())
peer._host_bind_ip = bind_ip
peer._host_bind_port = bind_port
self._spawn_activity(bgp_proto, peer)
diff --git a/ryu/services/protocols/bgp/peer.py
b/ryu/services/protocols/bgp/peer.py
index d92e0d3..c770365 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -840,9 +840,9 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
# Update state attributes
self.state.peer_ip, self.state.peer_port = \
- self._protocol.get_peername()
+ self._protocol.get_peername()[:2]
self.state.local_ip, self.state.local_port = \
- self._protocol.get_sockname()
+ self._protocol.get_sockname()[:2]
# self.state.bgp_state = self._protocol.state
# Stop connect_loop retry timer as we are now connected
if self._protocol and self._connect_retry_event.is_set():
diff --git a/ryu/services/protocols/bgp/speaker.py
b/ryu/services/protocols/bgp/speaker.py
index a691b12..994993b 100644
--- a/ryu/services/protocols/bgp/speaker.py
+++ b/ryu/services/protocols/bgp/speaker.py
@@ -443,7 +443,7 @@ class BgpProtocol(Protocol, Activity):
message except for *Open* and *Notification* message. On receiving
*Notification* message we close connection with peer.
"""
- LOG.debug('Received msg from %s << %s' % (str(self.get_peername()),
+ LOG.debug('Received msg from %s << %s' % (str(self.get_peername()[0]),
msg))
# If we receive open message we try to bind to protocol
--
1.8.5.2 (Apple Git-48)
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel