summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2018-04-13 11:04:27 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-04-18 21:06:25 +0900
commitd31262de7d91c81ff979b39950d2d859666dfa3f (patch)
treedcffc7416306b0ae36deb2685bc19011fc36474b
parentb2e07101e9d579e7ccb98e68108c9752e70a4125 (diff)
fsm: Don't wait EoR if the peer is restarting
RFC4724(Graceful Restart) says that if "Restart State" bit is set in the Open message, its peer must not wait for the EoR marker from the speaker before advertising routing information to the speaker. But currently, GoBGP waits EoR even if "Restart State" bit is set in graceful restart process. This commit fixes it to skipping syncing process for the restarting peers. Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
-rw-r--r--server/fsm.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/fsm.go b/server/fsm.go
index c121c85f..b38cc9a1 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -1169,6 +1169,21 @@ func (h *FSMHandler) opensent() (bgp.FSMState, FsmStateReason) {
h.conn.Close()
return bgp.BGP_FSM_IDLE, FSM_INVALID_MSG
}
+
+ // RFC 4724 3
+ // The most significant bit is defined as the Restart State (R)
+ // bit, ...(snip)... When set (value 1), this bit
+ // indicates that the BGP speaker has restarted, and its peer MUST
+ // NOT wait for the End-of-RIB marker from the speaker before
+ // advertising routing information to the speaker.
+ if fsm.pConf.GracefulRestart.State.LocalRestarting && cap.Flags&0x08 != 0 {
+ log.WithFields(log.Fields{
+ "Topic": "Peer",
+ "Key": fsm.pConf.State.NeighborAddress,
+ "State": fsm.state.String(),
+ }).Debug("peer is restarting, skipping sync process")
+ fsm.pConf.GracefulRestart.State.LocalRestarting = false
+ }
if fsm.pConf.GracefulRestart.Config.NotificationEnabled && cap.Flags&0x04 > 0 {
fsm.pConf.GracefulRestart.State.NotificationEnabled = true
}