| 717 | } |
| 718 | |
| 719 | static int |
| 720 | in_handle_prefix_route(uint32_t fibnum, int cmd, |
| 721 | struct sockaddr_in *dst, struct sockaddr_in *netmask, struct ifaddr *ifa, |
| 722 | struct ifnet *ifp) |
| 723 | { |
| 724 | |
| 725 | NET_EPOCH_ASSERT(); |
| 726 | |
| 727 | /* Prepare gateway */ |
| 728 | struct sockaddr_dl_short sdl = { |
| 729 | .sdl_family = AF_LINK, |
| 730 | .sdl_len = sizeof(struct sockaddr_dl_short), |
| 731 | .sdl_type = ifa->ifa_ifp->if_type, |
| 732 | .sdl_index = ifa->ifa_ifp->if_index, |
| 733 | }; |
| 734 | |
| 735 | struct rt_addrinfo info = { |
| 736 | .rti_ifa = ifa, |
| 737 | .rti_ifp = ifp, |
| 738 | .rti_flags = RTF_PINNED | ((netmask != NULL) ? 0 : RTF_HOST), |
| 739 | .rti_info = { |
| 740 | [RTAX_DST] = (struct sockaddr *)dst, |
| 741 | [RTAX_NETMASK] = (struct sockaddr *)netmask, |
| 742 | [RTAX_GATEWAY] = (struct sockaddr *)&sdl, |
| 743 | }, |
| 744 | /* Ensure we delete the prefix IFF prefix ifa matches */ |
| 745 | .rti_filter = in_match_ifaddr, |
| 746 | .rti_filterdata = ifa, |
| 747 | }; |
| 748 | |
| 749 | return (rib_handle_ifaddr_info(fibnum, cmd, &info)); |
| 750 | } |
| 751 | |
| 752 | /* |
| 753 | * Routing table interaction with interface addresses. |
no test coverage detected