MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rtsock_routemsg

Function rtsock_routemsg

freebsd/net/rtsock.c:1885–1907  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1883 * Returns 0 on success.
1884 */
1885int
1886rtsock_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
1909int
1910rtsock_routemsg_info(int cmd, struct rt_addrinfo *info, int fibnum)

Callers 1

rt_routemsgFunction · 0.85

Calls 6

rt_get_familyFunction · 0.85
bzeroFunction · 0.85
nhop_get_rtflagsFunction · 0.85
rtsock_routemsg_infoFunction · 0.85
init_sockaddrs_familyFunction · 0.70
export_rtaddrsFunction · 0.70

Tested by

no test coverage detected