diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-04-11 21:45:54 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-07 21:18:04 +0900 |
commit | 6110fad59441454c8a6f534874ae29b770098b73 (patch) | |
tree | 6722d3ab737b71cf90340ce7c598398314770fac | |
parent | 957917651e48e552491d9a6272db296cb5c0a295 (diff) |
avoid updating Path in the rib via MarkStale()
A path object in the adj-in is also in the master rib. We can't update
such.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/peer.go | 4 | ||||
-rw-r--r-- | server/server.go | 2 | ||||
-rw-r--r-- | table/adj.go | 15 |
3 files changed, 15 insertions, 6 deletions
diff --git a/server/peer.go b/server/peer.go index 4be180a5..3bdd9965 100644 --- a/server/peer.go +++ b/server/peer.go @@ -636,8 +636,8 @@ func (peer *Peer) startFSMHandler(incoming *channels.InfiniteChannel, stateCh ch peer.fsm.h = NewFSMHandler(peer.fsm, incoming, stateCh, peer.outgoing) } -func (peer *Peer) StaleAll(rfList []bgp.RouteFamily) { - peer.adjRibIn.StaleAll(rfList) +func (peer *Peer) StaleAll(rfList []bgp.RouteFamily) []*table.Path { + return peer.adjRibIn.StaleAll(rfList) } func (peer *Peer) PassConn(conn *net.TCPConn) { diff --git a/server/server.go b/server/server.go index 30fb9c22..51346da9 100644 --- a/server/server.go +++ b/server/server.go @@ -768,7 +768,7 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) { peer.fsm.pConf.GracefulRestart.State.PeerRestarting = true var p []bgp.RouteFamily p, drop = peer.forwardingPreservedFamilies() - peer.StaleAll(p) + server.propagateUpdate(peer, peer.StaleAll(p)) } else { drop = peer.configuredRFlist() } diff --git a/table/adj.go b/table/adj.go index d16f8d76..68e79d17 100644 --- a/table/adj.go +++ b/table/adj.go @@ -127,14 +127,23 @@ func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path { return pathList } -func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) { +func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) []*Path { + pathList := make([]*Path, 0) for _, rf := range rfList { if table, ok := adj.table[rf]; ok { - for _, p := range table { - p.MarkStale(true) + l := make([]*Path, 0, len(table)) + for k, p := range table { + n := p.Clone(false) + n.MarkStale(true) + table[k] = n + l = append(l, n) + } + if len(l) > 0 { + pathList = append(pathList, l...) } } } + return pathList } func (adj *AdjRib) Exists(path *Path) bool { |