summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go
index 435c9f72..ba30f578 100644
--- a/server/server.go
+++ b/server/server.go
@@ -2133,6 +2133,7 @@ type watchOptions struct {
preUpdate bool
postUpdate bool
peerState bool
+ initBest bool
initUpdate bool
initPostUpdate bool
initPeerState bool
@@ -2141,9 +2142,12 @@ type watchOptions struct {
type WatchOption func(*watchOptions)
-func WatchBestPath() WatchOption {
+func WatchBestPath(current bool) WatchOption {
return func(o *watchOptions) {
o.bestpath = true
+ if current {
+ o.initBest = true
+ }
}
}
@@ -2319,6 +2323,12 @@ func (s *BgpServer) Watch(opts ...WatchOption) (w *Watcher) {
w.notify(createWatchEventPeerState(peer))
}
}
+ if w.opts.initBest {
+ w.notify(&WatchEventBestPath{
+ PathList: s.globalRib.GetBestPathList(table.GLOBAL_RIB_NAME, nil),
+ MultiPathList: s.globalRib.GetBestMultiPathList(table.GLOBAL_RIB_NAME, nil),
+ })
+ }
if w.opts.initUpdate {
for _, peer := range s.neighborMap {
if peer.fsm.state != bgp.BGP_FSM_ESTABLISHED {