mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
bgp: fix ipv6 peering regression
Workaround. Needs to clean up get_peername and get_sockname usage. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
3aeeffa48c
commit
63451ce0a2
@ -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)
|
||||
|
||||
@ -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():
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user