summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2014-06-20 15:51:59 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-06-22 12:32:39 +0900
commit254ae732de71dc5d7a46bd168a3bd22bc7b6919b (patch)
tree54b8f50172d1745555d85bcc65aa8d89aaa0ffe3
parent24f4a01bc446713077e88f3c80a016fad5d963fd (diff)
bgp: fix a crash in path comparison
this fixes the following crash. API method core.start called with args: {'router_id': '172.17.190.2', 'waiter':< <ryu.lib.hub.Event object at 0x7f903ed084d0>, 'bgp_server_port': 179, 'local_as: : 64512, 'refresh_max_eor_time': 0, 'refresh_stalepath_time': 0} API method neighbor.create called with args: {'cap_mbgp_vpnv6': False, 'ip_addrs ss': '172.17.190.3', 'cap_mbgp_vpnv4': False, 'remote_as': 64512, 'cap_mbgp_ipv' ': True} API method neighbor.create called with args: {'cap_mbgp_vpnv6': False, 'ip_addrs ss': '172.17.190.4', 'cap_mbgp_vpnv4': False, 'remote_as': 64512, 'cap_mbgp_ipv' ': True} Connection to peer: 172.17.190.3 established Connection to peer: 172.17.190.4 established the best path changed: 64512 0.0.0.0/0 172.17.190.3 False hub: uncaught exception: Traceback (most recent call last): File "/opt/ryu/ryu/lib/hub.py", line 52, in _launch func(*args, **kwargs) File "/opt/ryu/ryu/services/protocols/bgp/base.py", line 241, in start self._run(*args, **kwargs) File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 97, in _run self._process_dest() File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 114, in _proces_ _dest next_dest.process() File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 396, in prc cess self._process() File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 366, in _po ocess new_best_path, reason = self._process_paths() File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 485, in _po ocess_paths current_best_path, reason = self._compute_best_known_path() File "/opt/ryu/ryu/services/protocols/bgp/info_base/base.py", line 588, in _cm mpute_best_known_path next_path) File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 252, in computeb best_path best_path = _cmp_by_router_id(local_asn, path1, path2) File "/opt/ryu/ryu/services/protocols/bgp/processor.py", line 495, in _cmp_byr router_id local_bgp_id = path_source1.protocol.sent_open.bgpid AttributeError: 'Peer' object has no attribute 'protocol' Tested-by: Itsuro ODA <oda@valinux.co.jp> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/peer.py4
-rw-r--r--ryu/services/protocols/bgp/processor.py9
2 files changed, 8 insertions, 5 deletions
diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py
index c56b2941..d92e0d31 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -336,6 +336,10 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
return self._neigh_conf.ip_address
@property
+ def protocol(self):
+ return self._protocol
+
+ @property
def host_bind_ip(self):
return self._host_bind_ip
diff --git a/ryu/services/protocols/bgp/processor.py b/ryu/services/protocols/bgp/processor.py
index a5fcbcce..05b766a0 100644
--- a/ryu/services/protocols/bgp/processor.py
+++ b/ryu/services/protocols/bgp/processor.py
@@ -492,9 +492,9 @@ def _cmp_by_router_id(local_asn, path1, path2):
# At least one path is not coming from NC, so we get local bgp id.
if path_source1 is not None:
- local_bgp_id = path_source1.protocol.sent_open.bgpid
+ local_bgp_id = path_source1.protocol.sent_open_msg.bgpid
else:
- local_bgp_id = path_source2.protocol.sent_open.bgpid
+ local_bgp_id = path_source2.protocol.sent_open_msg.bgpid
# Get router ids.
router_id1 = get_router_id(path_source1, local_bgp_id)
@@ -506,9 +506,8 @@ def _cmp_by_router_id(local_asn, path1, path2):
return None
# Select the path with lowest router Id.
- from ryu.services.protocols.bgp.ker.utils.bgp import from_inet_ptoi
- if (from_inet_ptoi(router_id1) <
- from_inet_ptoi(router_id2)):
+ from ryu.services.protocols.bgp.utils.bgp import from_inet_ptoi
+ if (from_inet_ptoi(router_id1) < from_inet_ptoi(router_id2)):
return path1
else:
return path2