-/* $OpenBSD: ip_carp.c,v 1.176 2010/07/20 15:36:03 matthew Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.177 2010/08/02 10:30:00 matthew Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
last = cur;
cur.s_addr = 0xffffffff;
TAILQ_FOREACH(ifa, &sc->sc_if.if_addrlist, ifa_list) {
+ if (ifa->ifa_addr->sa_family != AF_INET)
+ continue;
in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr;
- if (ifa->ifa_addr->sa_family == AF_INET &&
- ntohl(in.s_addr) > ntohl(last.s_addr) &&
+ if (ntohl(in.s_addr) > ntohl(last.s_addr) &&
ntohl(in.s_addr) < ntohl(cur.s_addr)) {
cur.s_addr = in.s_addr;
found++;
last6 = cur6;
memset(&cur6, 0xff, sizeof(cur6));
TAILQ_FOREACH(ifa, &sc->sc_if.if_addrlist, ifa_list) {
+ if (ifa->ifa_addr->sa_family != AF_INET6)
+ continue;
in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
if (IN6_IS_SCOPE_EMBED(&in6)) {
if (ctx == HMAC_NOV6LL)
continue;
in6.s6_addr16[1] = 0;
}
- if (ifa->ifa_addr->sa_family == AF_INET6 &&
- memcmp(&in6, &last6, sizeof(in6)) > 0 &&
+ if (memcmp(&in6, &last6, sizeof(in6)) > 0 &&
memcmp(&in6, &cur6, sizeof(in6)) < 0) {
cur6 = in6;
found++;