diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-07-22 05:02:17 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-03 12:09:07 +0900 |
commit | b5e49f1319c37b4da3a010e09fc370d9285bb828 (patch) | |
tree | 104ca8f3d3220993560317d7227cde4a21c88ed1 /server/peer.go | |
parent | 87bd4c1648e4aa6982add12d84ddf299aca1f4d7 (diff) |
server: fix advertising multiple local withdrawals with same prefix
a bug introduced by 332766189685028c4f9852e4285fb1a9025223cc
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/server/peer.go b/server/peer.go index 030044d0..d27f96e6 100644 --- a/server/peer.go +++ b/server/peer.go @@ -128,7 +128,7 @@ func (peer *Peer) getAccepted(rfList []bgp.RouteFamily) []*table.Path { return peer.adjRibIn.PathList(rfList, true) } -func (peer *Peer) filterpath(path *table.Path) *table.Path { +func (peer *Peer) filterpath(path *table.Path, withdrawals []*table.Path) *table.Path { // special handling for RTC nlri // see comments in (*Destination).Calculate() if path != nil && path.GetRouteFamily() == bgp.RF_RTC_UC && !path.IsWithdraw { @@ -147,7 +147,7 @@ func (peer *Peer) filterpath(path *table.Path) *table.Path { } } } - if filterpath(peer, path) == nil { + if path = filterpath(peer, path, withdrawals); path == nil { return nil } @@ -172,7 +172,7 @@ func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []* pathList := []*table.Path{} filtered := []*table.Path{} for _, path := range peer.localRib.GetBestPathList(peer.TableID(), rfList) { - if p := peer.filterpath(path); p != nil { + if p := peer.filterpath(path, nil); p != nil { pathList = append(pathList, p) } else { filtered = append(filtered, path) @@ -200,23 +200,9 @@ func (peer *Peer) processOutgoingPaths(paths, withdrawals []*table.Path) []*tabl } outgoing := make([]*table.Path, 0, len(paths)) - // Note: multiple paths having the same prefix could exist the - // withdrawals list in the case of Route Server setup with - // import policies modifying paths. In such case, gobgp sends - // duplicated update messages; withdraw messages for the same - // prefix. - // However, currently we don't support local path for Route - // Server setup so this is NOT the case. - for _, path := range withdrawals { - if path.IsLocal() { - if _, ok := peer.fsm.rfMap[path.GetRouteFamily()]; ok { - outgoing = append(outgoing, path) - } - } - } for _, path := range paths { - if p := peer.filterpath(path); p != nil { + if p := peer.filterpath(path, withdrawals); p != nil { outgoing = append(outgoing, p) } } |