Archive

Category Archives for "Russ White"

snaproute Go BGP Code Dive (5): Starting a Peer

Last time we looked at the snaproute BGP code, we discovered the peer bringup process is a finite state machine. With this in mind, let’s try to unravel the state machine into a set of calls, beginning from our original starting point, a debug message that prints on the screen when a new peering relationship is established. The key word in the debug message was ConnEstablished, which led to:

func (fsm *FSM) ConnEstablished() {
fsm.logger.Info(fmt.Sprintln("Neighbor:", fsm.pConf.NeighborAddress, "FSM", fsm.id, "ConnEstablished - start"))
fsm.Manager.fsmEstablished(fsm.id, fsm.peerConn.conn)
fsm.logger.Info(fmt.Sprintln("Neighbor:", fsm.pConf.NeighborAddress, "FSM", fsm.id, "ConnEstablished - end"))
}

From here, we searched for calls to ConnEstablished, and found—

func (fsm *FSM) ChangeState(newState BaseStateIface) {
...
if oldState == BGPFSMEstablished && fsm.State.state() != BGPFSMEstablished {
fsm.ConnBroken()
} else if oldState != BGPFSMEstablished && fsm.State.state() == BGPFSMEstablished {
fsm.ConnEstablished()
}
}

Looking for ChangeState leads us to a lot of different calls, but only one that seems to relate to establishing a new peer, as evidenced by a state that relates to established in some way. This, in turn, leads to—

func (st *OpenConfirmState) processEvent(event BGPFSMEvent, data Continue reading

Light Posting Week—IETF in Berlin

Y’all—I’m in Berlin at the IETF this week, so I won’t be posting as many “long articles” as usual. I will have my usual slate of worth reading/etc. If anyone has questions about the IETF they’d like answered, feel free to comment here… I should be back to some state closer to normal next week, but between Live last week and the IETF this week, I’ve just not had my normal dose of “writing time” to work with.

LinkedInTwitterGoogle+Facebook

The post Light Posting Week—IETF in Berlin appeared first on 'net work.

BGP Code Dive (4): Starting a Peer

In the last three episodes of this series, we discussed getting a copy of SnapRoute’s BGP code using Git, we looked at the basic structure of the project, and then we did some general housekeeping. At this point, I’m going to assume you have the tools you need installed, and you’re ready to follow along as we ask the code questions about how BGP actually works.

Now, let’s start with a simple question: how does BGP bring a new peer up?

It seems like we should be able to look for some file that’s named something with peering in it, but, looking at the files in the project, there doesn’t seem to be any such thing (click to show a larger version of the image below if you can’t read it).

ls-go-bgp

Hmmm… Given it’s not obvious where to start, what do we do? There are a number of options, of course, but three options stand out as the easiest.

First, you can just poke around the code for a bit to see if you find anything that looks like it might be what you’re looking for. This is not, generally, for the faint of heart. Over time, as you become Continue reading