snaproute Go BGP Code Dive (10): Moving to Established
In the last post on this topic, we traced how snaproute’s BGP code moved to the open state. At the end of that post, the speaker encodes an open message using packet, _ := bgpOpenMsg.Encode()
, and then sends it. What we should be expecting next is for an open message from the new peer to be received and processed. Receiving this open message will be an event, so what we’re going to need to look for is someplace in the code that processes the receipt of an open message. All the way back in the fifth post of this series, we actually unraveled this chain, and found this is the call chain we’re looking for—
- func (st *OpenSentState) processEvent()
- st.fsm.StopConnectRetryTimer()
- bgpMsg := data.(*packet.BGPMessage)
- if st.fsm.ProcessOpenMessage(bgpMsg) {
- st.fsm.sendKeepAliveMessage()
- st.fsm.StartHoldTimer()
- st.fsm.ChangeState(NewOpenConfirmState(st.fsm)) }
I don’t want to retrace all those steps here, but the call to func (st *OpenSentState) processEvent()
(around line 444 in fsm.go
) looks correct. The call in question must be a call to a function that processes an event while the peer is in the open state. This call seems to satisfy both Continue reading