diff options
-rw-r--r-- | pkg/server/bmp.go | 2 | ||||
-rw-r--r-- | pkg/server/fsm.go | 1 | ||||
-rw-r--r-- | pkg/server/server.go | 13 |
3 files changed, 16 insertions, 0 deletions
diff --git a/pkg/server/bmp.go b/pkg/server/bmp.go index 6742a813..724101ff 100644 --- a/pkg/server/bmp.go +++ b/pkg/server/bmp.go @@ -288,6 +288,8 @@ func bmpPeerDown(ev *watchEventPeerState, t uint8, policy bool, pd uint64) *bmp. reasonCode = bmp.BMP_PEER_DOWN_REASON_REMOTE_BGP_NOTIFICATION case fsmReadFailed, fsmWriteFailed: reasonCode = bmp.BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICATION + case fsmDeConfigured: + reasonCode = bmp.BMP_PEER_DOWN_REASON_PEER_DE_CONFIGURED } return bmp.NewBMPPeerDownNotification(*ph, uint8(reasonCode), ev.StateReason.BGPNotification, ev.StateReason.Data) } diff --git a/pkg/server/fsm.go b/pkg/server/fsm.go index e66054c7..178c9cd5 100644 --- a/pkg/server/fsm.go +++ b/pkg/server/fsm.go @@ -57,6 +57,7 @@ const ( fsmOpenMsgReceived fsmOpenMsgNegotiated fsmHardReset + fsmDeConfigured ) type fsmStateReason struct { diff --git a/pkg/server/server.go b/pkg/server/server.go index cdc557b5..9871d4ac 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -337,6 +337,19 @@ func (s *BgpServer) Serve() { "State": state, }).Debug("freed fsm.h") + if fsm.state == bgp.BGP_FSM_ESTABLISHED { + s.notifyWatcher(watchEventTypePeerState, &watchEventPeerState{ + PeerAS: fsm.peerInfo.AS, + PeerAddress: fsm.peerInfo.Address, + PeerID: fsm.peerInfo.ID, + State: bgp.BGP_FSM_IDLE, + Timestamp: time.Now(), + StateReason: &fsmStateReason{ + Type: fsmDeConfigured, + }, + }) + } + cleanInfiniteChannel(fsm.outgoingCh) cleanInfiniteChannel(fsm.incomingCh) s.delIncoming(fsm.incomingCh) |