/** @file\r
This EFI_DHCP6_PROTOCOL interface implementation.\r
\r
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
// Well-known multi-cast address defined in section-24.1 of rfc-3315\r
//\r
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2\r
-// ALL_DHCP_Servers address: FF05::1:3\r
//\r
-EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {{0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2}};\r
-EFI_IPv6_ADDRESS mAllDhcpServersAddress = {{0xFF, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3}};\r
+EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {\r
+ { 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2 }\r
+};\r
\r
-EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {\r
+EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {\r
EfiDhcp6GetModeData,\r
EfiDhcp6Configure,\r
EfiDhcp6Start,\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6Start (\r
- IN EFI_DHCP6_PROTOCOL *This\r
+ IN EFI_DHCP6_PROTOCOL *This\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_TPL OldTpl;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
+ EFI_STATUS Status;\r
+ EFI_TPL OldTpl;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
+ EFI_STATUS MediaStatus;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
return EFI_ALREADY_STARTED;\r
}\r
\r
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
- Instance->UdpSts = EFI_ALREADY_STARTED;\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
//\r
- // Need to clear initial time to make sure that elapsed-time\r
- // is set to 0 for first Solicit.\r
+ // Check Media Status.\r
//\r
- Instance->StartTime = 0;\r
+ MediaStatus = EFI_SUCCESS;\r
+ NetLibDetectMediaWaitTimeout (Service->Controller, DHCP_CHECK_MEDIA_WAITING_TIME, &MediaStatus);\r
+ if (MediaStatus != EFI_SUCCESS) {\r
+ Status = EFI_NO_MEDIA;\r
+ goto ON_ERROR;\r
+ }\r
+\r
+ Instance->UdpSts = EFI_ALREADY_STARTED;\r
\r
//\r
// Send the solicit message to start S.A.R.R process.\r
//\r
// Register receive callback for the stateful exchange process.\r
//\r
- Status = UdpIoRecvDatagram(\r
+ Status = UdpIoRecvDatagram (\r
Service->UdpIo,\r
Dhcp6ReceivePacket,\r
Service,\r
// Poll udp out of the net tpl if synchronous call.\r
//\r
if (Instance->Config->IaInfoEvent == NULL) {\r
-\r
while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
}\r
+\r
return Instance->UdpSts;\r
}\r
\r
return Status;\r
}\r
\r
-\r
/**\r
Stops the DHCPv6 standard S.A.R.R. process.\r
\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6Stop (\r
- IN EFI_DHCP6_PROTOCOL *This\r
+ IN EFI_DHCP6_PROTOCOL *This\r
)\r
{\r
- EFI_TPL OldTpl;\r
- EFI_STATUS Status;\r
- EFI_UDP6_PROTOCOL *Udp6;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
+ EFI_TPL OldTpl;\r
+ EFI_STATUS Status;\r
+ EFI_UDP6_PROTOCOL *Udp6;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
//\r
// No valid REPLY message received yet, cleanup this instance directly.\r
//\r
- if (Instance->IaCb.Ia->State == Dhcp6Init ||\r
- Instance->IaCb.Ia->State == Dhcp6Selecting ||\r
- Instance->IaCb.Ia->State == Dhcp6Requesting\r
- ) {\r
+ if ((Instance->IaCb.Ia->State == Dhcp6Init) ||\r
+ (Instance->IaCb.Ia->State == Dhcp6Selecting) ||\r
+ (Instance->IaCb.Ia->State == Dhcp6Requesting)\r
+ )\r
+ {\r
goto ON_EXIT;\r
}\r
\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
Instance->UdpSts = EFI_ALREADY_STARTED;\r
- Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);\r
+ Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);\r
+ gBS->RestoreTPL (OldTpl);\r
if (EFI_ERROR (Status)) {\r
goto ON_EXIT;\r
}\r
\r
- gBS->RestoreTPL (OldTpl);\r
-\r
//\r
- // Poll udp out of the net tpl if synchoronus call.\r
+ // Poll udp out of the net tpl if synchronous call.\r
//\r
if (Instance->Config->IaInfoEvent == NULL) {\r
ASSERT (Udp6 != NULL);\r
while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
Udp6->Poll (Udp6);\r
}\r
+\r
Status = Instance->UdpSts;\r
}\r
- \r
+\r
ON_EXIT:\r
//\r
// Clean up the session data for the released Ia.\r
return Status;\r
}\r
\r
-\r
/**\r
Returns the current operating mode data for the Dhcp6 instance.\r
\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6GetModeData (\r
- IN EFI_DHCP6_PROTOCOL *This,\r
- OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,\r
- OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL\r
+ IN EFI_DHCP6_PROTOCOL *This,\r
+ OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,\r
+ OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL\r
)\r
{\r
- EFI_TPL OldTpl;\r
- EFI_DHCP6_IA *Ia;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
- UINT32 IaSize;\r
- UINT32 IdSize;\r
-\r
- if (This == NULL || (Dhcp6ModeData == NULL && Dhcp6ConfigData == NULL)) {\r
+ EFI_TPL OldTpl;\r
+ EFI_DHCP6_IA *Ia;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
+ UINT32 IaSize;\r
+ UINT32 IdSize;\r
+\r
+ if ((This == NULL) || ((Dhcp6ModeData == NULL) && (Dhcp6ConfigData == NULL))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Instance = DHCP6_INSTANCE_FROM_THIS (This);\r
Service = Instance->Service;\r
\r
- if (Instance->Config == NULL && Dhcp6ConfigData != NULL) {\r
+ if ((Instance->Config == NULL) && (Dhcp6ConfigData != NULL)) {\r
return EFI_ACCESS_DENIED;\r
}\r
\r
// User needs a copy of instance config data.\r
//\r
if (Dhcp6ConfigData != NULL) {\r
- ZeroMem (Dhcp6ConfigData, sizeof(EFI_DHCP6_CONFIG_DATA));\r
+ ZeroMem (Dhcp6ConfigData, sizeof (EFI_DHCP6_CONFIG_DATA));\r
//\r
// Duplicate config data, including all reference buffers.\r
//\r
if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {\r
goto ON_ERROR;\r
}\r
+\r
CopyMem (\r
Dhcp6ModeData->Ia->ReplyPacket,\r
Ia->ReplyPacket,\r
if (Dhcp6ConfigData != NULL) {\r
Dhcp6CleanupConfigData (Dhcp6ConfigData);\r
}\r
+\r
if (Dhcp6ModeData != NULL) {\r
Dhcp6CleanupModeData (Dhcp6ModeData);\r
}\r
+\r
gBS->RestoreTPL (OldTpl);\r
\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
-\r
/**\r
Initializes, changes, or resets the operational settings for the Dhcp6 instance.\r
\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6Configure (\r
- IN EFI_DHCP6_PROTOCOL *This,\r
- IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL\r
+ IN EFI_DHCP6_PROTOCOL *This,\r
+ IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL\r
)\r
{\r
- EFI_TPL OldTpl;\r
- EFI_STATUS Status;\r
- LIST_ENTRY *Entry;\r
- DHCP6_INSTANCE *Other;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
- UINTN Index;\r
+ EFI_TPL OldTpl;\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Entry;\r
+ DHCP6_INSTANCE *Other;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
+ UINTN Index;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
// Check the parameter of configure data.\r
//\r
if (Dhcp6CfgData != NULL) {\r
- if (Dhcp6CfgData->OptionCount > 0 && Dhcp6CfgData->OptionList == NULL) {\r
+ if ((Dhcp6CfgData->OptionCount > 0) && (Dhcp6CfgData->OptionList == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
+\r
if (Dhcp6CfgData->OptionList != NULL) {\r
for (Index = 0; Index < Dhcp6CfgData->OptionCount; Index++) {\r
- if (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId ||\r
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit ||\r
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept ||\r
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana ||\r
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata\r
- ) {\r
+ if ((Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId) ||\r
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit) ||\r
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept) ||\r
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana) ||\r
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata)\r
+ )\r
+ {\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
}\r
\r
- if (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA &&\r
- Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA\r
- ) {\r
+ if ((Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA) &&\r
+ (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA)\r
+ )\r
+ {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (Dhcp6CfgData->IaInfoEvent == NULL && Dhcp6CfgData->SolicitRetransmission == NULL) {\r
+ if ((Dhcp6CfgData->IaInfoEvent == NULL) && (Dhcp6CfgData->SolicitRetransmission == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (Dhcp6CfgData->SolicitRetransmission != NULL &&\r
- Dhcp6CfgData->SolicitRetransmission->Mrc == 0 &&\r
- Dhcp6CfgData->SolicitRetransmission->Mrd == 0\r
- ) {\r
+ if ((Dhcp6CfgData->SolicitRetransmission != NULL) &&\r
+ (Dhcp6CfgData->SolicitRetransmission->Mrc == 0) &&\r
+ (Dhcp6CfgData->SolicitRetransmission->Mrd == 0)\r
+ )\r
+ {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
NET_LIST_FOR_EACH (Entry, &Service->Child) {\r
Other = NET_LIST_USER_STRUCT (Entry, DHCP6_INSTANCE, Link);\r
- if (Other->IaCb.Ia != NULL &&\r
- Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type &&\r
- Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId\r
- ) {\r
+ if ((Other->IaCb.Ia != NULL) &&\r
+ (Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type) &&\r
+ (Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId)\r
+ )\r
+ {\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
}\r
\r
Status = Dhcp6CopyConfigData (Instance->Config, Dhcp6CfgData);\r
- if (EFI_ERROR(Status)) {\r
+ if (EFI_ERROR (Status)) {\r
FreePool (Instance->Config);\r
gBS->RestoreTPL (OldTpl);\r
return EFI_OUT_OF_RESOURCES;\r
// Initialize the Ia descriptor from the config data, and leave the other\r
// fields of the Ia as default value 0.\r
//\r
- Instance->IaCb.Ia = AllocateZeroPool (sizeof(EFI_DHCP6_IA));\r
+ Instance->IaCb.Ia = AllocateZeroPool (sizeof (EFI_DHCP6_IA));\r
if (Instance->IaCb.Ia == NULL) {\r
Dhcp6CleanupConfigData (Instance->Config);\r
FreePool (Instance->Config);\r
gBS->RestoreTPL (OldTpl);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
+\r
CopyMem (\r
&Instance->IaCb.Ia->Descriptor,\r
&Dhcp6CfgData->IaDescriptor,\r
- sizeof(EFI_DHCP6_IA_DESCRIPTOR)\r
+ sizeof (EFI_DHCP6_IA_DESCRIPTOR)\r
);\r
-\r
} else {\r
-\r
if (Instance->Config == NULL) {\r
ASSERT (Instance->IaCb.Ia == NULL);\r
gBS->RestoreTPL (OldTpl);\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
Request configuration information without the assignment of any\r
Ia addresses of the client.\r
IN VOID *CallbackContext OPTIONAL\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_TPL OldTpl;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
- DHCP6_INF_CB *InfCb;\r
- UINTN Index;\r
-\r
- if (This == NULL || OptionRequest == NULL || Retransmission == NULL || ReplyCallback == NULL) {\r
+ EFI_STATUS Status;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
+ UINTN Index;\r
+ EFI_EVENT Timer;\r
+ EFI_STATUS TimerStatus;\r
+ UINTN GetMappingTimeOut;\r
+\r
+ if ((This == NULL) || (OptionRequest == NULL) || (Retransmission == NULL) || (ReplyCallback == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (Retransmission != NULL && Retransmission->Mrc == 0 && Retransmission->Mrd == 0) {\r
+ if ((Retransmission != NULL) && (Retransmission->Mrc == 0) && (Retransmission->Mrd == 0)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (OptionCount > 0 && OptionList == NULL) {\r
+ if ((OptionCount > 0) && (OptionList == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
if (OptionList != NULL) {\r
for (Index = 0; Index < OptionCount; Index++) {\r
- if (OptionList[Index]->OpCode == Dhcp6OptClientId || OptionList[Index]->OpCode == Dhcp6OptRequestOption) {\r
+ if ((OptionList[Index]->OpCode == Dhcp6OptClientId) || (OptionList[Index]->OpCode == Dhcp6OptRequestOption)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
}\r
Instance = DHCP6_INSTANCE_FROM_THIS (This);\r
Service = Instance->Service;\r
\r
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
- Instance->UdpSts = EFI_ALREADY_STARTED;\r
-\r
- //\r
- // Create and initialize the control block for the info-request.\r
- //\r
- InfCb = AllocateZeroPool (sizeof(DHCP6_INF_CB));\r
-\r
- if (InfCb == NULL) {\r
- gBS->RestoreTPL (OldTpl);\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- InfCb->ReplyCallback = ReplyCallback;\r
- InfCb->CallbackContext = CallbackContext;\r
- InfCb->TimeoutEvent = TimeoutEvent;\r
-\r
- InsertTailList (&Instance->InfList, &InfCb->Link);\r
-\r
- //\r
- // Send the info-request message to start exchange process.\r
- //\r
- Status = Dhcp6SendInfoRequestMsg (\r
+ Status = Dhcp6StartInfoRequest (\r
Instance,\r
- InfCb,\r
SendClientId,\r
OptionRequest,\r
OptionCount,\r
OptionList,\r
- Retransmission\r
+ Retransmission,\r
+ TimeoutEvent,\r
+ ReplyCallback,\r
+ CallbackContext\r
);\r
+ if (Status == EFI_NO_MAPPING) {\r
+ //\r
+ // The link local address is not ready, wait for some time and restart\r
+ // the DHCP6 information request process.\r
+ //\r
+ Status = Dhcp6GetMappingTimeOut (Service->Ip6Cfg, &GetMappingTimeOut);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
\r
- if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
- }\r
+ Status = gBS->CreateEvent (EVT_TIMER, TPL_CALLBACK, NULL, NULL, &Timer);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
\r
- //\r
- // Register receive callback for the stateless exchange process.\r
- //\r
- Status = UdpIoRecvDatagram(\r
- Service->UdpIo,\r
- Dhcp6ReceivePacket,\r
- Service,\r
- 0\r
- );\r
+ //\r
+ // Start the timer, wait for link local address DAD to finish.\r
+ //\r
+ Status = gBS->SetTimer (Timer, TimerRelative, GetMappingTimeOut);\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->CloseEvent (Timer);\r
+ return Status;\r
+ }\r
\r
- if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {\r
- goto ON_ERROR;\r
+ do {\r
+ TimerStatus = gBS->CheckEvent (Timer);\r
+ if (!EFI_ERROR (TimerStatus)) {\r
+ Status = Dhcp6StartInfoRequest (\r
+ Instance,\r
+ SendClientId,\r
+ OptionRequest,\r
+ OptionCount,\r
+ OptionList,\r
+ Retransmission,\r
+ TimeoutEvent,\r
+ ReplyCallback,\r
+ CallbackContext\r
+ );\r
+ }\r
+ } while (TimerStatus == EFI_NOT_READY);\r
+\r
+ gBS->CloseEvent (Timer);\r
}\r
\r
- gBS->RestoreTPL (OldTpl);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
\r
//\r
- // Poll udp out of the net tpl if synchoronus call.\r
+ // Poll udp out of the net tpl if synchronous call.\r
//\r
if (TimeoutEvent == NULL) {\r
-\r
while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
}\r
+\r
return Instance->UdpSts;\r
}\r
\r
return EFI_SUCCESS;\r
-\r
-ON_ERROR:\r
-\r
- RemoveEntryList (&InfCb->Link);\r
- FreePool (InfCb);\r
- gBS->RestoreTPL (OldTpl);\r
-\r
- return Status;\r
}\r
\r
-\r
/**\r
Manually extend the valid and preferred lifetimes for the IPv6 addresses\r
of the configured IA and update other configuration parameters by sending a\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6RenewRebind (\r
- IN EFI_DHCP6_PROTOCOL *This,\r
- IN BOOLEAN RebindRequest\r
+ IN EFI_DHCP6_PROTOCOL *This,\r
+ IN BOOLEAN RebindRequest\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_TPL OldTpl;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
+ EFI_STATUS Status;\r
+ EFI_TPL OldTpl;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
\r
if (This == NULL) {\r
return EFI_INVALID_PARAMETER;\r
//\r
// The instance has already entered renewing or rebinding state.\r
//\r
- if ((Instance->IaCb.Ia->State == Dhcp6Rebinding && RebindRequest) ||\r
- (Instance->IaCb.Ia->State == Dhcp6Renewing && !RebindRequest)\r
- ) {\r
+ if (((Instance->IaCb.Ia->State == Dhcp6Rebinding) && RebindRequest) ||\r
+ ((Instance->IaCb.Ia->State == Dhcp6Renewing) && !RebindRequest)\r
+ )\r
+ {\r
return EFI_ALREADY_STARTED;\r
}\r
\r
//\r
// Register receive callback for the stateful exchange process.\r
//\r
- Status = UdpIoRecvDatagram(\r
+ Status = UdpIoRecvDatagram (\r
Service->UdpIo,\r
Dhcp6ReceivePacket,\r
Service,\r
gBS->RestoreTPL (OldTpl);\r
\r
//\r
- // Poll udp out of the net tpl if synchoronus call.\r
+ // Poll udp out of the net tpl if synchronous call.\r
//\r
if (Instance->Config->IaInfoEvent == NULL) {\r
-\r
while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
}\r
+\r
return Instance->UdpSts;\r
}\r
\r
return Status;\r
}\r
\r
-\r
/**\r
Inform that one or more addresses assigned by a server are already\r
in use by another node.\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6Decline (\r
- IN EFI_DHCP6_PROTOCOL *This,\r
- IN UINT32 AddressCount,\r
- IN EFI_IPv6_ADDRESS *Addresses\r
+ IN EFI_DHCP6_PROTOCOL *This,\r
+ IN UINT32 AddressCount,\r
+ IN EFI_IPv6_ADDRESS *Addresses\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_TPL OldTpl;\r
- EFI_DHCP6_IA *DecIa;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
+ EFI_STATUS Status;\r
+ EFI_TPL OldTpl;\r
+ EFI_DHCP6_IA *DecIa;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
\r
- if (This == NULL || AddressCount == 0 || Addresses == NULL) {\r
+ if ((This == NULL) || (AddressCount == 0) || (Addresses == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);\r
\r
- if (EFI_ERROR(Status)) {\r
+ if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
//\r
// Register receive callback for the stateful exchange process.\r
//\r
- Status = UdpIoRecvDatagram(\r
+ Status = UdpIoRecvDatagram (\r
Service->UdpIo,\r
Dhcp6ReceivePacket,\r
Service,\r
gBS->RestoreTPL (OldTpl);\r
\r
//\r
- // Poll udp out of the net tpl if synchoronus call.\r
+ // Poll udp out of the net tpl if synchronous call.\r
//\r
if (Instance->Config->IaInfoEvent == NULL) {\r
-\r
while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
}\r
+\r
return Instance->UdpSts;\r
}\r
\r
if (DecIa != NULL) {\r
FreePool (DecIa);\r
}\r
+\r
gBS->RestoreTPL (OldTpl);\r
\r
return Status;\r
}\r
\r
-\r
/**\r
Release one or more addresses associated with the configured Ia\r
for current instance.\r
EFI_STATUS\r
EFIAPI\r
EfiDhcp6Release (\r
- IN EFI_DHCP6_PROTOCOL *This,\r
- IN UINT32 AddressCount,\r
- IN EFI_IPv6_ADDRESS *Addresses\r
+ IN EFI_DHCP6_PROTOCOL *This,\r
+ IN UINT32 AddressCount,\r
+ IN EFI_IPv6_ADDRESS *Addresses\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_TPL OldTpl;\r
- EFI_DHCP6_IA *RelIa;\r
- DHCP6_INSTANCE *Instance;\r
- DHCP6_SERVICE *Service;\r
+ EFI_STATUS Status;\r
+ EFI_TPL OldTpl;\r
+ EFI_DHCP6_IA *RelIa;\r
+ DHCP6_INSTANCE *Instance;\r
+ DHCP6_SERVICE *Service;\r
\r
- if (This == NULL || (AddressCount != 0 && Addresses == NULL)) {\r
+ if ((This == NULL) || ((AddressCount != 0) && (Addresses == NULL))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);\r
\r
- if (EFI_ERROR(Status)) {\r
+ if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
//\r
// Register receive callback for the stateful exchange process.\r
//\r
- Status = UdpIoRecvDatagram(\r
+ Status = UdpIoRecvDatagram (\r
Service->UdpIo,\r
Dhcp6ReceivePacket,\r
Service,\r
gBS->RestoreTPL (OldTpl);\r
\r
//\r
- // Poll udp out of the net tpl if synchoronus call.\r
+ // Poll udp out of the net tpl if synchronous call.\r
//\r
if (Instance->Config->IaInfoEvent == NULL) {\r
while (Instance->UdpSts == EFI_ALREADY_STARTED) {\r
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);\r
}\r
+\r
return Instance->UdpSts;\r
}\r
\r
if (RelIa != NULL) {\r
FreePool (RelIa);\r
}\r
+\r
gBS->RestoreTPL (OldTpl);\r
\r
return Status;\r
}\r
\r
-\r
/**\r
Parse the option data in the Dhcp6 packet.\r
\r
OUT EFI_DHCP6_PACKET_OPTION *PacketOptionList[] OPTIONAL\r
)\r
{\r
- UINT32 OptCnt;\r
- UINT32 OptLen;\r
- UINT16 DataLen;\r
- UINT8 *Start;\r
- UINT8 *End;\r
+ UINT32 OptCnt;\r
+ UINT32 OptLen;\r
+ UINT16 DataLen;\r
+ UINT8 *Start;\r
+ UINT8 *End;\r
\r
- if (This == NULL || Packet == NULL || OptionCount == NULL) {\r
+ if ((This == NULL) || (Packet == NULL) || (OptionCount == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (*OptionCount != 0 && PacketOptionList == NULL) {\r
+ if ((*OptionCount != 0) && (PacketOptionList == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (Packet->Length > Packet->Size || Packet->Length < sizeof (EFI_DHCP6_HEADER)) {\r
+ if ((Packet->Length > Packet->Size) || (Packet->Length < sizeof (EFI_DHCP6_HEADER))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
// Calculate the number of option in the packet.\r
//\r
while (Start < End) {\r
- DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;\r
+ DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;\r
Start += (NTOHS (DataLen) + 4);\r
OptCnt++;\r
}\r
Start = Packet->Dhcp6.Option;\r
\r
while (Start < End) {\r
-\r
- PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *) Start;\r
- DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;\r
- Start += (NTOHS (DataLen) + 4);\r
+ PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *)Start;\r
+ DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;\r
+ Start += (NTOHS (DataLen) + 4);\r
OptCnt++;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
-\r