MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nd6_dad_duplicated

Function nd6_dad_duplicated

freebsd/netinet6/nd6_nbr.c:1449–1501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1447}
1448
1449static void
1450nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp)
1451{
1452 struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
1453 struct ifnet *ifp;
1454 char ip6buf[INET6_ADDRSTRLEN];
1455
1456 log(LOG_ERR, "%s: DAD detected duplicate IPv6 address %s: "
1457 "NS in/out/loopback=%d/%d/%d, NA in=%d\n",
1458 if_name(ifa->ifa_ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
1459 dp->dad_ns_icount, dp->dad_ns_ocount, dp->dad_ns_lcount,
1460 dp->dad_na_icount);
1461
1462 ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
1463 ia->ia6_flags |= IN6_IFF_DUPLICATED;
1464
1465 ifp = ifa->ifa_ifp;
1466 log(LOG_ERR, "%s: DAD complete for %s - duplicate found\n",
1467 if_name(ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr));
1468 log(LOG_ERR, "%s: manual intervention required\n",
1469 if_name(ifp));
1470
1471 /*
1472 * If the address is a link-local address formed from an interface
1473 * identifier based on the hardware address which is supposed to be
1474 * uniquely assigned (e.g., EUI-64 for an Ethernet interface), IP
1475 * operation on the interface SHOULD be disabled.
1476 * [RFC 4862, Section 5.4.5]
1477 */
1478 if (IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr)) {
1479 struct in6_addr in6;
1480
1481 /*
1482 * To avoid over-reaction, we only apply this logic when we are
1483 * very sure that hardware addresses are supposed to be unique.
1484 */
1485 switch (ifp->if_type) {
1486 case IFT_ETHER:
1487 case IFT_ATM:
1488 case IFT_IEEE1394:
1489 case IFT_INFINIBAND:
1490 in6 = ia->ia_addr.sin6_addr;
1491 if (in6_get_hw_ifid(ifp, &in6) == 0 &&
1492 IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &in6)) {
1493 ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED;
1494 log(LOG_ERR, "%s: possible hardware address "
1495 "duplication detected, disable IPv6\n",
1496 if_name(ifp));
1497 }
1498 break;
1499 }
1500 }
1501}
1502
1503static void
1504nd6_dad_ns_output(struct dadq *dp)

Callers 1

nd6_dad_timerFunction · 0.85

Calls 3

ip6_sprintfFunction · 0.85
in6_get_hw_ifidFunction · 0.85
logFunction · 0.50

Tested by

no test coverage detected