summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/server.go2
-rw-r--r--server/server_test.go10
2 files changed, 11 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go
index c665e627..366ce40b 100644
--- a/server/server.go
+++ b/server/server.go
@@ -400,7 +400,7 @@ func filterpath(peer *Peer, path, old *table.Path) *table.Path {
// the withdrawal path.
// Thing is same when peer A and we advertized prefix P (as local
// route), then, we withdraws the prefix.
- if old != nil {
+ if path.IsWithdraw == false && old != nil {
return old.Clone(true)
}
}
diff --git a/server/server_test.go b/server/server_test.go
index 33f4cafe..751fdb10 100644
--- a/server/server_test.go
+++ b/server/server_test.go
@@ -234,4 +234,14 @@ func TestFilterpath(t *testing.T) {
// p1 should get the new best (from p2)
assert.Equal(t, filterpath(p1, new, old), path2)
+
+ new, old = cal([]*table.Path{path2.Clone(true)})
+ assert.True(t, new.IsWithdraw)
+ // p2 withdraw so p1 should get withdrawal.
+ path = filterpath(p1, new, old)
+ assert.True(t, path.IsWithdraw)
+
+ // p2 withdraw so p2 should get nothing.
+ path = filterpath(p2, new, old)
+ assert.Nil(t, path)
}