mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-01-25 02:21:45 +01:00
bgp: Added support to indicate the next hop IP address for the BGP module
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. Based-on: Alan Quillin <alanquillin@gmail.com> Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
1a9008b73e
commit
2a4423fda3
@ -809,6 +809,13 @@ class Path(object):
|
||||
|
||||
return not interested_rts.isdisjoint(curr_rts)
|
||||
|
||||
def is_local(self):
|
||||
return self._source == None
|
||||
|
||||
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, '
|
||||
|
||||
@ -851,11 +851,12 @@ class Peer(Source, Sink, NeighborConfListener, Activity):
|
||||
nlri_list = [path.nlri]
|
||||
|
||||
# By default we use BGPS's interface IP with this peer as next_hop.
|
||||
# TODO(PH): change to use protocol's local address.
|
||||
# next_hop = self.host_bind_ip
|
||||
next_hop = self._session_next_hop(path)
|
||||
if path.is_local() and path.has_nexthop():
|
||||
next_hop = path.nexthop
|
||||
|
||||
# If this is a iBGP peer.
|
||||
if not self.is_ebgp_peer() and path.source is not None:
|
||||
if not self.is_ebgp_peer() and not path.is_local():
|
||||
# If the path came from a bgp peer and not from NC, according
|
||||
# to RFC 4271 we should not modify next_hop.
|
||||
# However RFC 4271 allows us to change next_hop
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user