From fead8a63e41d4e7626b6c648d3b8de4968ad515b Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Thu, 19 Apr 2018 16:08:33 +0900 Subject: server: Prefer RTC route from RR client In case that a Route Reflector(RR) and a non RR client peering, peering of different RR clusters for example, the RR should send the RTC route from its client even if the RTC route from non RR client is better path based on the best path algorithm in order to notify that some RR clients are interested in the given Route Target. Currently, only source peer address is concerned, the RTC route from RR client can have lower priority than non RR client and it can not be advertised. This patch fixes to prefer the route from RR client when selecting the candidate to be advertised. Signed-off-by: IWASE Yusuke --- server/server.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'server') diff --git a/server/server.go b/server/server.go index 6deea0dd..ceaef726 100644 --- a/server/server.go +++ b/server/server.go @@ -491,10 +491,17 @@ func (s *BgpServer) filterpath(peer *Peer, path, old *table.Path) *table.Path { dst := peer.localRib.GetDestination(path) path = nil for _, p := range dst.GetKnownPathList(peer.TableID(), peer.AS()) { - // Just take care not to send back. - if peer.ID() != p.GetSource().Address.String() { - path = p - break + srcPeer := p.GetSource() + if peer.ID() != srcPeer.Address.String() { + if srcPeer.RouteReflectorClient { + // The path from a RR client is preferred than others + // for the case that RR and non RR client peering + // (e.g., peering of different RR clusters). + path = p + break + } else if path == nil { + path = p + } } } } -- cgit v1.2.3