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

Function sysctl_dumpentry

freebsd/net/rtsock.c:2115–2143  ·  view source on GitHub ↗

* This is used in dumping the kernel table via sysctl(). */

Source from the content-addressed store, hash-verified

2113 * This is used in dumping the kernel table via sysctl().
2114 */
2115static int
2116sysctl_dumpentry(struct rtentry *rt, void *vw)
2117{
2118 struct walkarg *w = vw;
2119 struct nhop_object *nh;
2120 int error = 0;
2121
2122 NET_EPOCH_ASSERT();
2123
2124 export_rtaddrs(rt, w->dst, w->mask);
2125 if (!can_export_rte(w->w_req->td->td_ucred, rt_is_host(rt), w->dst))
2126 return (0);
2127 nh = rt_get_raw_nhop(rt);
2128#ifdef ROUTE_MPATH
2129 if (NH_IS_NHGRP(nh)) {
2130 struct weightened_nhop *wn;
2131 uint32_t num_nhops;
2132 wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops);
2133 for (int i = 0; i < num_nhops; i++) {
2134 error = sysctl_dumpnhop(rt, wn[i].nh, wn[i].weight, w);
2135 if (error != 0)
2136 return (error);
2137 }
2138 } else
2139#endif
2140 error = sysctl_dumpnhop(rt, nh, rt->rt_weight, w);
2141
2142 return (0);
2143}
2144
2145
2146static int

Callers

nothing calls this directly

Calls 6

rt_is_hostFunction · 0.85
rt_get_raw_nhopFunction · 0.85
sysctl_dumpnhopFunction · 0.85
export_rtaddrsFunction · 0.70
can_export_rteFunction · 0.70
nhgrp_get_nhopsFunction · 0.50

Tested by

no test coverage detected