MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lookup_prefix_bysa

Function lookup_prefix_bysa

freebsd/net/route/route_ctl.c:493–512  ·  view source on GitHub ↗

* Runs exact prefix match based on @dst and @netmask. * Returns matched @rtentry if found or NULL. * If rtentry was found, saves nexthop / weight value into @rnd. */

Source from the content-addressed store, hash-verified

491 * If rtentry was found, saves nexthop / weight value into @rnd.
492 */
493static struct rtentry *
494lookup_prefix_bysa(struct rib_head *rnh, const struct sockaddr *dst,
495 const struct sockaddr *netmask, struct route_nhop_data *rnd)
496{
497 struct rtentry *rt;
498
499 RIB_LOCK_ASSERT(rnh);
500
501 rt = (struct rtentry *)rnh->rnh_lookup(__DECONST(void *, dst),
502 __DECONST(void *, netmask), &rnh->head);
503 if (rt != NULL) {
504 rnd->rnd_nhop = rt->rt_nhop;
505 rnd->rnd_weight = rt->rt_weight;
506 } else {
507 rnd->rnd_nhop = NULL;
508 rnd->rnd_weight = 0;
509 }
510
511 return (rt);
512}
513
514/*
515 * Runs exact prefix match based on dst/netmask from @info.

Callers 1

lookup_prefixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected