summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-23 00:47:47 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-23 00:47:47 +0900
commit07310dec12ca1d8e9dc0f04798ed4cac9bd0dd6d (patch)
tree4443847f595f10a14bc733a43b59a2210b9b90fc /table/table_manager.go
parent12ae36fb0fecdd068fa4b3a8c1ea36d95b29bf7c (diff)
table: handle timestamp in Path in UpdateIn()
We update rib-in first and then local. So should handle timestamp before adding path to rib-in. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager.go')
-rw-r--r--table/table_manager.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/table/table_manager.go b/table/table_manager.go
index 242b8ae2..a6fda7e3 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -18,6 +18,7 @@ package table
import (
log "github.com/Sirupsen/logrus"
"github.com/osrg/gobgp/packet"
+ "reflect"
"time"
)
@@ -246,12 +247,15 @@ func (adj *AdjRib) update(rib map[bgp.RouteFamily]map[string]*ReceivedRoute, pat
for _, path := range pathList {
rf := path.GetRouteFamily()
key := path.getPrefix()
+ old, found := rib[rf][key]
if path.IsWithdraw() {
- _, found := rib[rf][key]
if found {
delete(rib[rf], key)
}
} else {
+ if found && reflect.DeepEqual(old.path.getPathAttrs(), path.getPathAttrs()) {
+ path.setTimestamp(old.path.getTimestamp())
+ }
rib[rf][key] = NewReceivedRoute(path, false)
}
}