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

Function bsearch4_add_route_cb

freebsd/netinet/in_fib_algo.c:197–215  ·  view source on GitHub ↗

* Callback storing converted rtable prefixes in the temporary array. * Addresses are converted to a host order. */

Source from the content-addressed store, hash-verified

195 * Addresses are converted to a host order.
196 */
197static enum flm_op_result
198bsearch4_add_route_cb(struct rtentry *rt, void *_data)
199{
200 struct bsearch4_data *bd = (struct bsearch4_data *)_data;
201 struct bsearch4_record *rr;
202 struct in_addr addr4, mask4;
203 uint32_t scopeid;
204
205 if (bd->num_items >= bd->alloc_items)
206 return (FLM_REBUILD);
207
208 rr = &bd->rr[bd->num_items++];
209 rt_get_inet_prefix_pmask(rt, &addr4, &mask4, &scopeid);
210 rr->addr4 = ntohl(addr4.s_addr);
211 rr->mask4 = ntohl(mask4.s_addr);
212 rr->nh = rt_get_raw_nhop(rt);
213
214 return (FLM_SUCCESS);
215}
216
217/*
218 * Prefix comparison function.

Callers

nothing calls this directly

Calls 2

rt_get_inet_prefix_pmaskFunction · 0.85
rt_get_raw_nhopFunction · 0.85

Tested by

no test coverage detected