* 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. */
| 306 | * @pscopeid is currently always set to 0. |
| 307 | */ |
| 308 | void |
| 309 | rt_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 |
no outgoing calls
no test coverage detected