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

Function rt_get_inet_prefix_plen

freebsd/net/route/route_ctl.c:285–301  ·  view source on GitHub ↗

* Stores IPv4 address and prefix length of @rt inside * @paddr and @plen. * @pscopeid is currently always set to 0. */

Source from the content-addressed store, hash-verified

283 * @pscopeid is currently always set to 0.
284 */
285void
286rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr,
287 int *plen, uint32_t *pscopeid)
288{
289 const struct sockaddr_in *dst;
290
291 dst = (const struct sockaddr_in *)rt_key_const(rt);
292 KASSERT((dst->sin_family == AF_INET),
293 ("rt family is %d, not inet", dst->sin_family));
294 *paddr = dst->sin_addr;
295 dst = (const struct sockaddr_in *)rt_mask_const(rt);
296 if (dst == NULL)
297 *plen = 32;
298 else
299 *plen = bitcount32(dst->sin_addr.s_addr);
300 *pscopeid = 0;
301}
302
303/*
304 * Stores IPv4 address and prefix mask of @rt inside

Callers 5

get_parent_ruleFunction · 0.85
handle_rtable_change_cbFunction · 0.85
add_route_cbFunction · 0.85
ta_dump_kfib_tentry_intFunction · 0.85
hash_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected