diff options
Diffstat (limited to 'server/fsm.go')
-rw-r--r-- | server/fsm.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/fsm.go b/server/fsm.go index 0f3e5538..3ae70856 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -100,6 +100,7 @@ type FsmMsg struct { PathList []*table.Path timestamp time.Time payload []byte + Version uint } type FsmOutgoingMsg struct { @@ -134,6 +135,8 @@ func (s AdminState) String() string { } } +var fsmVersion uint + type FSM struct { t tomb.Tomb gConf *config.Global @@ -154,6 +157,7 @@ type FSM struct { peerInfo *table.PeerInfo policy *table.RoutingPolicy gracefulRestartTimer *time.Timer + version uint } func (fsm *FSM) bgpMessageStateUpdate(MessageType uint8, isIn bool) { @@ -212,6 +216,7 @@ func NewFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingP } pConf.State.SessionState = config.IntToSessionStateMap[int(bgp.BGP_FSM_IDLE)] pConf.Timers.State.Downtime = time.Now().Unix() + fsmVersion++ fsm := &FSM{ gConf: gConf, pConf: pConf, @@ -226,6 +231,7 @@ func NewFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingP peerInfo: table.NewPeerInfo(gConf, pConf), policy: policy, gracefulRestartTimer: time.NewTimer(time.Hour), + version: fsmVersion, } fsm.gracefulRestartTimer.Stop() fsm.t.Go(fsm.connectLoop) @@ -606,6 +612,7 @@ func (h *FSMHandler) recvMessageWithError() (*FsmMsg, error) { MsgType: FSM_MSG_BGP_MESSAGE, MsgSrc: h.fsm.pConf.Config.NeighborAddress, MsgData: err, + Version: h.fsm.version, } return fmsg, err } @@ -628,6 +635,7 @@ func (h *FSMHandler) recvMessageWithError() (*FsmMsg, error) { MsgType: FSM_MSG_BGP_MESSAGE, MsgSrc: h.fsm.pConf.Config.NeighborAddress, timestamp: now, + Version: h.fsm.version, } if err != nil { log.WithFields(log.Fields{ @@ -1278,6 +1286,7 @@ func (h *FSMHandler) loop() error { MsgType: FSM_MSG_STATE_CHANGE, MsgSrc: fsm.pConf.Config.NeighborAddress, MsgData: nextState, + Version: h.fsm.version, } h.stateCh <- e } |