/* Search IP6_DAD_ENTRY from the Duplicate Address Detection List. */
IP6_DAD_ENTRY* Ip6FindDADEntry(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Target, OUT IP6_INTERFACE **Interface OPTIONAL)
/* Search IP6_DAD_ENTRY from the Duplicate Address Detection List. */
IP6_DAD_ENTRY* Ip6FindDADEntry(IN IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Target, OUT IP6_INTERFACE **Interface OPTIONAL)
{
  LIST_ENTRY        *Entry;
  LIST_ENTRY        *Entry2;
  IP6_INTERFACE     *IpIf;
  IP6_DAD_ENTRY     *DupAddrDetect;
  IP6_ADDRESS_INFO  *AddrInfo;
  NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
    IpIf = NET_LIST_USER_STRUCT (Entry, IP6_INTERFACE, Link);
    NET_LIST_FOR_EACH (Entry2, &IpIf->DupAddrDetectList) {
      DupAddrDetect = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, IP6_DAD_ENTRY_SIGNATURE);
      AddrInfo      = DupAddrDetect->AddressInfo;
      if (EFI_IP6_EQUAL (&AddrInfo->Address, Target)) {
        if (Interface != NULL) {
          *Interface = IpIf;
        }
        return DupAddrDetect;
      }
    }
  }
  return NULL;
}