summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPeter Hill <peter.j.hill@oracle.com>2021-08-10 17:07:32 -0700
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2021-08-13 07:43:18 +0900
commit0b449fda7d993575cc141a2d822721fde4fcb0a4 (patch)
treecc0dab2bc18892ec726aa125213d0d2359a992cc
parent696ff4de8ec2906d00de2a21df40e261af59803a (diff)
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.)
-rw-r--r--pkg/server/fsm.go7
1 files changed, 7 insertions, 0 deletions
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)