summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet6/nd6_nbr.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-09 14:19:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-10 09:53:34 +0100
commit75b706fde4cbf82bcd41a1cec319778aa0f8eb2d (patch)
treeea39a351a1f6337b5a5dd6036314693adef5ffe6 /freebsd/sys/netinet6/nd6_nbr.c
parentVMSTAT(8): Port to RTEMS (diff)
downloadrtems-libbsd-75b706fde4cbf82bcd41a1cec319778aa0f8eb2d.tar.bz2
Update to FreeBSD head 2016-12-10
Git mirror commit 80c55f08a05ab3b26a73b226ccb56adc3122a55c.
Diffstat (limited to 'freebsd/sys/netinet6/nd6_nbr.c')
-rw-r--r--freebsd/sys/netinet6/nd6_nbr.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/freebsd/sys/netinet6/nd6_nbr.c b/freebsd/sys/netinet6/nd6_nbr.c
index df50fa93..e30dca8e 100644
--- a/freebsd/sys/netinet6/nd6_nbr.c
+++ b/freebsd/sys/netinet6/nd6_nbr.c
@@ -1219,40 +1219,26 @@ nd6_dad_start(struct ifaddr *ifa, int delay)
struct dadq *dp;
char ip6buf[INET6_ADDRSTRLEN];
+ KASSERT((ia->ia6_flags & IN6_IFF_TENTATIVE) != 0,
+ ("starting DAD on non-tentative address %p", ifa));
+
/*
* If we don't need DAD, don't do it.
* There are several cases:
- * - DAD is disabled (ip6_dad_count == 0)
+ * - DAD is disabled globally or on the interface
* - the interface address is anycast
*/
- if (!(ia->ia6_flags & IN6_IFF_TENTATIVE)) {
- log(LOG_DEBUG,
- "nd6_dad_start: called with non-tentative address "
- "%s(%s)\n",
- ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
- ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???");
- return;
- }
- if (ia->ia6_flags & IN6_IFF_ANYCAST) {
+ if ((ia->ia6_flags & IN6_IFF_ANYCAST) != 0 ||
+ V_ip6_dad_count == 0 ||
+ (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_NO_DAD) != 0) {
ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
return;
}
- if (!V_ip6_dad_count) {
- ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
+ if ((ifa->ifa_ifp->if_flags & IFF_UP) == 0 ||
+ (ifa->ifa_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
+ (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED) != 0)
return;
- }
- if (ifa->ifa_ifp == NULL)
- panic("nd6_dad_start: ifa->ifa_ifp == NULL");
- if (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_NO_DAD) {
- ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
- return;
- }
- if (!(ifa->ifa_ifp->if_flags & IFF_UP) ||
- !(ifa->ifa_ifp->if_drv_flags & IFF_DRV_RUNNING) ||
- (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED)) {
- ia->ia6_flags |= IN6_IFF_TENTATIVE;
- return;
- }
+
if ((dp = nd6_dad_find(ifa, NULL)) != NULL) {
/*
* DAD is already in progress. Let the existing entry
@@ -1331,11 +1317,8 @@ nd6_dad_timer(struct dadq *dp)
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
char ip6buf[INET6_ADDRSTRLEN];
- /* Sanity check */
- if (ia == NULL) {
- log(LOG_ERR, "nd6_dad_timer: called with null parameter\n");
- goto err;
- }
+ KASSERT(ia != NULL, ("DAD entry %p with no address", dp));
+
if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) {
/* Do not need DAD for ifdisabled interface. */
log(LOG_ERR, "nd6_dad_timer: cancel DAD on %s because of "