diff options
-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 { |