From 0b449fda7d993575cc141a2d822721fde4fcb0a4 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Tue, 10 Aug 2021 17:07:32 -0700 Subject: Update the hold timer when a BGP Update message is received According to RFC4271, The calculated value indicates the maximum number of seconds that may elapse between the receipt of successive KEEPALIVE and/or UPDATE messages from the sender. This change will reset the hold timer in the update FSM case. (note, I am super new with Go. I'm not quite sure how to craft a good test case for this.) --- pkg/server/fsm.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/server/fsm.go b/pkg/server/fsm.go index abd94ed9..fedf3018 100644 --- a/pkg/server/fsm.go +++ b/pkg/server/fsm.go @@ -1019,6 +1019,13 @@ func (h *fsmHandler) recvMessageWithError() (*fsmMsg, error) { case bgp.BGP_MSG_ROUTE_REFRESH: fmsg.MsgType = fsmMsgRouteRefresh case bgp.BGP_MSG_UPDATE: + // if the length of h.holdTimerResetCh + // isn't zero, the timer will be reset + // soon anyway. + select { + case h.holdTimerResetCh <- true: + default: + } body := m.Body.(*bgp.BGPUpdate) isEBGP := h.fsm.pConf.IsEBGPPeer(h.fsm.gConf) isConfed := h.fsm.pConf.IsConfederationMember(h.fsm.gConf) -- cgit v1.2.3