* 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. */
| 491 | * If rtentry was found, saves nexthop / weight value into @rnd. |
| 492 | */ |
| 493 | static struct rtentry * |
| 494 | lookup_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. |