diff options
author | yar <yar@FreeBSD.org> | 2006-06-29 19:22:05 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-06-29 19:22:05 +0000 |
commit | ba19b1ecd4d6f2950416c0596e5007ae8ffb5360 (patch) | |
tree | 3d6a9cdea9fbb33471c0beed7b40c5ae89e5a37c /sys/netinet6 | |
parent | fb752eb168e0c0461ca9c98b0c8452c4d96ec4a7 (diff) | |
download | FreeBSD-src-ba19b1ecd4d6f2950416c0596e5007ae8ffb5360.zip FreeBSD-src-ba19b1ecd4d6f2950416c0596e5007ae8ffb5360.tar.gz |
There is a consensus that ifaddr.ifa_addr should never be NULL,
except in places dealing with ifaddr creation or destruction; and
in such special places incomplete ifaddrs should never be linked
to system-wide data structures. Therefore we can eliminate all the
superfluous checks for "ifa->ifa_addr != NULL" and get ready
to the system crashing honestly instead of masking possible bugs.
Suggested by: glebius, jhb, ru
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 2 |
2 files changed, 0 insertions, 8 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index fcc3080..5c05d6a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1696,8 +1696,6 @@ in6_ifinit(ifp, ia, sin6, newhost) * and to validate the address if necessary. */ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if (ifa->ifa_addr == NULL) - continue; /* just for safety */ if (ifa->ifa_addr->sa_family != AF_INET6) continue; ifacount++; @@ -1830,8 +1828,6 @@ in6ifa_ifpforlinklocal(ifp, ignoreflags) struct ifaddr *ifa; TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if (ifa->ifa_addr == NULL) - continue; /* just for safety */ if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) { @@ -1857,8 +1853,6 @@ in6ifa_ifpwithaddr(ifp, addr) struct ifaddr *ifa; TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - if (ifa->ifa_addr == NULL) - continue; /* just for safety */ if (ifa->ifa_addr->sa_family != AF_INET6) continue; if (IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa))) diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 4d3c6ba..faa3e62 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -494,8 +494,6 @@ MALLOC_DECLARE(M_IP6MADDR); do { \ struct ifaddr *ifa; \ TAILQ_FOREACH(ifa, &(ifp)->if_addrlist, ifa_list) { \ - if (!ifa->ifa_addr) \ - continue; \ if (ifa->ifa_addr->sa_family == AF_INET6) \ break; \ } \ |