summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/fsm.go9
-rw-r--r--server/server.go4
2 files changed, 13 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
}
diff --git a/server/server.go b/server/server.go
index 4810378e..d8e1d7c8 100644
--- a/server/server.go
+++ b/server/server.go
@@ -235,6 +235,10 @@ func (server *BgpServer) Serve() {
log.Warn("Can't find the neighbor ", e.MsgSrc)
return
}
+ if e.Version != peer.fsm.version {
+ log.Debug("FSM Version inconsistent")
+ return
+ }
m := server.handleFSMMessage(peer, e)
if len(m) > 0 {
senderMsgs = append(senderMsgs, m...)