* Stores IPv4 address and prefix length of @rt inside * @paddr and @plen. * @pscopeid is currently always set to 0. */
| 283 | * @pscopeid is currently always set to 0. |
| 284 | */ |
| 285 | void |
| 286 | rt_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 |
no outgoing calls
no test coverage detected