| 1334 | } |
| 1335 | |
| 1336 | static void |
| 1337 | nd6_dad_timer(struct dadq *dp) |
| 1338 | { |
| 1339 | CURVNET_SET(dp->dad_vnet); |
| 1340 | struct ifaddr *ifa = dp->dad_ifa; |
| 1341 | struct ifnet *ifp = dp->dad_ifa->ifa_ifp; |
| 1342 | struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; |
| 1343 | char ip6buf[INET6_ADDRSTRLEN]; |
| 1344 | struct epoch_tracker et; |
| 1345 | |
| 1346 | KASSERT(ia != NULL, ("DAD entry %p with no address", dp)); |
| 1347 | |
| 1348 | NET_EPOCH_ENTER(et); |
| 1349 | if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) { |
| 1350 | /* Do not need DAD for ifdisabled interface. */ |
| 1351 | log(LOG_ERR, "nd6_dad_timer: cancel DAD on %s because of " |
| 1352 | "ND6_IFF_IFDISABLED.\n", ifp->if_xname); |
| 1353 | goto err; |
| 1354 | } |
| 1355 | if (ia->ia6_flags & IN6_IFF_DUPLICATED) { |
| 1356 | log(LOG_ERR, "nd6_dad_timer: called with duplicated address " |
| 1357 | "%s(%s)\n", |
| 1358 | ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr), |
| 1359 | ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); |
| 1360 | goto err; |
| 1361 | } |
| 1362 | if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0) { |
| 1363 | log(LOG_ERR, "nd6_dad_timer: called with non-tentative address " |
| 1364 | "%s(%s)\n", |
| 1365 | ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr), |
| 1366 | ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); |
| 1367 | goto err; |
| 1368 | } |
| 1369 | |
| 1370 | /* Stop DAD if the interface is down even after dad_maxtry attempts. */ |
| 1371 | if ((dp->dad_ns_tcount > V_dad_maxtry) && |
| 1372 | (((ifp->if_flags & IFF_UP) == 0) || |
| 1373 | ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0))) { |
| 1374 | nd6log((LOG_INFO, "%s: could not run DAD " |
| 1375 | "because the interface was down or not running.\n", |
| 1376 | if_name(ifa->ifa_ifp))); |
| 1377 | goto err; |
| 1378 | } |
| 1379 | |
| 1380 | /* Need more checks? */ |
| 1381 | if (dp->dad_ns_ocount < dp->dad_count) { |
| 1382 | /* |
| 1383 | * We have more NS to go. Send NS packet for DAD. |
| 1384 | */ |
| 1385 | nd6_dad_starttimer(dp, |
| 1386 | (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, 1); |
| 1387 | goto done; |
| 1388 | } else { |
| 1389 | /* |
| 1390 | * We have transmitted sufficient number of DAD packets. |
| 1391 | * See what we've got. |
| 1392 | */ |
| 1393 | if (dp->dad_ns_icount > 0 || dp->dad_na_icount > 0) |
nothing calls this directly
no test coverage detected