0
a href=”http://ntwrk.guru/bgp-code-dive-8/”>In the last session of snaproute BGP code dive—number 8, in fact— I started looking at how snaproute’s BGP moves from connect to open. This is the chain of calls from that post—
- st.fsm.StopConnectRetryTimer()
- st.fsm.SetPeerConn(data)
- st.fsm.sendOpenMessage()
- st.fsm.SetHoldTime(st.fsm.neighborConf.RunningConf.HoldTime, st.fsm.neighborConf.RunningConf.KeepaliveTime)
- st.fsm.StartHoldTimer()
- st.BaseState.fsm.ChangeState(NewOpenSentState(st.BaseState.fsm))
The past post covered the first two steps in this process, so this post will begin with the third step, st.fsm.sendOpenMessage().
Note the function call has st.fm...
in the front, so this is a call by reference. Each FSM that is spun up (think of them as threads, or even processes, if you must, to get this concept in your head, even though they’re not) can have its own copy of this function, with its own state. When reading the code to sort out how it works, this doesn’t have much practical impact, other than telling us the sendOpenMessage
function we’re looking for is going to be in the FSM file. The function is located around line 1233 in fsm.go:
func (fsm *FSM) sendOpenMessage() {
optParams := packet.ConstructOptParams(uint32(fsm. Continue reading