MCPcopy
hub / github.com/osrg/gobgp / getPathListWithNexthopUpdate

Method getPathListWithNexthopUpdate

pkg/server/zclient.go:367–392  ·  view source on GitHub ↗
(body *zebra.NexthopUpdateBody)

Source from the content-addressed store, hash-verified

365}
366
367func (z *zebraClient) getPathListWithNexthopUpdate(body *zebra.NexthopUpdateBody) []*table.Path {
368 rib := table.NewTableManager(z.server.logger, nil)
369
370 var rfList []bgp.Family
371 switch body.Prefix.Family {
372 case syscall.AF_INET:
373 rfList = []bgp.Family{bgp.RF_IPv4_UC, bgp.RF_IPv4_VPN}
374 case syscall.AF_INET6:
375 rfList = []bgp.Family{bgp.RF_IPv6_UC, bgp.RF_IPv6_VPN}
376 }
377
378 for _, rf := range rfList {
379 tbl, _, err := z.server.getRib("", rf, nil)
380 if err != nil {
381 z.server.logger.Error("failed to get global rib",
382 slog.String("Topic", "Zebra"),
383 slog.String("Family", rf.String()),
384 slog.String("Error", err.Error()),
385 )
386 continue
387 }
388 rib.SetTable(rf, tbl)
389 }
390
391 return rib.GetPathListWithNexthop(table.GLOBAL_RIB_NAME, rfList, body.Prefix.Prefix)
392}
393
394func (z *zebraClient) updatePathByNexthopCache(paths []*table.Path) {
395 z.cacheLock.Lock()

Callers 1

loopMethod · 0.95

Calls 6

SetTableMethod · 0.95
NewTableManagerFunction · 0.92
getRibMethod · 0.80
ErrorMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected