MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cleanup_xaddrs_inet6

Function cleanup_xaddrs_inet6

freebsd/net/rtsock.c:1456–1489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1454
1455#ifdef INET6
1456static int
1457cleanup_xaddrs_inet6(struct rt_addrinfo *info)
1458{
1459 struct sockaddr_in6 *dst_sa, *mask_sa;
1460 struct in6_addr mask;
1461
1462 /* Check & fixup dst/netmask combination first */
1463 dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST];
1464 mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];
1465
1466 mask = mask_sa ? mask_sa->sin6_addr : in6mask128;
1467 IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask);
1468
1469 if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) {
1470 printf("dst sin6_len too small\n");
1471 return (EINVAL);
1472 }
1473 if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) {
1474 printf("mask sin6_len too small\n");
1475 return (EINVAL);
1476 }
1477 fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0);
1478
1479 if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128))
1480 fill_sockaddr_inet6(mask_sa, &mask, 0);
1481 else
1482 remove_netmask(info);
1483
1484 /* Check gateway */
1485 if (info->rti_info[RTAX_GATEWAY] != NULL)
1486 return (cleanup_xaddrs_gateway(info));
1487
1488 return (0);
1489}
1490#endif
1491
1492static int

Callers 1

cleanup_xaddrsFunction · 0.70

Calls 4

fill_sockaddr_inet6Function · 0.70
remove_netmaskFunction · 0.70
cleanup_xaddrs_gatewayFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected