diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-09-24 08:30:23 +0000 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-10-04 04:08:35 +0000 |
commit | c2ad9462d661133a72c81da73a1c964390c93001 (patch) | |
tree | 20b6d1e030e3229c57a5cc29eb674cf314ad2aa1 /server/server.go | |
parent | cda8d873fa0cc508ac8756a7da95f79253116aae (diff) |
server: fix bug of withdrawal handling
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/server/server.go b/server/server.go index 7b47b67b..e51ba977 100644 --- a/server/server.go +++ b/server/server.go @@ -360,23 +360,25 @@ func filterpath(peer *Peer, path *table.Path, withdrawals []*table.Path) *table. } if peer.ID() == path.GetSource().Address.String() { - // Say, gobgp was advertising prefix A and peer P also. - // When gobgp withdraws prefix A, best path calculation chooses - // the path from P as the best path for prefix A. - // For peers other than P, this path should be advertised - // (as implicit withdrawal). However for P, we should advertise - // the local withdraw path. - // 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 _, w := range withdrawals { - if w.IsLocal() && path.GetNlri().String() == w.GetNlri().String() { - return w + if !peer.isRouteServerClient() { + // Say, peer A and B advertized same prefix P, and + // best path calculation chose a path from B as best. + // When B withdraws prefix P, best path calculation chooses + // the path from A as best. + // For peers other than A, this path should be advertised + // (as implicit withdrawal). However for A, we should advertise + // the withdrawal path. + // Thing is same when peer A and we advertized prefix P (as local + // route), then, we withdraws the prefix. + for _, w := range withdrawals { + if path.GetNlri().String() == w.GetNlri().String() { + return w + } } } log.WithFields(log.Fields{ |