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 <[email protected]>
---
 ryu/services/protocols/bgp/peer.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index eac098c..48806bc 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():
-- 
1.9.1


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to