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>
This commit is contained in:
Satoshi Fujimoto 2017-03-24 13:11:05 +09:00 committed by FUJITA Tomonori
parent b7dcd40837
commit 399a03feb1

View File

@ -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)