| 279 | |
| 280 | #ifdef INET6 |
| 281 | static int |
| 282 | cleanup_xaddrs_inet6(struct rt_addrinfo *info) |
| 283 | { |
| 284 | struct sockaddr_in6 *dst_sa, *mask_sa; |
| 285 | struct in6_addr mask; |
| 286 | |
| 287 | /* Check & fixup dst/netmask combination first */ |
| 288 | dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; |
| 289 | mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; |
| 290 | |
| 291 | mask = mask_sa ? mask_sa->sin6_addr : in6mask128; |
| 292 | IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); |
| 293 | |
| 294 | if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { |
| 295 | printf("dst sin6_len too small\n"); |
| 296 | return (EINVAL); |
| 297 | } |
| 298 | if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { |
| 299 | printf("mask sin6_len too small\n"); |
| 300 | return (EINVAL); |
| 301 | } |
| 302 | fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); |
| 303 | |
| 304 | if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) |
| 305 | fill_sockaddr_inet6(mask_sa, &mask, 0); |
| 306 | else |
| 307 | remove_netmask(info); |
| 308 | |
| 309 | /* Check gateway */ |
| 310 | if (info->rti_info[RTAX_GATEWAY] != NULL) |
| 311 | return (cleanup_xaddrs_gateway(info)); |
| 312 | |
| 313 | return (0); |
| 314 | } |
| 315 | #endif |
| 316 | |
| 317 | static int |
no test coverage detected