From 399a03feb1984e660f8f51d03d3ce4d09a774b70 Mon Sep 17 00:00:00 2001 From: Satoshi Fujimoto Date: Fri, 24 Mar 2017 13:11:05 +0900 Subject: bgp/peer: Fix invalid NEXT_HOP in UPDATE message 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 Signed-off-by: FUJITA Tomonori --- 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 dbd04545..c1398557 100644 --- a/ryu/services/protocols/bgp/peer.py +++ b/ryu/services/protocols/bgp/peer.py @@ -1046,7 +1046,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) -- cgit v1.2.3