* Announce route addition/removal to rtsock based on @rt data. * Callers are advives to use rt_routemsg() instead of using this * function directly. * Assume @rt data is consistent. * * Returns 0 on success. */
| 1883 | * Returns 0 on success. |
| 1884 | */ |
| 1885 | int |
| 1886 | rtsock_routemsg(int cmd, struct rtentry *rt, struct nhop_object *nh, |
| 1887 | int fibnum) |
| 1888 | { |
| 1889 | union sockaddr_union dst, mask; |
| 1890 | struct rt_addrinfo info; |
| 1891 | |
| 1892 | if (V_route_cb.any_count == 0) |
| 1893 | return (0); |
| 1894 | |
| 1895 | int family = rt_get_family(rt); |
| 1896 | init_sockaddrs_family(family, &dst.sa, &mask.sa); |
| 1897 | export_rtaddrs(rt, &dst.sa, &mask.sa); |
| 1898 | |
| 1899 | bzero((caddr_t)&info, sizeof(info)); |
| 1900 | info.rti_info[RTAX_DST] = &dst.sa; |
| 1901 | info.rti_info[RTAX_NETMASK] = &mask.sa; |
| 1902 | info.rti_info[RTAX_GATEWAY] = &nh->gw_sa; |
| 1903 | info.rti_flags = rt->rte_flags | nhop_get_rtflags(nh); |
| 1904 | info.rti_ifp = nh->nh_ifp; |
| 1905 | |
| 1906 | return (rtsock_routemsg_info(cmd, &info, fibnum)); |
| 1907 | } |
| 1908 | |
| 1909 | int |
| 1910 | rtsock_routemsg_info(int cmd, struct rt_addrinfo *info, int fibnum) |
no test coverage detected