MCPcopy Create free account
hub / github.com/encodeous/nylon / routerHandleRouteUpdate

Method routerHandleRouteUpdate

core/router.go:300–324  ·  view source on GitHub ↗

packet handlers

(node state.NodeId, update *protocol.Ny_Update)

Source from the content-addressed store, hash-verified

298
299// packet handlers
300func (n *Nylon) routerHandleRouteUpdate(node state.NodeId, update *protocol.Ny_Update) error {
301 prefix := netip.Prefix{}
302 err := prefix.UnmarshalBinary(update.Prefix)
303 if err != nil {
304 n.router.log.Warn("received update with invalid prefix", "prefix", update.Prefix, "err", err)
305 return nil
306 }
307 if !n.checkNeigh(node) ||
308 !n.checkPrefix(prefix) ||
309 !n.checkNode(state.NodeId(update.RouterId)) {
310 return nil
311 }
312 HandleNeighbourUpdate(n.RouterState, n, node, state.PubRoute{
313 Source: state.Source{
314 NodeId: state.NodeId(update.RouterId),
315 Prefix: prefix,
316 },
317 FD: state.FD{
318 Seqno: uint16(update.Seqno),
319 Metric: update.Metric,
320 },
321 })
322 ComputeRoutes(n.RouterState, n)
323 return nil
324}
325
326func (n *Nylon) routerHandleAckRetract(neigh state.NodeId, update *protocol.Ny_AckRetract) error {
327 prefix := netip.Prefix{}

Callers 1

handleNylonPacketMethod · 0.95

Calls 6

checkNeighMethod · 0.95
checkPrefixMethod · 0.95
checkNodeMethod · 0.95
NodeIdTypeAlias · 0.92
HandleNeighbourUpdateFunction · 0.85
ComputeRoutesFunction · 0.85

Tested by

no test coverage detected