summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorToshiki Tsuboi <t.tsubo2000@gmail.com>2014-11-16 10:39:42 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-11-18 07:27:52 +0900
commitecc57e8660682b954b7683170521b1d1628255a3 (patch)
tree5fd6449b41c55784aa3ffdb153150498d83635f7
parent8daa12a625b8514f7a11369d41f5d7aef2943b9e (diff)
bgp: bug fix of Multi Exit Discriminator (MED)
RyuBGP doesn't work well regarding the advertisement of BGP MED Attribute as follows. (1) In spite of receiving BGP MED:"500" from iBGP(R2), RyuBGP can't advertise BGP MED:"100" to eBGP(R3). R1 -------------> R2 -------------> RyuBGP -------------> R3 eBGP(MED:500) iBGP(MED:500) ^ eBGP(MED:500) (MED:100) (2) When RyuBGP has received BGP MED:"200" from eBGP(R3), RyuBGP has sended BGP with missing-MED to iBGP(R2). As result, PolicyBaseRouting in R2(other RyuBGP) doesn't work properly becase of selecting wrong BestPath. eBGP(MED:100) R1 ------------------------------------>+ | R3 -------------> RyuBGP -------------> R2(RyuBGP) => Wrong result [BestPath is "R3-R2"] eBGP(MED:200) iBGP(MED:N/A) Signed-off-by: Toshiki Tsuboi <t.tsubo2000@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/peer.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py
index eac098c0..48806bcb 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -75,6 +75,7 @@ from ryu.lib.packet.bgp import BGPPathAttributeExtendedCommunities
from ryu.lib.packet.bgp import BGPPathAttributeMpReachNLRI
from ryu.lib.packet.bgp import BGPPathAttributeMpUnreachNLRI
from ryu.lib.packet.bgp import BGPPathAttributeCommunities
+from ryu.lib.packet.bgp import BGPPathAttributeMultiExitDisc
from ryu.lib.packet.bgp import BGP_ATTR_TYPE_ORIGIN
from ryu.lib.packet.bgp import BGP_ATTR_TYPE_AS_PATH
@@ -940,12 +941,15 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
# For eBGP session we can send multi-exit-disc if configured.
multi_exit_disc = None
if self.is_ebgp_peer():
- multi_exit_disc = pathattr_map.get(
- BGP_ATTR_TYPE_MULTI_EXIT_DISC)
- if not multi_exit_disc and self._neigh_conf.multi_exit_disc:
+ if self._neigh_conf.multi_exit_disc:
multi_exit_disc = BGPPathAttributeMultiExitDisc(
self._neigh_conf.multi_exit_disc
)
+ else:
+ pass
+ if not self.is_ebgp_peer():
+ multi_exit_disc = pathattr_map.get(
+ BGP_ATTR_TYPE_MULTI_EXIT_DISC)
# LOCAL_PREF Attribute.
if not self.is_ebgp_peer():