Cleanup socket functions a bit

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2019-01-03 10:05:30 +01:00
parent 0bc263e537
commit 934ff535d6
3 changed files with 50 additions and 138 deletions

View file

@ -134,10 +134,12 @@ CU_Test(os_getifaddrs, ipv6)
CU_ASSERT_EQUAL(ifa->addr->sa_family, AF_INET6);
if (ifa->addr->sa_family == AF_INET6) {
have_ipv6 = 1;
if (ifa->flags & IFF_LOOPBACK) {
CU_ASSERT(os_sockaddrIsLoopback(ifa->addr));
} else {
CU_ASSERT(!os_sockaddrIsLoopback(ifa->addr));
/* macOS assigns a link-local address to the loopback
interface, so the loopback address must be assigned to the
loopback interface, but the loopback interface can have
addresses other than the loopback address assigned. */
if (os_sockaddr_is_loopback(ifa->addr)) {
CU_ASSERT(ifa->flags & IFF_LOOPBACK);
}
}
}