summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-03-24 13:11:05 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-03-28 11:01:11 +0900
commit399a03feb1984e660f8f51d03d3ce4d09a774b70 (patch)
treedde71c527b64bfa1dcd95ae7aea263b8554bd880
parentb7dcd408374ad805895c7d76e1fe6b4fcca87693 (diff)
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 <satoshi.fujimoto7@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/peer.py5
1 files changed, 4 insertions, 1 deletions
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)