/* The callback function for Ip6SetAddr. The prototype is defined as IP6_DAD_CALLBACK. It is called after Duplicate Address Detection is performed on the tentative address by DHCPv6 in  */
VOID Ip6ConfigSetStatefulAddrCallback(IN BOOLEAN IsDadPassed, IN EFI_IPv6_ADDRESS *TargetAddress, IN VOID *Context)
/* The callback function for Ip6SetAddr. The prototype is defined as IP6_DAD_CALLBACK. It is called after Duplicate Address Detection is performed on the tentative address by DHCPv6 in  */
VOID Ip6ConfigSetStatefulAddrCallback(IN BOOLEAN IsDadPassed, IN EFI_IPv6_ADDRESS *TargetAddress, IN VOID *Context)
{
  IP6_CONFIG_INSTANCE  *Instance;
  Instance = (IP6_CONFIG_INSTANCE *)Context;
  NET_CHECK_SIGNATURE (Instance, IP6_CONFIG_INSTANCE_SIGNATURE);
  if (IsDadPassed) {
    if (Instance->FailedIaAddressCount > 0 ) {
      Instance->FailedIaAddressCount--;
    }
  } else {
    IP6_COPY_ADDRESS (Instance->DeclineAddress + Instance->DeclineAddressCount, TargetAddress);
    Instance->DeclineAddressCount++;
  }
  if (Instance->FailedIaAddressCount == Instance->DeclineAddressCount) {
    if (Instance->DeclineAddressCount != 0) {
      if (Instance->Dhcp6 != NULL) {
        Instance->Dhcp6->Decline (
                           Instance->Dhcp6,
                           Instance->DeclineAddressCount,
                           Instance->DeclineAddress
                           );
      }
    }
    if (Instance->DeclineAddress != NULL) {
      FreePool (Instance->DeclineAddress);
    }
    Instance->DeclineAddress      = NULL;
    Instance->DeclineAddressCount = 0;
  }
}