| 601 | } |
| 602 | |
| 603 | static struct nhop_object * |
| 604 | select_nhop(struct nhop_object *nh, const struct sockaddr *gw) |
| 605 | { |
| 606 | if (!NH_IS_NHGRP(nh)) |
| 607 | return (nh); |
| 608 | #ifdef ROUTE_MPATH |
| 609 | struct weightened_nhop *wn; |
| 610 | uint32_t num_nhops; |
| 611 | wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); |
| 612 | if (gw == NULL) |
| 613 | return (wn[0].nh); |
| 614 | for (int i = 0; i < num_nhops; i++) { |
| 615 | if (match_nhop_gw(wn[i].nh, gw)) |
| 616 | return (wn[i].nh); |
| 617 | } |
| 618 | #endif |
| 619 | return (NULL); |
| 620 | } |
| 621 | |
| 622 | /* |
| 623 | * Handles RTM_GET message from routing socket, returning matching rt. |
no test coverage detected