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

Function rt_get_inet_prefix_pmask

freebsd/net/route/route_ctl.c:308–324  ·  view source on GitHub ↗

* Stores IPv4 address and prefix mask of @rt inside * @paddr and @pmask. Sets mask to INADDR_ANY for host routes. * @pscopeid is currently always set to 0. */

Source from the content-addressed store, hash-verified

306 * @pscopeid is currently always set to 0.
307 */
308void
309rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr,
310 struct in_addr *pmask, uint32_t *pscopeid)
311{
312 const struct sockaddr_in *dst;
313
314 dst = (const struct sockaddr_in *)rt_key_const(rt);
315 KASSERT((dst->sin_family == AF_INET),
316 ("rt family is %d, not inet", dst->sin_family));
317 *paddr = dst->sin_addr;
318 dst = (const struct sockaddr_in *)rt_mask_const(rt);
319 if (dst == NULL)
320 pmask->s_addr = INADDR_BROADCAST;
321 else
322 *pmask = dst->sin_addr;
323 *pscopeid = 0;
324}
325#endif
326
327#ifdef INET6

Callers 4

bsearch4_add_route_cbFunction · 0.85
lradix4_add_route_cbFunction · 0.85
export_rtaddrsFunction · 0.85
export_rtaddrsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected