| 315 | #endif |
| 316 | |
| 317 | static int |
| 318 | cleanup_xaddrs(struct rt_addrinfo *info) |
| 319 | { |
| 320 | int error = EAFNOSUPPORT; |
| 321 | |
| 322 | if (info->rti_info[RTAX_DST] == NULL) |
| 323 | return (EINVAL); |
| 324 | |
| 325 | if (info->rti_flags & RTF_LLDATA) { |
| 326 | /* |
| 327 | * arp(8)/ndp(8) sends RTA_NETMASK for the associated |
| 328 | * prefix along with the actual address in RTA_DST. |
| 329 | * Remove netmask to avoid unnecessary address masking. |
| 330 | */ |
| 331 | remove_netmask(info); |
| 332 | } |
| 333 | |
| 334 | switch (info->rti_info[RTAX_DST]->sa_family) { |
| 335 | case AF_INET: |
| 336 | error = cleanup_xaddrs_inet(info); |
| 337 | break; |
| 338 | #ifdef INET6 |
| 339 | case AF_INET6: |
| 340 | error = cleanup_xaddrs_inet6(info); |
| 341 | break; |
| 342 | #endif |
| 343 | } |
| 344 | |
| 345 | return (error); |
| 346 | } |
| 347 | |
| 348 | static int |
| 349 | rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp, |
no test coverage detected