| 1490 | #endif |
| 1491 | |
| 1492 | static int |
| 1493 | cleanup_xaddrs(struct rt_addrinfo *info) |
| 1494 | { |
| 1495 | int error = EAFNOSUPPORT; |
| 1496 | |
| 1497 | if (info->rti_info[RTAX_DST] == NULL) |
| 1498 | return (EINVAL); |
| 1499 | |
| 1500 | if (info->rti_flags & RTF_LLDATA) { |
| 1501 | /* |
| 1502 | * arp(8)/ndp(8) sends RTA_NETMASK for the associated |
| 1503 | * prefix along with the actual address in RTA_DST. |
| 1504 | * Remove netmask to avoid unnecessary address masking. |
| 1505 | */ |
| 1506 | remove_netmask(info); |
| 1507 | } |
| 1508 | |
| 1509 | switch (info->rti_info[RTAX_DST]->sa_family) { |
| 1510 | #ifdef INET |
| 1511 | case AF_INET: |
| 1512 | error = cleanup_xaddrs_inet(info); |
| 1513 | break; |
| 1514 | #endif |
| 1515 | #ifdef INET6 |
| 1516 | case AF_INET6: |
| 1517 | error = cleanup_xaddrs_inet6(info); |
| 1518 | break; |
| 1519 | #endif |
| 1520 | } |
| 1521 | |
| 1522 | return (error); |
| 1523 | } |
| 1524 | |
| 1525 | /* |
| 1526 | * Fill in @dmask with valid netmask leaving original @smask |
no test coverage detected