diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-09-08 21:12:43 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-09-10 11:32:17 +0900 |
commit | 66eeb5b1fe6bee630c2f88fcfd16c6444c538673 (patch) | |
tree | 827e6cd8e867156df64336d271225739c7bfb757 | |
parent | 969b4b6837ee29c1158d44878fbf3d555b96e81a (diff) |
bgp: enable nexthop_self for locally generated routes
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/services/protocols/bgp/peer.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py index 67ba85c0..c8eae4bc 100644 --- a/ryu/services/protocols/bgp/peer.py +++ b/ryu/services/protocols/bgp/peer.py @@ -851,24 +851,18 @@ class Peer(Source, Sink, NeighborConfListener, Activity): nlri_list = [path.nlri] # By default we use BGPS's interface IP with this peer as next_hop. - next_hop = self._session_next_hop(path) - if path.is_local() and path.has_nexthop(): + if self.is_ebgp_peer(): + next_hop = self._session_next_hop(path) + if path.is_local() and path.has_nexthop(): + next_hop = path.nexthop + else: next_hop = path.nexthop - - # If this is a iBGP peer. - 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 + # RFC 4271 allows us to change next_hop # if configured to announce its own ip address. if self._neigh_conf.is_next_hop_self: - next_hop = self.host_bind_ip - if path.route_family == RF_IPv6_VPN: - next_hop = self._ipv4_mapped_ipv6(next_hop) + 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) - else: - next_hop = path.nexthop nexthop_attr = BGPPathAttributeNextHop(next_hop) assert nexthop_attr, 'Missing NEXTHOP mandatory attribute.' |