According to RFC 7313 [Enhanced Route Refresh Capability for BGP-4], Ryu bgps 
needs to send "Start-of-RIB" before it advertises the Adj-RIB-Out. And then, 
Ryu bgps needs to send "End-of-RIB" after it advertises the Adj-RIB-Out.

Signed-off-by: Toshiki Tsuboi <[email protected]>
---
 ryu/lib/packet/bgp.py              | 1 +
 ryu/services/protocols/bgp/peer.py | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index 6563ace..f5575c4 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -2569,6 +2569,7 @@ class BGPRouteRefresh(BGPMessage):
         self.afi = afi
         self.safi = safi
         self.demarcation = demarcation
+        self.eor_sent = False
 
     @classmethod
     def parser(cls, buf):
diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index c8eae4b..fc8ee55 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -1752,7 +1752,7 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
             # If enhanced route-refresh is valid/enabled, enqueue SOR.
             afi = af.afi
             safi = af.safi
-            sor = BGPRouteRefresh(afi, safi, reserved=1)
+            sor = BGPRouteRefresh(afi, safi, demarcation=1)
             self.enque_first_outgoing_msg(sor)
 
         # Ask core to re-send sent routes
@@ -1767,9 +1767,9 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
         sent.
         """
         if self._protocol.is_enhanced_rr_cap_valid() and not sor.eor_sent:
-            afi = sor.route_family.afi
-            safi = sor.route_family.safi
-            eor = BGPRouteRefresh(afi, safi, reserved=2)
+            afi = sor.afi
+            safi = sor.safi
+            eor = BGPRouteRefresh(afi, safi, demarcation=2)
             self.enque_outgoing_msg(eor)
             sor.eor_sent = True
 
-- 
2.3.8 (Apple Git-58)
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to