/* If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left. */
EFI_STATUS EFIAPI EfiIp6Groups(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
/* If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left. */
EFI_STATUS EFIAPI EfiIp6Groups(IN EFI_IP6_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL)
{
  EFI_TPL       OldTpl;
  EFI_STATUS    Status;
  IP6_PROTOCOL  *IpInstance;
  IP6_SERVICE   *IpSb;
  if ((This == NULL) || (JoinFlag && (GroupAddress == NULL))) {
    return EFI_INVALID_PARAMETER;
  }
  if ((GroupAddress != NULL) && !IP6_IS_MULTICAST (GroupAddress)) {
    return EFI_INVALID_PARAMETER;
  }
  IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
  IpSb       = IpInstance->Service;
  if (IpSb->LinkLocalDadFail) {
    return EFI_DEVICE_ERROR;
  }
  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
  if (IpInstance->State != IP6_STATE_CONFIGED) {
    Status = EFI_NOT_STARTED;
    goto ON_EXIT;
  }
  Status = Ip6Groups (IpInstance, JoinFlag, GroupAddress);
ON_EXIT:
  gBS->RestoreTPL (OldTpl);
  return Status;
}