From: Alan Quillin <alanquil...@gmail.com> If the path has a next hop value set, it should be used in the BGP Update message first. This changes to logic to use the check for the next hop in the order prefix/path->peer config->speaker config. This will allow for sending the nexthop as part of the add_prefix message and allow for overiding the nexthop of the peer if one is set.
Signed-off-by: Alan Quillin <alanquil...@gmail.com> --- ryu/services/protocols/bgp/info_base/base.py | 4 ++++ ryu/services/protocols/bgp/peer.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ryu/services/protocols/bgp/info_base/base.py b/ryu/services/protocols/bgp/info_base/base.py index 3546c92..3065cb8 100644 --- a/ryu/services/protocols/bgp/info_base/base.py +++ b/ryu/services/protocols/bgp/info_base/base.py @@ -809,6 +809,10 @@ class Path(object): return not interested_rts.isdisjoint(curr_rts) + def has_nexthop(self): + return not (not self._nexthop or self._nexthop == '0.0.0.0' or + self._nexthop == '::') + def __str__(self): return ( 'Path(source: %s, nlri: %s, source ver#: %s, ' diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py index f08ac1e..308cdc2 100644 --- a/ryu/services/protocols/bgp/peer.py +++ b/ryu/services/protocols/bgp/peer.py @@ -803,6 +803,8 @@ class Peer(Source, Sink, NeighborConfListener, Activity): # By default we use BGPS's interface IP with this peer as next_hop. if self._neigh_conf.next_hop: next_hop = self._neigh_conf.next_hop + elif path.has_nexthop(): + next_hop = path.nexthop else: next_hop = self.host_bind_ip if route_family == RF_IPv6_VPN: -- 2.1.4
------------------------------------------------------------------------------
_______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel