packet handlers
(node state.NodeId, update *protocol.Ny_Update)
| 298 | |
| 299 | // packet handlers |
| 300 | func (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 | |
| 326 | func (n *Nylon) routerHandleAckRetract(neigh state.NodeId, update *protocol.Ny_AckRetract) error { |
| 327 | prefix := netip.Prefix{} |
no test coverage detected