Currently, when BGPSpeaker advertises IPv4/6 unicast routes
via an iBGP connection, if the Nexthop in the route is omitted,
BGP Speaker advertises the Nexthop with the unspecified address.
This route can be evaluated as invalid by the receiving router.
This patch fixes it by making BGPSpeaker to advertising
the Nexthop with the host's own ip address if the local route
in the RIB has the Nexthop with the unspecified address.

Signed-off-by: Satoshi Fujimoto <[email protected]>
---
 ryu/services/protocols/bgp/peer.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ryu/services/protocols/bgp/peer.py 
b/ryu/services/protocols/bgp/peer.py
index 3702739..b7c3dc9 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
@@ -1040,7 +1040,10 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
                 next_hop = path.nexthop
                 # RFC 4271 allows us to change next_hop
                 # if configured to announce its own ip address.
-                if self._neigh_conf.is_next_hop_self:
+                # Also if the BGP route is configured without next_hop,
+                # we use path._session_next_hop() as next_hop.
+                if (self._neigh_conf.is_next_hop_self
+                        or (path.is_local() and not path.has_nexthop())):
                     next_hop = self._session_next_hop(path)
                     LOG.debug('using %s as a next_hop address instead'
                               ' of path.nexthop %s', next_hop, path.nexthop)
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to