* Checks if data in @info matches nexhop @nh. * * Returns 0 on success, * ESRCH if not matched, * ENOENT if filter function returned false */
| 447 | * ENOENT if filter function returned false |
| 448 | */ |
| 449 | int |
| 450 | check_info_match_nhop(const struct rt_addrinfo *info, const struct rtentry *rt, |
| 451 | const struct nhop_object *nh) |
| 452 | { |
| 453 | const struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; |
| 454 | |
| 455 | if (info->rti_filter != NULL) { |
| 456 | if (info->rti_filter(rt, nh, info->rti_filterdata) == 0) |
| 457 | return (ENOENT); |
| 458 | else |
| 459 | return (0); |
| 460 | } |
| 461 | if ((gw != NULL) && !match_nhop_gw(nh, gw)) |
| 462 | return (ESRCH); |
| 463 | |
| 464 | return (0); |
| 465 | } |
| 466 | |
| 467 | /* |
| 468 | * Checks if nexhop @nh can be rewritten by data in @info because |
no test coverage detected