* This is used in dumping the kernel table via sysctl(). */
| 2113 | * This is used in dumping the kernel table via sysctl(). |
| 2114 | */ |
| 2115 | static int |
| 2116 | sysctl_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 | |
| 2146 | static int |
nothing calls this directly
no test coverage detected