diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-15 05:58:39 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-04-19 14:15:15 +0900 |
commit | d0c8728ccc3ea916b00b7d6cca3c8fade4f683b4 (patch) | |
tree | 9e2977990e8fee924e5afe88b309788614a34bf8 /table/destination.go | |
parent | 893f92f861291b369532b75baa87a63dca57d2ab (diff) |
table: fix bug of holding flawed withdrawals in Destination struct
When received withdrawals don't match with existing knownPathList,
we must ignore them.
This commit fixes not to store un-matched withdrawals in
`dest.withdrawList` to avoid unintentional withdrawal.
see test case for detail
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r-- | table/destination.go | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/table/destination.go b/table/destination.go index 5603f894..2111f695 100644 --- a/table/destination.go +++ b/table/destination.go @@ -306,7 +306,6 @@ func (dest *Destination) explicitWithdraw() paths { // delete them first. matches := make([]*Path, 0, len(dest.withdrawList)/2) newKnownPaths := make([]*Path, 0, len(dest.knownPathList)/2) - newWithdrawPaths := make([]*Path, 0, len(dest.withdrawList)/2) // Match all withdrawals from destination paths. for _, withdraw := range dest.withdrawList { @@ -326,21 +325,10 @@ func (dest *Destination) explicitWithdraw() paths { "Topic": "Table", "Key": dest.GetNlri().String(), "Path": withdraw, - }).Debug("No matching path for withdraw found, may be path was not installed into table") - newWithdrawPaths = append(newWithdrawPaths, withdraw) + }).Warn("No matching path for withdraw found, may be path was not installed into table") } } - // If we have partial match. - if len(newWithdrawPaths) > 0 { - log.WithFields(log.Fields{ - "Topic": "Table", - "Key": dest.GetNlri().String(), - "MatchLength": len(matches), - "WithdrawLength": len(dest.withdrawList), - }).Debug("Did not find match for some withdrawals.") - } - for _, path := range dest.knownPathList { if !path.IsWithdraw { newKnownPaths = append(newKnownPaths, path) @@ -348,7 +336,7 @@ func (dest *Destination) explicitWithdraw() paths { } dest.knownPathList = newKnownPaths - dest.withdrawList = newWithdrawPaths + dest.withdrawList = make([]*Path, 0) return matches } |