diff options
Diffstat (limited to 'NetworkPkg/Dhcp6Dxe')
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/ComponentName.c | 52 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c | 149 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h | 6 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 284 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h | 162 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 1145 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Io.h | 37 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 479 | ||||
-rw-r--r-- | NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h | 116 |
9 files changed, 1183 insertions, 1247 deletions
diff --git a/NetworkPkg/Dhcp6Dxe/ComponentName.c b/NetworkPkg/Dhcp6Dxe/ComponentName.c index c5927fbd12..6877e7c00a 100644 --- a/NetworkPkg/Dhcp6Dxe/ComponentName.c +++ b/NetworkPkg/Dhcp6Dxe/ComponentName.c @@ -9,7 +9,6 @@ #include "Dhcp6Impl.h"
-
/**
Retrieves a Unicode string that is the user-readable name of the driver.
@@ -57,7 +56,6 @@ Dhcp6ComponentNameGetDriverName ( OUT CHAR16 **DriverName
);
-
/**
Retrieves a Unicode string that is the user-readable name of the controller
that is being managed by a driver.
@@ -129,18 +127,17 @@ Dhcp6ComponentNameGetDriverName ( EFI_STATUS
EFIAPI
Dhcp6ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
-
//
// EFI Component Name Protocol
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName = {
Dhcp6ComponentNameGetDriverName,
Dhcp6ComponentNameGetControllerName,
"eng"
@@ -149,13 +146,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName //
// EFI Component Name 2 Protocol
//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) Dhcp6ComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) Dhcp6ComponentNameGetControllerName,
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)Dhcp6ComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)Dhcp6ComponentNameGetControllerName,
"en"
};
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcp6DriverNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcp6DriverNameTable[] = {
{
"eng;en",
L"DHCP6 Protocol Driver"
@@ -166,9 +163,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcp6DriverNameTab }
};
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable = NULL;
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable = NULL;
-CHAR16 *mDhcp6ControllerName[] = {
+CHAR16 *mDhcp6ControllerName[] = {
L"DHCPv6 (State=0, Init)",
L"DHCPv6 (State=1, Selecting)",
L"DHCPv6 (State=2, Requesting)",
@@ -248,12 +245,12 @@ Dhcp6ComponentNameGetDriverName ( **/
EFI_STATUS
UpdateName (
- IN EFI_DHCP6_PROTOCOL *Dhcp6
+ IN EFI_DHCP6_PROTOCOL *Dhcp6
)
{
- EFI_STATUS Status;
- EFI_DHCP6_MODE_DATA Dhcp6ModeData;
- CHAR16 *HandleName;
+ EFI_STATUS Status;
+ EFI_DHCP6_MODE_DATA Dhcp6ModeData;
+ CHAR16 *HandleName;
if (Dhcp6 == NULL) {
return EFI_INVALID_PARAMETER;
@@ -278,12 +275,14 @@ UpdateName ( if (Dhcp6ModeData.Ia->State > Dhcp6Rebinding) {
return EFI_DEVICE_ERROR;
}
+
HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State];
}
if (Dhcp6ModeData.Ia != NULL) {
FreePool (Dhcp6ModeData.Ia);
}
+
if (Dhcp6ModeData.ClientId != NULL) {
FreePool (Dhcp6ModeData.ClientId);
}
@@ -379,15 +378,15 @@ UpdateName ( EFI_STATUS
EFIAPI
Dhcp6ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PROTOCOL *Dhcp6;
+ EFI_STATUS Status;
+ EFI_DHCP6_PROTOCOL *Dhcp6;
//
// Only provide names for child handles.
@@ -439,4 +438,3 @@ Dhcp6ComponentNameGetControllerName ( (BOOLEAN)(This == &gDhcp6ComponentName)
);
}
-
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c index f0b236835f..b591a4605b 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c @@ -10,8 +10,7 @@ #include "Dhcp6Impl.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
Dhcp6DriverBindingSupported,
Dhcp6DriverBindingStart,
Dhcp6DriverBindingStop,
@@ -20,7 +19,7 @@ EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = { NULL
};
-EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
+EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
Dhcp6ServiceBindingCreateChild,
Dhcp6ServiceBindingDestroyChild
};
@@ -39,12 +38,12 @@ EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = { EFI_STATUS
EFIAPI
Dhcp6ConfigureUdpIo (
- IN UDP_IO *UdpIo,
- IN VOID *Context
+ IN UDP_IO *UdpIo,
+ IN VOID *Context
)
{
- EFI_UDP6_PROTOCOL *Udp6;
- EFI_UDP6_CONFIG_DATA *Config;
+ EFI_UDP6_PROTOCOL *Udp6;
+ EFI_UDP6_CONFIG_DATA *Config;
Udp6 = UdpIo->Protocol.Udp6;
Config = &(UdpIo->Config.Udp6);
@@ -67,13 +66,12 @@ Dhcp6ConfigureUdpIo ( // will be overridden later. Note that we MUST not limit RemotePort.
// More details, refer to RFC 3315 section 5.2.
//
- Config->StationPort = DHCP6_PORT_CLIENT;
- Config->RemotePort = 0;
+ Config->StationPort = DHCP6_PORT_CLIENT;
+ Config->RemotePort = 0;
- return Udp6->Configure (Udp6, Config);;
+ return Udp6->Configure (Udp6, Config);
}
-
/**
Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized,
or partly destroyed. If a resource is destroyed, it is marked as such in
@@ -84,7 +82,7 @@ Dhcp6ConfigureUdpIo ( **/
VOID
Dhcp6DestroyService (
- IN OUT DHCP6_SERVICE *Service
+ IN OUT DHCP6_SERVICE *Service
)
{
//
@@ -103,7 +101,6 @@ Dhcp6DestroyService ( FreePool (Service);
}
-
/**
Create a new Dhcp6 service for the Nic controller.
@@ -119,13 +116,13 @@ Dhcp6DestroyService ( **/
EFI_STATUS
Dhcp6CreateService (
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE ImageHandle,
- OUT DHCP6_SERVICE **Service
+ IN EFI_HANDLE Controller,
+ IN EFI_HANDLE ImageHandle,
+ OUT DHCP6_SERVICE **Service
)
{
- DHCP6_SERVICE *Dhcp6Srv;
- EFI_STATUS Status;
+ DHCP6_SERVICE *Dhcp6Srv;
+ EFI_STATUS Status;
*Service = NULL;
Dhcp6Srv = AllocateZeroPool (sizeof (DHCP6_SERVICE));
@@ -147,10 +144,10 @@ Dhcp6CreateService ( //
// Initialize the fields of the new Dhcp6 service.
//
- Dhcp6Srv->Signature = DHCP6_SERVICE_SIGNATURE;
- Dhcp6Srv->Controller = Controller;
- Dhcp6Srv->Image = ImageHandle;
- Dhcp6Srv->Xid = (0xffffff & NET_RANDOM (NetRandomInitSeed ()));
+ Dhcp6Srv->Signature = DHCP6_SERVICE_SIGNATURE;
+ Dhcp6Srv->Controller = Controller;
+ Dhcp6Srv->Image = ImageHandle;
+ Dhcp6Srv->Xid = (0xffffff & NET_RANDOM (NetRandomInitSeed ()));
CopyMem (
&Dhcp6Srv->ServiceBinding,
@@ -164,7 +161,7 @@ Dhcp6CreateService ( Status = gBS->HandleProtocol (
Controller,
&gEfiIp6ConfigProtocolGuid,
- (VOID **) &Dhcp6Srv->Ip6Cfg
+ (VOID **)&Dhcp6Srv->Ip6Cfg
);
if (EFI_ERROR (Status)) {
FreePool (Dhcp6Srv);
@@ -175,7 +172,7 @@ Dhcp6CreateService ( // Generate client Duid: If SMBIOS system UUID is located, generate DUID in DUID-UUID format.
// Otherwise, in DUID-LLT format.
//
- Dhcp6Srv->ClientId = Dhcp6GenerateClientId (Dhcp6Srv->Snp->Mode);
+ Dhcp6Srv->ClientId = Dhcp6GenerateClientId (Dhcp6Srv->Snp->Mode);
if (Dhcp6Srv->ClientId == NULL) {
FreePool (Dhcp6Srv);
@@ -206,7 +203,6 @@ Dhcp6CreateService ( return EFI_SUCCESS;
}
-
/**
Destroy the Dhcp6 instance and recycle the resources.
@@ -215,7 +211,7 @@ Dhcp6CreateService ( **/
VOID
Dhcp6DestroyInstance (
- IN OUT DHCP6_INSTANCE *Instance
+ IN OUT DHCP6_INSTANCE *Instance
)
{
//
@@ -239,6 +235,7 @@ Dhcp6DestroyInstance ( if (Instance->IaCb.Ia->ReplyPacket != NULL) {
FreePool (Instance->IaCb.Ia->ReplyPacket);
}
+
FreePool (Instance->IaCb.Ia);
}
@@ -253,7 +250,6 @@ Dhcp6DestroyInstance ( FreePool (Instance);
}
-
/**
Create the Dhcp6 instance and initialize it.
@@ -266,12 +262,12 @@ Dhcp6DestroyInstance ( **/
EFI_STATUS
Dhcp6CreateInstance (
- IN DHCP6_SERVICE *Service,
- OUT DHCP6_INSTANCE **Instance
+ IN DHCP6_SERVICE *Service,
+ OUT DHCP6_INSTANCE **Instance
)
{
- EFI_STATUS Status;
- DHCP6_INSTANCE *Dhcp6Ins;
+ EFI_STATUS Status;
+ DHCP6_INSTANCE *Dhcp6Ins;
*Instance = NULL;
Dhcp6Ins = AllocateZeroPool (sizeof (DHCP6_INSTANCE));
@@ -283,11 +279,11 @@ Dhcp6CreateInstance ( //
// Initialize the fields of the new Dhcp6 instance.
//
- Dhcp6Ins->Signature = DHCP6_INSTANCE_SIGNATURE;
- Dhcp6Ins->UdpSts = EFI_ALREADY_STARTED;
- Dhcp6Ins->Service = Service;
- Dhcp6Ins->InDestroy = FALSE;
- Dhcp6Ins->MediaPresent = TRUE;
+ Dhcp6Ins->Signature = DHCP6_INSTANCE_SIGNATURE;
+ Dhcp6Ins->UdpSts = EFI_ALREADY_STARTED;
+ Dhcp6Ins->Service = Service;
+ Dhcp6Ins->InDestroy = FALSE;
+ Dhcp6Ins->MediaPresent = TRUE;
CopyMem (
&Dhcp6Ins->Dhcp6,
@@ -333,24 +329,23 @@ Dhcp6CreateInstance ( EFI_STATUS
EFIAPI
Dhcp6DestroyChildEntry (
- IN LIST_ENTRY *Entry,
- IN VOID *Context
+ IN LIST_ENTRY *Entry,
+ IN VOID *Context
)
{
- DHCP6_INSTANCE *Instance;
- EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+ DHCP6_INSTANCE *Instance;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
- if (Entry == NULL || Context == NULL) {
+ if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
- Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE);
- ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *) Context;
+ Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE);
+ ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *)Context;
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
}
-
/**
Entry point of the DHCP6 driver to install various protocols.
@@ -364,8 +359,8 @@ Dhcp6DestroyChildEntry ( EFI_STATUS
EFIAPI
Dhcp6DriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EfiLibInstallDriverBindingComponentName2 (
@@ -378,7 +373,6 @@ Dhcp6DriverEntryPoint ( );
}
-
/**
Test to see if this driver supports ControllerHandle. This service
is called by the EFI boot service ConnectController(). In
@@ -414,7 +408,6 @@ Dhcp6DriverBindingSupported ( );
}
-
/**
Start this driver on ControllerHandle. This service is called by the
EFI boot service ConnectController(). In order to make
@@ -441,8 +434,8 @@ Dhcp6DriverBindingStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
- EFI_STATUS Status;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ DHCP6_SERVICE *Service;
//
// Check the Dhcp6 service whether already started.
@@ -490,7 +483,6 @@ Dhcp6DriverBindingStart ( return EFI_SUCCESS;
}
-
/**
Stop this driver on ControllerHandle. This service is called by the
EFI boot service DisconnectController(). In order to
@@ -519,12 +511,12 @@ Dhcp6DriverBindingStop ( IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_HANDLE NicHandle;
- EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
- DHCP6_SERVICE *Service;
- LIST_ENTRY *List;
- UINTN ListLength;
+ EFI_STATUS Status;
+ EFI_HANDLE NicHandle;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+ DHCP6_SERVICE *Service;
+ LIST_ENTRY *List;
+ UINTN ListLength;
//
// Find and check the Nic handle by the controller handle.
@@ -538,7 +530,7 @@ Dhcp6DriverBindingStop ( Status = gBS->OpenProtocol (
NicHandle,
&gEfiDhcp6ServiceBindingProtocolGuid,
- (VOID **) &ServiceBinding,
+ (VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -553,23 +545,23 @@ Dhcp6DriverBindingStop ( //
// Destroy all the children instances before destroy the service.
//
- List = &Service->Child;
+ List = &Service->Child;
Status = NetDestroyLinkList (
List,
Dhcp6DestroyChildEntry,
ServiceBinding,
&ListLength
);
- if (EFI_ERROR (Status) || ListLength != 0) {
+ if (EFI_ERROR (Status) || (ListLength != 0)) {
Status = EFI_DEVICE_ERROR;
}
}
- if (NumberOfChildren == 0 && !IsListEmpty (&Service->Child)) {
+ if ((NumberOfChildren == 0) && !IsListEmpty (&Service->Child)) {
Status = EFI_DEVICE_ERROR;
}
- if (NumberOfChildren == 0 && IsListEmpty (&Service->Child)) {
+ if ((NumberOfChildren == 0) && IsListEmpty (&Service->Child)) {
//
// Destroy the service itself if no child instance left.
//
@@ -590,7 +582,6 @@ ON_EXIT: return Status;
}
-
/**
Creates a child handle and installs a protocol.
@@ -615,19 +606,19 @@ Dhcp6ServiceBindingCreateChild ( IN OUT EFI_HANDLE *ChildHandle
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- DHCP6_SERVICE *Service;
- DHCP6_INSTANCE *Instance;
- VOID *Udp6;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ DHCP6_SERVICE *Service;
+ DHCP6_INSTANCE *Instance;
+ VOID *Udp6;
- if (This == NULL || ChildHandle == NULL) {
+ if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
Service = DHCP6_SERVICE_FROM_THIS (This);
- Status = Dhcp6CreateInstance (Service, &Instance);
+ Status = Dhcp6CreateInstance (Service, &Instance);
if (EFI_ERROR (Status)) {
return Status;
@@ -670,14 +661,13 @@ Dhcp6ServiceBindingCreateChild ( Status = gBS->OpenProtocol (
Service->UdpIo->UdpHandle,
&gEfiUdp6ProtocolGuid,
- (VOID **) &Udp6,
+ (VOID **)&Udp6,
gDhcp6DriverBinding.DriverBindingHandle,
Instance->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
if (EFI_ERROR (Status)) {
-
gBS->UninstallMultipleProtocolInterfaces (
Instance->Handle,
&gEfiDhcp6ProtocolGuid,
@@ -704,7 +694,6 @@ ON_ERROR: return Status;
}
-
/**
Destroys a child handle with a protocol installed on it.
@@ -730,13 +719,13 @@ Dhcp6ServiceBindingDestroyChild ( IN EFI_HANDLE ChildHandle
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- EFI_DHCP6_PROTOCOL *Dhcp6;
- DHCP6_SERVICE *Service;
- DHCP6_INSTANCE *Instance;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ EFI_DHCP6_PROTOCOL *Dhcp6;
+ DHCP6_SERVICE *Service;
+ DHCP6_INSTANCE *Instance;
- if (This == NULL || ChildHandle == NULL) {
+ if ((This == NULL) || (ChildHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -746,7 +735,7 @@ Dhcp6ServiceBindingDestroyChild ( Status = gBS->OpenProtocol (
ChildHandle,
&gEfiDhcp6ProtocolGuid,
- (VOID **) &Dhcp6,
+ (VOID **)&Dhcp6,
gDhcp6DriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h index 1b8744b9b8..c2079bc4d0 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h @@ -13,9 +13,9 @@ #include <Protocol/ServiceBinding.h>
-extern EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2;
-extern EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable;
+extern EFI_COMPONENT_NAME_PROTOCOL gDhcp6ComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gDhcp6ComponentName2;
+extern EFI_UNICODE_STRING_TABLE *gDhcp6ControllerNameTable;
/**
Test to see if this driver supports ControllerHandle. This service
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c index bb4c1d12a9..61b41d0f76 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c @@ -14,9 +14,11 @@ //
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2
//
-EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {{0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2}};
+EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {
+ { 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2 }
+};
-EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
+EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
EfiDhcp6GetModeData,
EfiDhcp6Configure,
EfiDhcp6Start,
@@ -61,14 +63,14 @@ EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = { EFI_STATUS
EFIAPI
EfiDhcp6Start (
- IN EFI_DHCP6_PROTOCOL *This
+ IN EFI_DHCP6_PROTOCOL *This
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
- EFI_STATUS MediaStatus;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
+ EFI_STATUS MediaStatus;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -93,7 +95,7 @@ EfiDhcp6Start ( return EFI_ALREADY_STARTED;
}
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
//
// Check Media Status.
@@ -119,7 +121,7 @@ EfiDhcp6Start ( //
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -136,10 +138,10 @@ EfiDhcp6Start ( // Poll udp out of the net tpl if synchronous call.
//
if (Instance->Config->IaInfoEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
+
return Instance->UdpSts;
}
@@ -151,7 +153,6 @@ ON_ERROR: return Status;
}
-
/**
Stops the DHCPv6 standard S.A.R.R. process.
@@ -170,14 +171,14 @@ ON_ERROR: EFI_STATUS
EFIAPI
EfiDhcp6Stop (
- IN EFI_DHCP6_PROTOCOL *This
+ IN EFI_DHCP6_PROTOCOL *This
)
{
- EFI_TPL OldTpl;
- EFI_STATUS Status;
- EFI_UDP6_PROTOCOL *Udp6;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
+ EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ EFI_UDP6_PROTOCOL *Udp6;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -200,10 +201,11 @@ EfiDhcp6Stop ( //
// No valid REPLY message received yet, cleanup this instance directly.
//
- if (Instance->IaCb.Ia->State == Dhcp6Init ||
- Instance->IaCb.Ia->State == Dhcp6Selecting ||
- Instance->IaCb.Ia->State == Dhcp6Requesting
- ) {
+ if ((Instance->IaCb.Ia->State == Dhcp6Init) ||
+ (Instance->IaCb.Ia->State == Dhcp6Selecting) ||
+ (Instance->IaCb.Ia->State == Dhcp6Requesting)
+ )
+ {
goto ON_EXIT;
}
@@ -213,7 +215,7 @@ EfiDhcp6Stop ( OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance->UdpSts = EFI_ALREADY_STARTED;
- Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);
+ Status = Dhcp6SendReleaseMsg (Instance, Instance->IaCb.Ia);
gBS->RestoreTPL (OldTpl);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
@@ -227,6 +229,7 @@ EfiDhcp6Stop ( while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Udp6->Poll (Udp6);
}
+
Status = Instance->UdpSts;
}
@@ -241,7 +244,6 @@ ON_EXIT: return Status;
}
-
/**
Returns the current operating mode data for the Dhcp6 instance.
@@ -260,26 +262,26 @@ ON_EXIT: EFI_STATUS
EFIAPI
EfiDhcp6GetModeData (
- IN EFI_DHCP6_PROTOCOL *This,
- OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
- OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
+ IN EFI_DHCP6_PROTOCOL *This,
+ OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
+ OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
)
{
- EFI_TPL OldTpl;
- EFI_DHCP6_IA *Ia;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
- UINT32 IaSize;
- UINT32 IdSize;
-
- if (This == NULL || (Dhcp6ModeData == NULL && Dhcp6ConfigData == NULL)) {
+ EFI_TPL OldTpl;
+ EFI_DHCP6_IA *Ia;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
+ UINT32 IaSize;
+ UINT32 IdSize;
+
+ if ((This == NULL) || ((Dhcp6ModeData == NULL) && (Dhcp6ConfigData == NULL))) {
return EFI_INVALID_PARAMETER;
}
Instance = DHCP6_INSTANCE_FROM_THIS (This);
Service = Instance->Service;
- if (Instance->Config == NULL && Dhcp6ConfigData != NULL) {
+ if ((Instance->Config == NULL) && (Dhcp6ConfigData != NULL)) {
return EFI_ACCESS_DENIED;
}
@@ -291,7 +293,7 @@ EfiDhcp6GetModeData ( // User needs a copy of instance config data.
//
if (Dhcp6ConfigData != NULL) {
- ZeroMem (Dhcp6ConfigData, sizeof(EFI_DHCP6_CONFIG_DATA));
+ ZeroMem (Dhcp6ConfigData, sizeof (EFI_DHCP6_CONFIG_DATA));
//
// Duplicate config data, including all reference buffers.
//
@@ -347,6 +349,7 @@ EfiDhcp6GetModeData ( if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {
goto ON_ERROR;
}
+
CopyMem (
Dhcp6ModeData->Ia->ReplyPacket,
Ia->ReplyPacket,
@@ -365,15 +368,16 @@ ON_ERROR: if (Dhcp6ConfigData != NULL) {
Dhcp6CleanupConfigData (Dhcp6ConfigData);
}
+
if (Dhcp6ModeData != NULL) {
Dhcp6CleanupModeData (Dhcp6ModeData);
}
+
gBS->RestoreTPL (OldTpl);
return EFI_OUT_OF_RESOURCES;
}
-
/**
Initializes, changes, or resets the operational settings for the Dhcp6 instance.
@@ -405,17 +409,17 @@ ON_ERROR: EFI_STATUS
EFIAPI
EfiDhcp6Configure (
- IN EFI_DHCP6_PROTOCOL *This,
- IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
)
{
- EFI_TPL OldTpl;
- EFI_STATUS Status;
- LIST_ENTRY *Entry;
- DHCP6_INSTANCE *Other;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
- UINTN Index;
+ EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ LIST_ENTRY *Entry;
+ DHCP6_INSTANCE *Other;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
+ UINTN Index;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -428,36 +432,40 @@ EfiDhcp6Configure ( // Check the parameter of configure data.
//
if (Dhcp6CfgData != NULL) {
- if (Dhcp6CfgData->OptionCount > 0 && Dhcp6CfgData->OptionList == NULL) {
+ if ((Dhcp6CfgData->OptionCount > 0) && (Dhcp6CfgData->OptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
if (Dhcp6CfgData->OptionList != NULL) {
for (Index = 0; Index < Dhcp6CfgData->OptionCount; Index++) {
- if (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId ||
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit ||
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept ||
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana ||
- Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata
- ) {
+ if ((Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId) ||
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit) ||
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept) ||
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana) ||
+ (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
}
}
- if (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA &&
- Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA
- ) {
+ if ((Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA) &&
+ (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
- if (Dhcp6CfgData->IaInfoEvent == NULL && Dhcp6CfgData->SolicitRetransmission == NULL) {
+ if ((Dhcp6CfgData->IaInfoEvent == NULL) && (Dhcp6CfgData->SolicitRetransmission == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (Dhcp6CfgData->SolicitRetransmission != NULL &&
- Dhcp6CfgData->SolicitRetransmission->Mrc == 0 &&
- Dhcp6CfgData->SolicitRetransmission->Mrd == 0
- ) {
+ if ((Dhcp6CfgData->SolicitRetransmission != NULL) &&
+ (Dhcp6CfgData->SolicitRetransmission->Mrc == 0) &&
+ (Dhcp6CfgData->SolicitRetransmission->Mrd == 0)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
@@ -466,10 +474,11 @@ EfiDhcp6Configure ( //
NET_LIST_FOR_EACH (Entry, &Service->Child) {
Other = NET_LIST_USER_STRUCT (Entry, DHCP6_INSTANCE, Link);
- if (Other->IaCb.Ia != NULL &&
- Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type &&
- Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId
- ) {
+ if ((Other->IaCb.Ia != NULL) &&
+ (Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type) &&
+ (Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId)
+ )
+ {
return EFI_INVALID_PARAMETER;
}
}
@@ -496,7 +505,7 @@ EfiDhcp6Configure ( }
Status = Dhcp6CopyConfigData (Instance->Config, Dhcp6CfgData);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
FreePool (Instance->Config);
gBS->RestoreTPL (OldTpl);
return EFI_OUT_OF_RESOURCES;
@@ -506,21 +515,20 @@ EfiDhcp6Configure ( // Initialize the Ia descriptor from the config data, and leave the other
// fields of the Ia as default value 0.
//
- Instance->IaCb.Ia = AllocateZeroPool (sizeof(EFI_DHCP6_IA));
+ Instance->IaCb.Ia = AllocateZeroPool (sizeof (EFI_DHCP6_IA));
if (Instance->IaCb.Ia == NULL) {
Dhcp6CleanupConfigData (Instance->Config);
FreePool (Instance->Config);
gBS->RestoreTPL (OldTpl);
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem (
&Instance->IaCb.Ia->Descriptor,
&Dhcp6CfgData->IaDescriptor,
- sizeof(EFI_DHCP6_IA_DESCRIPTOR)
+ sizeof (EFI_DHCP6_IA_DESCRIPTOR)
);
-
} else {
-
if (Instance->Config == NULL) {
ASSERT (Instance->IaCb.Ia == NULL);
gBS->RestoreTPL (OldTpl);
@@ -548,7 +556,6 @@ EfiDhcp6Configure ( return EFI_SUCCESS;
}
-
/**
Request configuration information without the assignment of any
Ia addresses of the client.
@@ -604,29 +611,29 @@ EfiDhcp6InfoRequest ( IN VOID *CallbackContext OPTIONAL
)
{
- EFI_STATUS Status;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
- UINTN Index;
- EFI_EVENT Timer;
- EFI_STATUS TimerStatus;
- UINTN GetMappingTimeOut;
-
- if (This == NULL || OptionRequest == NULL || Retransmission == NULL || ReplyCallback == NULL) {
+ EFI_STATUS Status;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
+ UINTN Index;
+ EFI_EVENT Timer;
+ EFI_STATUS TimerStatus;
+ UINTN GetMappingTimeOut;
+
+ if ((This == NULL) || (OptionRequest == NULL) || (Retransmission == NULL) || (ReplyCallback == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (Retransmission != NULL && Retransmission->Mrc == 0 && Retransmission->Mrd == 0) {
+ if ((Retransmission != NULL) && (Retransmission->Mrc == 0) && (Retransmission->Mrd == 0)) {
return EFI_INVALID_PARAMETER;
}
- if (OptionCount > 0 && OptionList == NULL) {
+ if ((OptionCount > 0) && (OptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (OptionList != NULL) {
for (Index = 0; Index < OptionCount; Index++) {
- if (OptionList[Index]->OpCode == Dhcp6OptClientId || OptionList[Index]->OpCode == Dhcp6OptRequestOption) {
+ if ((OptionList[Index]->OpCode == Dhcp6OptClientId) || (OptionList[Index]->OpCode == Dhcp6OptRequestOption)) {
return EFI_INVALID_PARAMETER;
}
}
@@ -651,8 +658,8 @@ EfiDhcp6InfoRequest ( // The link local address is not ready, wait for some time and restart
// the DHCP6 information request process.
//
- Status = Dhcp6GetMappingTimeOut(Service->Ip6Cfg, &GetMappingTimeOut);
- if (EFI_ERROR(Status)) {
+ Status = Dhcp6GetMappingTimeOut (Service->Ip6Cfg, &GetMappingTimeOut);
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -689,6 +696,7 @@ EfiDhcp6InfoRequest ( gBS->CloseEvent (Timer);
}
+
if (EFI_ERROR (Status)) {
return Status;
}
@@ -697,17 +705,16 @@ EfiDhcp6InfoRequest ( // Poll udp out of the net tpl if synchronous call.
//
if (TimeoutEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
+
return Instance->UdpSts;
}
return EFI_SUCCESS;
}
-
/**
Manually extend the valid and preferred lifetimes for the IPv6 addresses
of the configured IA and update other configuration parameters by sending a
@@ -756,14 +763,14 @@ EfiDhcp6InfoRequest ( EFI_STATUS
EFIAPI
EfiDhcp6RenewRebind (
- IN EFI_DHCP6_PROTOCOL *This,
- IN BOOLEAN RebindRequest
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN BOOLEAN RebindRequest
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -784,9 +791,10 @@ EfiDhcp6RenewRebind ( //
// The instance has already entered renewing or rebinding state.
//
- if ((Instance->IaCb.Ia->State == Dhcp6Rebinding && RebindRequest) ||
- (Instance->IaCb.Ia->State == Dhcp6Renewing && !RebindRequest)
- ) {
+ if (((Instance->IaCb.Ia->State == Dhcp6Rebinding) && RebindRequest) ||
+ ((Instance->IaCb.Ia->State == Dhcp6Renewing) && !RebindRequest)
+ )
+ {
return EFI_ALREADY_STARTED;
}
@@ -809,7 +817,7 @@ EfiDhcp6RenewRebind ( //
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -826,10 +834,10 @@ EfiDhcp6RenewRebind ( // Poll udp out of the net tpl if synchronous call.
//
if (Instance->Config->IaInfoEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
+
return Instance->UdpSts;
}
@@ -841,7 +849,6 @@ ON_ERROR: return Status;
}
-
/**
Inform that one or more addresses assigned by a server are already
in use by another node.
@@ -877,18 +884,18 @@ ON_ERROR: EFI_STATUS
EFIAPI
EfiDhcp6Decline (
- IN EFI_DHCP6_PROTOCOL *This,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- EFI_DHCP6_IA *DecIa;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ EFI_DHCP6_IA *DecIa;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
- if (This == NULL || AddressCount == 0 || Addresses == NULL) {
+ if ((This == NULL) || (AddressCount == 0) || (Addresses == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -913,7 +920,7 @@ EfiDhcp6Decline ( //
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -943,7 +950,7 @@ EfiDhcp6Decline ( //
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -961,10 +968,10 @@ EfiDhcp6Decline ( // Poll udp out of the net tpl if synchronous call.
//
if (Instance->Config->IaInfoEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
+
return Instance->UdpSts;
}
@@ -975,12 +982,12 @@ ON_ERROR: if (DecIa != NULL) {
FreePool (DecIa);
}
+
gBS->RestoreTPL (OldTpl);
return Status;
}
-
/**
Release one or more addresses associated with the configured Ia
for current instance.
@@ -1018,18 +1025,18 @@ ON_ERROR: EFI_STATUS
EFIAPI
EfiDhcp6Release (
- IN EFI_DHCP6_PROTOCOL *This,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
)
{
- EFI_STATUS Status;
- EFI_TPL OldTpl;
- EFI_DHCP6_IA *RelIa;
- DHCP6_INSTANCE *Instance;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ EFI_TPL OldTpl;
+ EFI_DHCP6_IA *RelIa;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
- if (This == NULL || (AddressCount != 0 && Addresses == NULL)) {
+ if ((This == NULL) || ((AddressCount != 0) && (Addresses == NULL))) {
return EFI_INVALID_PARAMETER;
}
@@ -1054,7 +1061,7 @@ EfiDhcp6Release ( //
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -1084,7 +1091,7 @@ EfiDhcp6Release ( //
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -1105,6 +1112,7 @@ EfiDhcp6Release ( while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
+
return Instance->UdpSts;
}
@@ -1115,12 +1123,12 @@ ON_ERROR: if (RelIa != NULL) {
FreePool (RelIa);
}
+
gBS->RestoreTPL (OldTpl);
return Status;
}
-
/**
Parse the option data in the Dhcp6 packet.
@@ -1146,21 +1154,21 @@ EfiDhcp6Parse ( OUT EFI_DHCP6_PACKET_OPTION *PacketOptionList[] OPTIONAL
)
{
- UINT32 OptCnt;
- UINT32 OptLen;
- UINT16 DataLen;
- UINT8 *Start;
- UINT8 *End;
+ UINT32 OptCnt;
+ UINT32 OptLen;
+ UINT16 DataLen;
+ UINT8 *Start;
+ UINT8 *End;
- if (This == NULL || Packet == NULL || OptionCount == NULL) {
+ if ((This == NULL) || (Packet == NULL) || (OptionCount == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (*OptionCount != 0 && PacketOptionList == NULL) {
+ if ((*OptionCount != 0) && (PacketOptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (Packet->Length > Packet->Size || Packet->Length < sizeof (EFI_DHCP6_HEADER)) {
+ if ((Packet->Length > Packet->Size) || (Packet->Length < sizeof (EFI_DHCP6_HEADER))) {
return EFI_INVALID_PARAMETER;
}
@@ -1185,7 +1193,7 @@ EfiDhcp6Parse ( // Calculate the number of option in the packet.
//
while (Start < End) {
- DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;
+ DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;
Start += (NTOHS (DataLen) + 4);
OptCnt++;
}
@@ -1208,13 +1216,11 @@ EfiDhcp6Parse ( Start = Packet->Dhcp6.Option;
while (Start < End) {
-
- PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *) Start;
- DataLen = ((EFI_DHCP6_PACKET_OPTION *) Start)->OpLen;
- Start += (NTOHS (DataLen) + 4);
+ PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *)Start;
+ DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;
+ Start += (NTOHS (DataLen) + 4);
OptCnt++;
}
return EFI_SUCCESS;
}
-
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h index f88b00ad04..0eb9c669b5 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h @@ -10,7 +10,6 @@ #ifndef __EFI_DHCP6_IMPL_H__
#define __EFI_DHCP6_IMPL_H__
-
#include <Uefi.h>
#include <IndustryStandard/Dhcp.h>
@@ -33,12 +32,11 @@ #include <Library/PrintLib.h>
#include <Guid/ZeroGuid.h>
-
-typedef struct _DHCP6_IA_CB DHCP6_IA_CB;
-typedef struct _DHCP6_INF_CB DHCP6_INF_CB;
-typedef struct _DHCP6_TX_CB DHCP6_TX_CB;
-typedef struct _DHCP6_SERVICE DHCP6_SERVICE;
-typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
+typedef struct _DHCP6_IA_CB DHCP6_IA_CB;
+typedef struct _DHCP6_INF_CB DHCP6_INF_CB;
+typedef struct _DHCP6_TX_CB DHCP6_TX_CB;
+typedef struct _DHCP6_SERVICE DHCP6_SERVICE;
+typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE;
#include "Dhcp6Utility.h"
#include "Dhcp6Io.h"
@@ -47,104 +45,104 @@ typedef struct _DHCP6_INSTANCE DHCP6_INSTANCE; #define DHCP6_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', '6', 'S')
#define DHCP6_INSTANCE_SIGNATURE SIGNATURE_32 ('D', 'H', '6', 'I')
-#define DHCP6_PACKET_ALL 0
-#define DHCP6_PACKET_STATEFUL 1
-#define DHCP6_PACKET_STATELESS 2
+#define DHCP6_PACKET_ALL 0
+#define DHCP6_PACKET_STATEFUL 1
+#define DHCP6_PACKET_STATELESS 2
-#define DHCP6_BASE_PACKET_SIZE 1024
+#define DHCP6_BASE_PACKET_SIZE 1024
-#define DHCP6_PORT_CLIENT 546
-#define DHCP6_PORT_SERVER 547
+#define DHCP6_PORT_CLIENT 546
+#define DHCP6_PORT_SERVER 547
-#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
+#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
-#define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
-#define DHCP6_SERVICE_FROM_THIS(Service) CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
+#define DHCP6_INSTANCE_FROM_THIS(Instance) CR ((Instance), DHCP6_INSTANCE, Dhcp6, DHCP6_INSTANCE_SIGNATURE)
+#define DHCP6_SERVICE_FROM_THIS(Service) CR ((Service), DHCP6_SERVICE, ServiceBinding, DHCP6_SERVICE_SIGNATURE)
-extern EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress;
-extern EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate;
+extern EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress;
+extern EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate;
//
// Control block for each IA.
//
struct _DHCP6_IA_CB {
- EFI_DHCP6_IA *Ia;
- UINT32 T1;
- UINT32 T2;
- UINT32 AllExpireTime;
- UINT32 LeaseTime;
+ EFI_DHCP6_IA *Ia;
+ UINT32 T1;
+ UINT32 T2;
+ UINT32 AllExpireTime;
+ UINT32 LeaseTime;
};
//
// Control block for each transmitted message.
//
struct _DHCP6_TX_CB {
- LIST_ENTRY Link;
- UINT32 Xid;
- EFI_DHCP6_PACKET *TxPacket;
- EFI_DHCP6_RETRANSMISSION RetryCtl;
- UINT32 RetryCnt;
- UINT32 RetryExp;
- UINT32 RetryLos;
- UINT32 TickTime;
- UINT16 *Elapsed;
- BOOLEAN SolicitRetry;
+ LIST_ENTRY Link;
+ UINT32 Xid;
+ EFI_DHCP6_PACKET *TxPacket;
+ EFI_DHCP6_RETRANSMISSION RetryCtl;
+ UINT32 RetryCnt;
+ UINT32 RetryExp;
+ UINT32 RetryLos;
+ UINT32 TickTime;
+ UINT16 *Elapsed;
+ BOOLEAN SolicitRetry;
};
//
// Control block for each info-request message.
//
struct _DHCP6_INF_CB {
- LIST_ENTRY Link;
- UINT32 Xid;
- EFI_DHCP6_INFO_CALLBACK ReplyCallback;
- VOID *CallbackContext;
- EFI_EVENT TimeoutEvent;
+ LIST_ENTRY Link;
+ UINT32 Xid;
+ EFI_DHCP6_INFO_CALLBACK ReplyCallback;
+ VOID *CallbackContext;
+ EFI_EVENT TimeoutEvent;
};
//
// Control block for Dhcp6 instance, it's per configuration data.
//
struct _DHCP6_INSTANCE {
- UINT32 Signature;
- EFI_HANDLE Handle;
- DHCP6_SERVICE *Service;
- LIST_ENTRY Link;
- EFI_DHCP6_PROTOCOL Dhcp6;
- EFI_EVENT Timer;
- EFI_DHCP6_CONFIG_DATA *Config;
- EFI_DHCP6_IA *CacheIa;
- DHCP6_IA_CB IaCb;
- LIST_ENTRY TxList;
- LIST_ENTRY InfList;
- EFI_DHCP6_PACKET *AdSelect;
- UINT8 AdPref;
- EFI_IPv6_ADDRESS *Unicast;
- volatile EFI_STATUS UdpSts;
- BOOLEAN InDestroy;
- BOOLEAN MediaPresent;
+ UINT32 Signature;
+ EFI_HANDLE Handle;
+ DHCP6_SERVICE *Service;
+ LIST_ENTRY Link;
+ EFI_DHCP6_PROTOCOL Dhcp6;
+ EFI_EVENT Timer;
+ EFI_DHCP6_CONFIG_DATA *Config;
+ EFI_DHCP6_IA *CacheIa;
+ DHCP6_IA_CB IaCb;
+ LIST_ENTRY TxList;
+ LIST_ENTRY InfList;
+ EFI_DHCP6_PACKET *AdSelect;
+ UINT8 AdPref;
+ EFI_IPv6_ADDRESS *Unicast;
+ volatile EFI_STATUS UdpSts;
+ BOOLEAN InDestroy;
+ BOOLEAN MediaPresent;
//
// StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315,
// the elapsed-time is amount of time since the client began its current DHCP transaction.
//
- UINT64 StartTime;
+ UINT64 StartTime;
};
//
// Control block for Dhcp6 service, it's per Nic handle.
//
struct _DHCP6_SERVICE {
- UINT32 Signature;
- EFI_HANDLE Controller;
- EFI_HANDLE Image;
- EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
- EFI_DHCP6_DUID *ClientId;
- UDP_IO *UdpIo;
- UINT32 Xid;
- LIST_ENTRY Child;
- UINTN NumOfChild;
+ UINT32 Signature;
+ EFI_HANDLE Controller;
+ EFI_HANDLE Image;
+ EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
+ EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;
+ EFI_DHCP6_DUID *ClientId;
+ UDP_IO *UdpIo;
+ UINT32 Xid;
+ LIST_ENTRY Child;
+ UINTN NumOfChild;
};
/**
@@ -179,7 +177,7 @@ struct _DHCP6_SERVICE { EFI_STATUS
EFIAPI
EfiDhcp6Start (
- IN EFI_DHCP6_PROTOCOL *This
+ IN EFI_DHCP6_PROTOCOL *This
);
/**
@@ -200,7 +198,7 @@ EfiDhcp6Start ( EFI_STATUS
EFIAPI
EfiDhcp6Stop (
- IN EFI_DHCP6_PROTOCOL *This
+ IN EFI_DHCP6_PROTOCOL *This
);
/**
@@ -222,9 +220,9 @@ EfiDhcp6Stop ( EFI_STATUS
EFIAPI
EfiDhcp6GetModeData (
- IN EFI_DHCP6_PROTOCOL *This,
- OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
- OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
+ IN EFI_DHCP6_PROTOCOL *This,
+ OUT EFI_DHCP6_MODE_DATA *Dhcp6ModeData OPTIONAL,
+ OUT EFI_DHCP6_CONFIG_DATA *Dhcp6ConfigData OPTIONAL
);
/**
@@ -259,8 +257,8 @@ EfiDhcp6GetModeData ( EFI_STATUS
EFIAPI
EfiDhcp6Configure (
- IN EFI_DHCP6_PROTOCOL *This,
- IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN EFI_DHCP6_CONFIG_DATA *Dhcp6CfgData OPTIONAL
);
/**
@@ -366,8 +364,8 @@ EfiDhcp6InfoRequest ( EFI_STATUS
EFIAPI
EfiDhcp6RenewRebind (
- IN EFI_DHCP6_PROTOCOL *This,
- IN BOOLEAN RebindRequest
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN BOOLEAN RebindRequest
);
/**
@@ -405,9 +403,9 @@ EfiDhcp6RenewRebind ( EFI_STATUS
EFIAPI
EfiDhcp6Decline (
- IN EFI_DHCP6_PROTOCOL *This,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
);
/**
@@ -446,9 +444,9 @@ EfiDhcp6Decline ( EFI_STATUS
EFIAPI
EfiDhcp6Release (
- IN EFI_DHCP6_PROTOCOL *This,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
);
/**
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c index c20876d5a5..dcd01e6268 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c @@ -10,7 +10,6 @@ #include "Dhcp6Impl.h"
-
/**
Enqueue the packet into the retry list in case of timeout.
@@ -34,8 +33,8 @@ Dhcp6EnqueueRetry ( IN EFI_DHCP6_RETRANSMISSION *RetryCtl OPTIONAL
)
{
- DHCP6_TX_CB *TxCb;
- DHCP6_IA_CB *IaCb;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_IA_CB *IaCb;
ASSERT (Packet != NULL);
@@ -55,156 +54,156 @@ Dhcp6EnqueueRetry ( //
// Save pointer to elapsed-time value so we can update it on retransmits.
//
- TxCb->Elapsed = Elapsed;
+ TxCb->Elapsed = Elapsed;
//
// Calculate the retransmission according to the message type.
//
switch (Packet->Dhcp6.Header.MessageType) {
- case Dhcp6MsgSolicit:
- //
- // Calculate the retransmission threshold value for solicit packet.
- // Use the default value by rfc-3315 if user doesn't configure.
- //
- if (RetryCtl == NULL) {
- TxCb->RetryCtl.Irt = DHCP6_SOL_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_SOL_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_SOL_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_SOL_MRD;
- } else {
- TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_SOL_IRT;
- TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_SOL_MRC;
- TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_SOL_MRT;
- TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_SOL_MRD;
- }
+ case Dhcp6MsgSolicit:
+ //
+ // Calculate the retransmission threshold value for solicit packet.
+ // Use the default value by rfc-3315 if user doesn't configure.
+ //
+ if (RetryCtl == NULL) {
+ TxCb->RetryCtl.Irt = DHCP6_SOL_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_SOL_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_SOL_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_SOL_MRD;
+ } else {
+ TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_SOL_IRT;
+ TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_SOL_MRC;
+ TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_SOL_MRT;
+ TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_SOL_MRD;
+ }
+
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ FALSE
+ );
+ break;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ case Dhcp6MsgRequest:
+ //
+ // Calculate the retransmission threshold value for request packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REQ_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REQ_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REQ_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_REQ_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
TxCb->RetryCtl.Irt,
TRUE,
- FALSE
+ TRUE
);
- break;
-
- case Dhcp6MsgRequest:
- //
- // Calculate the retransmission threshold value for request packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REQ_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REQ_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REQ_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_REQ_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
-
- case Dhcp6MsgConfirm:
- //
- // Calculate the retransmission threshold value for confirm packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_CNF_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_CNF_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_CNF_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_CNF_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
-
- case Dhcp6MsgRenew:
- //
- // Calculate the retransmission threshold value for renew packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REB_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REB_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REB_MRT;
- TxCb->RetryCtl.Mrd = IaCb->T2 - IaCb->T1;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ break;
- case Dhcp6MsgRebind:
- //
- // Calculate the retransmission threshold value for rebind packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REN_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REN_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REN_MRT;
- TxCb->RetryCtl.Mrd = IaCb->AllExpireTime - IaCb->T2;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ case Dhcp6MsgConfirm:
+ //
+ // Calculate the retransmission threshold value for confirm packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_CNF_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_CNF_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_CNF_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_CNF_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- case Dhcp6MsgDecline:
- //
- // Calculate the retransmission threshold value for decline packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_DEC_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_DEC_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_DEC_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_DEC_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ case Dhcp6MsgRenew:
+ //
+ // Calculate the retransmission threshold value for renew packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REB_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REB_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REB_MRT;
+ TxCb->RetryCtl.Mrd = IaCb->T2 - IaCb->T1;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- case Dhcp6MsgRelease:
- //
- // Calculate the retransmission threshold value for release packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REL_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REL_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REL_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_REL_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ case Dhcp6MsgRebind:
+ //
+ // Calculate the retransmission threshold value for rebind packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REN_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REN_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REN_MRT;
+ TxCb->RetryCtl.Mrd = IaCb->AllExpireTime - IaCb->T2;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- case Dhcp6MsgInfoRequest:
- //
- // Calculate the retransmission threshold value for info-request packet.
- // Use the default value by rfc-3315 if user doesn't configure.
- //
- if (RetryCtl == NULL) {
- TxCb->RetryCtl.Irt = DHCP6_INF_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_INF_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_INF_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_INF_MRD;
- } else {
- TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_INF_IRT;
- TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_INF_MRC;
- TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_INF_MRT;
- TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_INF_MRD;
- }
+ case Dhcp6MsgDecline:
+ //
+ // Calculate the retransmission threshold value for decline packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_DEC_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_DEC_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_DEC_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_DEC_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ case Dhcp6MsgRelease:
+ //
+ // Calculate the retransmission threshold value for release packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REL_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REL_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REL_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_REL_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
TxCb->RetryCtl.Irt,
TRUE,
TRUE
);
- break;
+ break;
- default:
- //
- // Unexpected message type.
- //
- FreePool(TxCb);
- return EFI_DEVICE_ERROR;
+ case Dhcp6MsgInfoRequest:
+ //
+ // Calculate the retransmission threshold value for info-request packet.
+ // Use the default value by rfc-3315 if user doesn't configure.
+ //
+ if (RetryCtl == NULL) {
+ TxCb->RetryCtl.Irt = DHCP6_INF_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_INF_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_INF_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_INF_MRD;
+ } else {
+ TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_INF_IRT;
+ TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_INF_MRC;
+ TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_INF_MRT;
+ TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_INF_MRD;
+ }
+
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
+
+ default:
+ //
+ // Unexpected message type.
+ //
+ FreePool (TxCb);
+ return EFI_DEVICE_ERROR;
}
//
@@ -215,7 +214,6 @@ Dhcp6EnqueueRetry ( return EFI_SUCCESS;
}
-
/**
Dequeue the packet from retry list if reply received or timeout at last.
@@ -230,40 +228,36 @@ Dhcp6EnqueueRetry ( **/
EFI_STATUS
Dhcp6DequeueRetry (
- IN DHCP6_INSTANCE *Instance,
- IN UINT32 PacketXid,
- IN BOOLEAN NeedSignal
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT32 PacketXid,
+ IN BOOLEAN NeedSignal
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- DHCP6_TX_CB *TxCb;
- DHCP6_INF_CB *InfCb;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_INF_CB *InfCb;
//
// Seek the retransmit node in the retransmit list by packet xid.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
if (TxCb->Xid == PacketXid) {
-
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
-
//
// Seek the info-request node in the info-request list by packet xid.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
-
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
if (InfCb->Xid == PacketXid) {
//
// Remove the info-request node, and signal the event if timeout.
//
- if (InfCb->TimeoutEvent != NULL && NeedSignal) {
+ if ((InfCb->TimeoutEvent != NULL) && NeedSignal) {
gBS->SignalEvent (InfCb->TimeoutEvent);
}
@@ -272,11 +266,12 @@ Dhcp6DequeueRetry ( }
}
}
+
//
// Remove the retransmit node.
//
RemoveEntryList (&TxCb->Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
FreePool (TxCb->TxPacket);
FreePool (TxCb);
return EFI_SUCCESS;
@@ -286,7 +281,6 @@ Dhcp6DequeueRetry ( return EFI_NOT_FOUND;
}
-
/**
Clean up the specific nodes in the retry list.
@@ -296,24 +290,22 @@ Dhcp6DequeueRetry ( **/
VOID
Dhcp6CleanupRetry (
- IN DHCP6_INSTANCE *Instance,
- IN UINT32 Scope
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT32 Scope
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- DHCP6_TX_CB *TxCb;
- DHCP6_INF_CB *InfCb;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_INF_CB *InfCb;
//
// Clean up all the stateful messages from the retransmit list.
//
- if (Scope == DHCP6_PACKET_STATEFUL || Scope == DHCP6_PACKET_ALL) {
-
+ if ((Scope == DHCP6_PACKET_STATEFUL) || (Scope == DHCP6_PACKET_ALL)) {
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
if (TxCb->TxPacket->Dhcp6.Header.MessageType != Dhcp6MsgInfoRequest) {
RemoveEntryList (&TxCb->Link);
@@ -326,15 +318,13 @@ Dhcp6CleanupRetry ( //
// Clean up all the stateless messages from the retransmit list.
//
- if (Scope == DHCP6_PACKET_STATELESS || Scope == DHCP6_PACKET_ALL) {
-
+ if ((Scope == DHCP6_PACKET_STATELESS) || (Scope == DHCP6_PACKET_ALL)) {
//
// Clean up all the retransmit list for stateless messages.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
RemoveEntryList (&TxCb->Link);
@@ -347,12 +337,12 @@ Dhcp6CleanupRetry ( // Clean up all the info-request messages list.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
-
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
if (InfCb->TimeoutEvent != NULL) {
gBS->SignalEvent (InfCb->TimeoutEvent);
}
+
RemoveEntryList (&InfCb->Link);
FreePool (InfCb);
}
@@ -371,11 +361,11 @@ Dhcp6CleanupRetry ( **/
BOOLEAN
Dhcp6IsValidTxCb (
- IN DHCP6_INSTANCE *Instance,
- IN DHCP6_TX_CB *TxCb
+ IN DHCP6_INSTANCE *Instance,
+ IN DHCP6_TX_CB *TxCb
)
{
- LIST_ENTRY *Entry;
+ LIST_ENTRY *Entry;
NET_LIST_FOR_EACH (Entry, &Instance->TxList) {
if (TxCb == NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link)) {
@@ -395,15 +385,15 @@ Dhcp6IsValidTxCb ( **/
VOID
Dhcp6CleanupSession (
- IN OUT DHCP6_INSTANCE *Instance,
- IN EFI_STATUS Status
+ IN OUT DHCP6_INSTANCE *Instance,
+ IN EFI_STATUS Status
)
{
- UINTN Index;
- EFI_DHCP6_IA *Ia;
+ UINTN Index;
+ EFI_DHCP6_IA *Ia;
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
//
// Clean up the retransmit list for stateful messages.
@@ -425,23 +415,23 @@ Dhcp6CleanupSession ( //
// Reinitialize the Ia fields of the instance.
//
- Instance->UdpSts = Status;
- Instance->AdSelect = NULL;
- Instance->AdPref = 0;
- Instance->Unicast = NULL;
- Instance->IaCb.T1 = 0;
- Instance->IaCb.T2 = 0;
- Instance->IaCb.AllExpireTime = 0;
- Instance->IaCb.LeaseTime = 0;
+ Instance->UdpSts = Status;
+ Instance->AdSelect = NULL;
+ Instance->AdPref = 0;
+ Instance->Unicast = NULL;
+ Instance->IaCb.T1 = 0;
+ Instance->IaCb.T2 = 0;
+ Instance->IaCb.AllExpireTime = 0;
+ Instance->IaCb.LeaseTime = 0;
//
// Clear start time
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
- Ia = Instance->IaCb.Ia;
- Ia->State = Dhcp6Init;
- Ia->ReplyPacket = NULL;
+ Ia = Instance->IaCb.Ia;
+ Ia->State = Dhcp6Init;
+ Ia->ReplyPacket = NULL;
//
// Set the addresses as zero lifetime, and then the notify
@@ -461,7 +451,6 @@ Dhcp6CleanupSession ( }
}
-
/**
Callback to user when Dhcp6 transmit/receive occurs.
@@ -477,15 +466,15 @@ Dhcp6CleanupSession ( EFI_STATUS
EFIAPI
Dhcp6CallbackUser (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_EVENT Event,
- IN OUT EFI_DHCP6_PACKET **Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_EVENT Event,
+ IN OUT EFI_DHCP6_PACKET **Packet
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *NewPacket;
- EFI_DHCP6_CALLBACK Callback;
- VOID *Context;
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *NewPacket;
+ EFI_DHCP6_CALLBACK Callback;
+ VOID *Context;
ASSERT (Packet != NULL);
ASSERT (Instance->Config != NULL);
@@ -500,7 +489,6 @@ Dhcp6CallbackUser ( // Callback to user with the new message if has.
//
if (Callback != NULL) {
-
Status = Callback (
&Instance->Dhcp6,
Context,
@@ -522,7 +510,6 @@ Dhcp6CallbackUser ( return Status;
}
-
/**
Update Ia according to the new reply message.
@@ -535,17 +522,17 @@ Dhcp6CallbackUser ( **/
EFI_STATUS
Dhcp6UpdateIaInfo (
- IN OUT DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN OUT DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 *Option;
- UINT8 *IaInnerOpt;
- UINT16 IaInnerLen;
- UINT16 StsCode;
- UINT32 T1;
- UINT32 T2;
+ EFI_STATUS Status;
+ UINT8 *Option;
+ UINT8 *IaInnerOpt;
+ UINT16 IaInnerLen;
+ UINT16 StsCode;
+ UINT32 T1;
+ UINT32 T2;
ASSERT (Instance->Config != NULL);
//
@@ -611,23 +598,24 @@ Dhcp6UpdateIaInfo ( // The inner options still start with 2 bytes option-code and 2 bytes option-len.
//
if (Instance->Config->IaDescriptor.Type == Dhcp6OptIana) {
- T1 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 8)));
- T2 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 12)));
+ T1 = NTOHL (ReadUnaligned32 ((UINT32 *)(Option + 8)));
+ T2 = NTOHL (ReadUnaligned32 ((UINT32 *)(Option + 12)));
//
// Refer to RFC3155 Chapter 22.4. If a client receives an IA_NA with T1 greater than T2,
// and both T1 and T2 are greater than 0, the client discards the IA_NA option and processes
// the remainder of the message as though the server had not included the invalid IA_NA option.
//
- if (T1 > T2 && T2 > 0) {
+ if ((T1 > T2) && (T2 > 0)) {
return EFI_DEVICE_ERROR;
}
+
IaInnerOpt = Option + 16;
- IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 2))) - 12);
+ IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(Option + 2))) - 12);
} else {
- T1 = 0;
- T2 = 0;
+ T1 = 0;
+ T2 = 0;
IaInnerOpt = Option + 8;
- IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 2))) - 4);
+ IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(Option + 2))) - 4);
}
//
@@ -653,7 +641,7 @@ Dhcp6UpdateIaInfo ( Option = Dhcp6SeekOption (IaInnerOpt, IaInnerLen, Dhcp6OptStatusCode);
if (Option != NULL) {
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 4)));
+ StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)(Option + 4)));
if (StsCode != Dhcp6StsSuccess) {
return EFI_DEVICE_ERROR;
}
@@ -673,8 +661,6 @@ Dhcp6UpdateIaInfo ( return Status;
}
-
-
/**
Seek StatusCode Option in package. A Status Code option may appear in the
options field of a DHCP message and/or in the options field of another option.
@@ -690,14 +676,14 @@ Dhcp6UpdateIaInfo ( **/
EFI_STATUS
Dhcp6SeekStsOption (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet,
- OUT UINT8 **Option
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet,
+ OUT UINT8 **Option
)
{
- UINT8 *IaInnerOpt;
- UINT16 IaInnerLen;
- UINT16 StsCode;
+ UINT8 *IaInnerOpt;
+ UINT16 IaInnerLen;
+ UINT16 StsCode;
//
// Seek StatusCode option directly in DHCP message body. That is, search in
@@ -710,7 +696,7 @@ Dhcp6SeekStsOption ( );
if (*Option != NULL) {
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (*Option + 4)));
+ StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)(*Option + 4)));
if (StsCode != Dhcp6StsSuccess) {
return EFI_DEVICE_ERROR;
}
@@ -771,10 +757,10 @@ Dhcp6SeekStsOption ( //
if (Instance->Config->IaDescriptor.Type == Dhcp6OptIana) {
IaInnerOpt = *Option + 16;
- IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (*Option + 2))) - 12);
+ IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(*Option + 2))) - 12);
} else {
IaInnerOpt = *Option + 8;
- IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (*Option + 2))) - 4);
+ IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(*Option + 2))) - 4);
}
//
@@ -796,9 +782,9 @@ Dhcp6SeekStsOption ( //
// sizeof (option-code + option-len) = 4
//
- *Option = Dhcp6SeekOption (IaInnerOpt, IaInnerLen, Dhcp6OptStatusCode);
+ *Option = Dhcp6SeekOption (IaInnerOpt, IaInnerLen, Dhcp6OptStatusCode);
if (*Option != NULL) {
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (*Option + 4)));
+ StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)(*Option + 4)));
if (StsCode != Dhcp6StsSuccess) {
return EFI_DEVICE_ERROR;
}
@@ -807,7 +793,6 @@ Dhcp6SeekStsOption ( return EFI_SUCCESS;
}
-
/**
Transmit Dhcp6 message by udpio.
@@ -822,23 +807,23 @@ Dhcp6SeekStsOption ( **/
EFI_STATUS
Dhcp6TransmitPacket (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet,
- IN UINT16 *Elapsed
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet,
+ IN UINT16 *Elapsed
)
{
- EFI_STATUS Status;
- NET_BUF *Wrap;
- NET_FRAGMENT Frag;
- UDP_END_POINT EndPt;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ NET_BUF *Wrap;
+ NET_FRAGMENT Frag;
+ UDP_END_POINT EndPt;
+ DHCP6_SERVICE *Service;
Service = Instance->Service;
//
// Wrap it into a netbuf then send it.
//
- Frag.Bulk = (UINT8 *) &Packet->Dhcp6.Header;
+ Frag.Bulk = (UINT8 *)&Packet->Dhcp6.Header;
Frag.Len = Packet->Length;
//
@@ -899,7 +884,6 @@ Dhcp6TransmitPacket ( return EFI_SUCCESS;
}
-
/**
Create the solicit message and send it.
@@ -912,19 +896,19 @@ Dhcp6TransmitPacket ( **/
EFI_STATUS
Dhcp6SendSolicitMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- DHCP6_SERVICE *Service;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
Service = Instance->Service;
ClientId = Service->ClientId;
@@ -985,9 +969,8 @@ Dhcp6SendSolicitMsg ( // Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
-
UserOpt = Instance->Config->OptionList[Index];
- Cursor = Dhcp6AppendOption(
+ Cursor = Dhcp6AppendOption (
Cursor,
UserOpt->OpCode,
UserOpt->OpLen,
@@ -998,7 +981,7 @@ Dhcp6SendSolicitMsg ( //
// Determine the size/length of packet.
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
@@ -1051,17 +1034,16 @@ Dhcp6SendSolicitMsg ( **/
EFI_STATUS
Dhcp6InitSolicitMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- Instance->IaCb.T1 = 0;
- Instance->IaCb.T2 = 0;
+ Instance->IaCb.T1 = 0;
+ Instance->IaCb.T2 = 0;
Instance->IaCb.Ia->IaAddressCount = 0;
return Dhcp6SendSolicitMsg (Instance);
}
-
/**
Create the request message and send it.
@@ -1075,31 +1057,31 @@ Dhcp6InitSolicitMsg ( **/
EFI_STATUS
Dhcp6SendRequestMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
-
- ASSERT(Instance->AdSelect != NULL);
- ASSERT(Instance->Config != NULL);
- ASSERT(Instance->IaCb.Ia != NULL);
- ASSERT(Instance->Service != NULL);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
+
+ ASSERT (Instance->AdSelect != NULL);
+ ASSERT (Instance->Config != NULL);
+ ASSERT (Instance->IaCb.Ia != NULL);
+ ASSERT (Instance->Service != NULL);
Service = Instance->Service;
ClientId = Service->ClientId;
- ASSERT(ClientId != NULL);
+ ASSERT (ClientId != NULL);
//
// Get the server Id from the selected advertisement message.
@@ -1113,7 +1095,7 @@ Dhcp6SendRequestMsg ( return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Calculate the added length of customized option list.
@@ -1174,9 +1156,8 @@ Dhcp6SendRequestMsg ( // Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
-
UserOpt = Instance->Config->OptionList[Index];
- Cursor = Dhcp6AppendOption(
+ Cursor = Dhcp6AppendOption (
Cursor,
UserOpt->OpCode,
UserOpt->OpLen,
@@ -1187,7 +1168,7 @@ Dhcp6SendRequestMsg ( //
// Determine the size/length of packet.
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
@@ -1223,7 +1204,6 @@ Dhcp6SendRequestMsg ( return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
/**
Create the decline message and send it.
@@ -1238,20 +1218,20 @@ Dhcp6SendRequestMsg ( **/
EFI_STATUS
Dhcp6SendDeclineMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *DecIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *DecIa
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET *LastReply;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT16 Length;
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET *LastReply;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT16 Length;
ASSERT (Instance->Config != NULL);
ASSERT (Instance->IaCb.Ia != NULL);
@@ -1279,7 +1259,7 @@ Dhcp6SendDeclineMsg ( //
// EFI_DHCP6_DUID contains a length field of 2 bytes.
//
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Create the Dhcp6 packet and initialize common fields.
@@ -1325,7 +1305,7 @@ Dhcp6SendDeclineMsg ( //
// Determine the size/length of packet.
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
@@ -1361,7 +1341,6 @@ Dhcp6SendDeclineMsg ( return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
/**
Create the release message and send it.
@@ -1376,30 +1355,30 @@ Dhcp6SendDeclineMsg ( **/
EFI_STATUS
Dhcp6SendReleaseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *RelIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *RelIa
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET *LastReply;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT16 Length;
-
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET *LastReply;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT16 Length;
+
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
Service = Instance->Service;
ClientId = Service->ClientId;
LastReply = Instance->IaCb.Ia->ReplyPacket;
- ASSERT(ClientId);
- ASSERT(LastReply);
+ ASSERT (ClientId);
+ ASSERT (LastReply);
//
// Get the server Id from the last reply message.
@@ -1413,7 +1392,7 @@ Dhcp6SendReleaseMsg ( return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Create the Dhcp6 packet and initialize common fields.
@@ -1462,7 +1441,7 @@ Dhcp6SendReleaseMsg ( //
// Determine the size/length of packet
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
@@ -1494,7 +1473,6 @@ Dhcp6SendReleaseMsg ( return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
/**
Create the renew/rebind message and send it.
@@ -1510,33 +1488,33 @@ Dhcp6SendReleaseMsg ( **/
EFI_STATUS
Dhcp6SendRenewRebindMsg (
- IN DHCP6_INSTANCE *Instance,
- IN BOOLEAN RebindRequest
+ IN DHCP6_INSTANCE *Instance,
+ IN BOOLEAN RebindRequest
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET *LastReply;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- EFI_DHCP6_STATE State;
- EFI_DHCP6_EVENT Event;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
-
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET *LastReply;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ EFI_DHCP6_STATE State;
+ EFI_DHCP6_EVENT Event;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
- Service = Instance->Service;
- ClientId = Service->ClientId;
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
- ASSERT(ClientId);
+ Service = Instance->Service;
+ ClientId = Service->ClientId;
+
+ ASSERT (ClientId);
//
// Calculate the added length of customized option list.
@@ -1604,7 +1582,7 @@ Dhcp6SendRenewRebindMsg ( return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
Cursor = Dhcp6AppendOption (
Cursor,
@@ -1618,9 +1596,8 @@ Dhcp6SendRenewRebindMsg ( // Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
-
UserOpt = Instance->Config->OptionList[Index];
- Cursor = Dhcp6AppendOption(
+ Cursor = Dhcp6AppendOption (
Cursor,
UserOpt->OpCode,
UserOpt->OpLen,
@@ -1631,14 +1608,14 @@ Dhcp6SendRenewRebindMsg ( //
// Determine the size/length of packet.
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
// Callback to user with the packet to be sent and check the user's feedback.
//
- State = (RebindRequest) ? Dhcp6Rebinding : Dhcp6Renewing;
- Event = (RebindRequest) ? Dhcp6EnterRebinding : Dhcp6EnterRenewing;
+ State = (RebindRequest) ? Dhcp6Rebinding : Dhcp6Renewing;
+ Event = (RebindRequest) ? Dhcp6EnterRebinding : Dhcp6EnterRenewing;
Status = Dhcp6CallbackUser (Instance, Event, &Packet);
@@ -1707,19 +1684,19 @@ Dhcp6StartInfoRequest ( IN VOID *CallbackContext OPTIONAL
)
{
- EFI_STATUS Status;
- DHCP6_INF_CB *InfCb;
- DHCP6_SERVICE *Service;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ DHCP6_INF_CB *InfCb;
+ DHCP6_SERVICE *Service;
+ EFI_TPL OldTpl;
- Service = Instance->Service;
+ Service = Instance->Service;
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance->UdpSts = EFI_ALREADY_STARTED;
//
// Create and initialize the control block for the info-request.
//
- InfCb = AllocateZeroPool (sizeof(DHCP6_INF_CB));
+ InfCb = AllocateZeroPool (sizeof (DHCP6_INF_CB));
if (InfCb == NULL) {
gBS->RestoreTPL (OldTpl);
@@ -1752,7 +1729,7 @@ Dhcp6StartInfoRequest ( //
// Register receive callback for the stateless exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -1803,24 +1780,24 @@ Dhcp6SendInfoRequestMsg ( IN EFI_DHCP6_RETRANSMISSION *Retransmission
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- DHCP6_SERVICE *Service;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
-
- ASSERT(OptionRequest);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
+
+ ASSERT (OptionRequest);
Service = Instance->Service;
ClientId = Service->ClientId;
UserLen = NTOHS (OptionRequest->OpLen) + 4;
- ASSERT(ClientId);
+ ASSERT (ClientId);
//
// Calculate the added length of customized option list.
@@ -1842,7 +1819,7 @@ Dhcp6SendInfoRequestMsg ( Packet->Dhcp6.Header.MessageType = Dhcp6MsgInfoRequest;
Packet->Dhcp6.Header.TransactionId = Service->Xid++;
- InfCb->Xid = Packet->Dhcp6.Header.TransactionId;
+ InfCb->Xid = Packet->Dhcp6.Header.TransactionId;
//
// Assembly Dhcp6 options for info-request message.
@@ -1876,9 +1853,8 @@ Dhcp6SendInfoRequestMsg ( // Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < OptionCount; Index++) {
-
UserOpt = OptionList[Index];
- Cursor = Dhcp6AppendOption(
+ Cursor = Dhcp6AppendOption (
Cursor,
UserOpt->OpCode,
UserOpt->OpLen,
@@ -1889,7 +1865,7 @@ Dhcp6SendInfoRequestMsg ( //
// Determine the size/length of packet.
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
@@ -1913,7 +1889,6 @@ Dhcp6SendInfoRequestMsg ( return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, Retransmission);
}
-
/**
Create the Confirm message and send it.
@@ -1927,19 +1902,19 @@ Dhcp6SendInfoRequestMsg ( **/
EFI_STATUS
Dhcp6SendConfirmMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- UINT8 *Cursor;
- UINTN Index;
- UINT16 Length;
- UINT32 UserLen;
- EFI_STATUS Status;
- DHCP6_SERVICE *Service;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- UINT16 *Elapsed;
+ UINT8 *Cursor;
+ UINTN Index;
+ UINT16 Length;
+ UINT32 UserLen;
+ EFI_STATUS Status;
+ DHCP6_SERVICE *Service;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ UINT16 *Elapsed;
ASSERT (Instance->Config != NULL);
ASSERT (Instance->IaCb.Ia != NULL);
@@ -2013,7 +1988,7 @@ Dhcp6SendConfirmMsg ( //
// Determine the size/length of packet.
//
- Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
+ Packet->Length += (UINT32)(Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
//
@@ -2049,8 +2024,6 @@ Dhcp6SendConfirmMsg ( return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
-
/**
Handle with the Dhcp6 reply message.
@@ -2065,13 +2038,13 @@ Dhcp6SendConfirmMsg ( **/
EFI_STATUS
Dhcp6HandleReplyMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 *Option;
- UINT16 StsCode;
+ EFI_STATUS Status;
+ UINT8 *Option;
+ UINT16 StsCode;
ASSERT (Instance->Config != NULL);
ASSERT (Instance->IaCb.Ia != NULL);
@@ -2096,7 +2069,7 @@ Dhcp6HandleReplyMsg ( Dhcp6OptRapidCommit
);
- if ((Option != NULL && !Instance->Config->RapidCommit) || (Option == NULL && Instance->Config->RapidCommit)) {
+ if (((Option != NULL) && !Instance->Config->RapidCommit) || ((Option == NULL) && Instance->Config->RapidCommit)) {
return EFI_DEVICE_ERROR;
}
@@ -2104,11 +2077,11 @@ Dhcp6HandleReplyMsg ( // As to a valid reply packet in response to a request/renew/rebind packet,
// ignore the packet if not contains the Ia option
//
- if (Instance->IaCb.Ia->State == Dhcp6Requesting ||
- Instance->IaCb.Ia->State == Dhcp6Renewing ||
- Instance->IaCb.Ia->State == Dhcp6Rebinding
- ) {
-
+ if ((Instance->IaCb.Ia->State == Dhcp6Requesting) ||
+ (Instance->IaCb.Ia->State == Dhcp6Renewing) ||
+ (Instance->IaCb.Ia->State == Dhcp6Rebinding)
+ )
+ {
Option = Dhcp6SeekIaOption (
Packet->Dhcp6.Option,
Packet->Length,
@@ -2133,10 +2106,9 @@ Dhcp6HandleReplyMsg ( // the client considers the decline/release event completed regardless of the
// status code.
//
- if (Instance->IaCb.Ia->State == Dhcp6Declining || Instance->IaCb.Ia->State == Dhcp6Releasing) {
-
+ if ((Instance->IaCb.Ia->State == Dhcp6Declining) || (Instance->IaCb.Ia->State == Dhcp6Releasing)) {
if (Instance->IaCb.Ia->IaAddressCount != 0) {
- Instance->IaCb.Ia->State = Dhcp6Bound;
+ Instance->IaCb.Ia->State = Dhcp6Bound;
} else {
ASSERT (Instance->IaCb.Ia->ReplyPacket);
FreePool (Instance->IaCb.Ia->ReplyPacket);
@@ -2159,7 +2131,7 @@ Dhcp6HandleReplyMsg ( //
// Reset start time for next exchange.
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
Status = EFI_SUCCESS;
goto ON_EXIT;
@@ -2186,7 +2158,7 @@ Dhcp6HandleReplyMsg ( //
// Reset start time for next exchange.
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
//
// Set bound state and store the reply packet.
@@ -2209,7 +2181,7 @@ Dhcp6HandleReplyMsg ( //
// For sync, set the success flag out of polling in start/renewrebind.
//
- Instance->UdpSts = EFI_SUCCESS;
+ Instance->UdpSts = EFI_SUCCESS;
//
// Maybe this is a new round DHCP process due to some reason, such as NotOnLink
@@ -2235,70 +2207,72 @@ Dhcp6HandleReplyMsg ( }
goto ON_EXIT;
-
} else if (Option != NULL) {
//
// Any error status code option is found.
//
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 4)));
+ StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)(Option + 4)));
switch (StsCode) {
- case Dhcp6StsUnspecFail:
- //
- // It indicates the server is unable to process the message due to an
- // unspecified failure condition, so just retry if possible.
- //
- break;
-
- case Dhcp6StsUseMulticast:
- //
- // It indicates the server receives a message via unicast from a client
- // to which the server has not sent a unicast option, so retry it by
- // multi-cast address.
- //
- if (Instance->Unicast != NULL) {
- FreePool (Instance->Unicast);
- Instance->Unicast = NULL;
- }
- break;
-
- case Dhcp6StsNotOnLink:
- if (Instance->IaCb.Ia->State == Dhcp6Confirming) {
+ case Dhcp6StsUnspecFail:
//
- // Before initiate new round DHCP, cache the current IA.
+ // It indicates the server is unable to process the message due to an
+ // unspecified failure condition, so just retry if possible.
//
- Status = Dhcp6CacheIa (Instance);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ break;
+ case Dhcp6StsUseMulticast:
//
- // Restart S.A.R.R process to acquire new address.
+ // It indicates the server receives a message via unicast from a client
+ // to which the server has not sent a unicast option, so retry it by
+ // multi-cast address.
//
- Status = Dhcp6InitSolicitMsg (Instance);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (Instance->Unicast != NULL) {
+ FreePool (Instance->Unicast);
+ Instance->Unicast = NULL;
}
- }
- break;
- case Dhcp6StsNoBinding:
- if (Instance->IaCb.Ia->State == Dhcp6Renewing || Instance->IaCb.Ia->State == Dhcp6Rebinding) {
- //
- // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client
- // sends a Request message if the IA contained a Status Code option with the NoBinding status.
- //
- Status = Dhcp6SendRequestMsg(Instance);
- if (EFI_ERROR (Status)) {
- return Status;
+ break;
+
+ case Dhcp6StsNotOnLink:
+ if (Instance->IaCb.Ia->State == Dhcp6Confirming) {
+ //
+ // Before initiate new round DHCP, cache the current IA.
+ //
+ Status = Dhcp6CacheIa (Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Restart S.A.R.R process to acquire new address.
+ //
+ Status = Dhcp6InitSolicitMsg (Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
- }
- break;
- default:
- //
- // The other status code, just restart solicitation.
- //
- break;
+ break;
+
+ case Dhcp6StsNoBinding:
+ if ((Instance->IaCb.Ia->State == Dhcp6Renewing) || (Instance->IaCb.Ia->State == Dhcp6Rebinding)) {
+ //
+ // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client
+ // sends a Request message if the IA contained a Status Code option with the NoBinding status.
+ //
+ Status = Dhcp6SendRequestMsg (Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ break;
+
+ default:
+ //
+ // The other status code, just restart solicitation.
+ //
+ break;
}
}
@@ -2306,7 +2280,7 @@ Dhcp6HandleReplyMsg ( ON_EXIT:
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = Dhcp6DequeueRetry (
Instance,
Packet->Dhcp6.Header.TransactionId,
@@ -2317,7 +2291,6 @@ ON_EXIT: return Status;
}
-
/**
Select the appointed Dhcp6 advertisement message.
@@ -2331,12 +2304,12 @@ ON_EXIT: **/
EFI_STATUS
Dhcp6SelectAdvertiseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *AdSelect
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *AdSelect
)
{
- EFI_STATUS Status;
- UINT8 *Option;
+ EFI_STATUS Status;
+ UINT8 *Option;
ASSERT (AdSelect != NULL);
@@ -2361,7 +2334,7 @@ Dhcp6SelectAdvertiseMsg ( FALSE
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -2369,21 +2342,20 @@ Dhcp6SelectAdvertiseMsg ( // Check whether there is server unicast option in the selected advertise
// packet, and update it.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
AdSelect->Dhcp6.Option,
AdSelect->Length - 4,
Dhcp6OptServerUnicast
);
if (Option != NULL) {
-
- Instance->Unicast = AllocateZeroPool (sizeof(EFI_IPv6_ADDRESS));
+ Instance->Unicast = AllocateZeroPool (sizeof (EFI_IPv6_ADDRESS));
if (Instance->Unicast == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- CopyMem (Instance->Unicast, Option + 4, sizeof(EFI_IPv6_ADDRESS));
+ CopyMem (Instance->Unicast, Option + 4, sizeof (EFI_IPv6_ADDRESS));
}
//
@@ -2401,7 +2373,6 @@ Dhcp6SelectAdvertiseMsg ( return Dhcp6SendRequestMsg (Instance);
}
-
/**
Handle with the Dhcp6 advertisement message.
@@ -2416,16 +2387,16 @@ Dhcp6SelectAdvertiseMsg ( **/
EFI_STATUS
Dhcp6HandleAdvertiseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 *Option;
- BOOLEAN Timeout;
+ EFI_STATUS Status;
+ UINT8 *Option;
+ BOOLEAN Timeout;
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
Timeout = FALSE;
@@ -2435,14 +2406,13 @@ Dhcp6HandleAdvertiseMsg ( // this reply message. Or else, process the advertise messages as normal.
// See details in the section-17.1.4 of rfc-3315.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - 4,
Dhcp6OptRapidCommit
);
- if (Option != NULL && Instance->Config->RapidCommit && Packet->Dhcp6.Header.MessageType == Dhcp6MsgReply) {
-
+ if ((Option != NULL) && Instance->Config->RapidCommit && (Packet->Dhcp6.Header.MessageType == Dhcp6MsgReply)) {
return Dhcp6HandleReplyMsg (Instance, Packet);
}
@@ -2490,12 +2460,11 @@ Dhcp6HandleAdvertiseMsg ( CopyMem (Instance->AdSelect, Packet, Packet->Size);
Instance->AdPref = 0xff;
-
} else if (Status == EFI_NOT_READY) {
//
// Not_ready means user wants to continue to receive more advertise packets.
//
- if (Instance->AdPref == 0xff && Instance->AdSelect == NULL) {
+ if ((Instance->AdPref == 0xff) && (Instance->AdSelect == NULL)) {
//
// It's a tricky point. The timer routine set adpref as 0xff if the first
// rt timeout and no advertisement received, which means any advertisement
@@ -2508,13 +2477,13 @@ Dhcp6HandleAdvertiseMsg ( // Check whether the current packet has a 255 preference option or not.
// Take non-preference option as 0 value.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - 4,
Dhcp6OptPreference
);
- if (Instance->AdSelect == NULL || (Option != NULL && *(Option + 4) > Instance->AdPref)) {
+ if ((Instance->AdSelect == NULL) || ((Option != NULL) && (*(Option + 4) > Instance->AdPref))) {
//
// No advertisements received before or preference is more than other
// advertisements received before. Then store the new packet and the
@@ -2541,7 +2510,6 @@ Dhcp6HandleAdvertiseMsg ( // preference is less than other advertisements received before.
// Leave the packet alone.
}
-
} else {
//
// Other error status means termination.
@@ -2554,14 +2522,13 @@ Dhcp6HandleAdvertiseMsg ( // RT has elapsed, or get a highest preference 255 advertise.
// See details in the section-17.1.2 of rfc-3315.
//
- if (Instance->AdPref == 0xff || Timeout) {
+ if ((Instance->AdPref == 0xff) || Timeout) {
Status = Dhcp6SelectAdvertiseMsg (Instance, Instance->AdSelect);
}
return Status;
}
-
/**
The Dhcp6 stateful exchange process routine.
@@ -2571,14 +2538,14 @@ Dhcp6HandleAdvertiseMsg ( **/
VOID
Dhcp6HandleStateful (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- EFI_DHCP6_DUID *ClientId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
+ EFI_STATUS Status;
+ EFI_DHCP6_DUID *ClientId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
Service = Instance->Service;
ClientId = Service->ClientId;
@@ -2595,27 +2562,27 @@ Dhcp6HandleStateful ( //
// Discard the packet if not advertisement or reply packet.
//
- if (Packet->Dhcp6.Header.MessageType != Dhcp6MsgAdvertise && Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply) {
+ if ((Packet->Dhcp6.Header.MessageType != Dhcp6MsgAdvertise) && (Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply)) {
goto ON_CONTINUE;
}
//
// Check whether include client Id or not.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - 4,
Dhcp6OptClientId
);
- if (Option == NULL || CompareMem (Option + 4, ClientId->Duid, ClientId->Length) != 0) {
+ if ((Option == NULL) || (CompareMem (Option + 4, ClientId->Duid, ClientId->Length) != 0)) {
goto ON_CONTINUE;
}
//
// Check whether include server Id or not.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - 4,
Dhcp6OptServerId
@@ -2626,35 +2593,36 @@ Dhcp6HandleStateful ( }
switch (Instance->IaCb.Ia->State) {
- case Dhcp6Selecting:
- //
- // Handle the advertisement message when in the Dhcp6Selecting state.
- // Do not need check return status, if failed, just continue to the next.
- //
- Dhcp6HandleAdvertiseMsg (Instance, Packet);
- break;
-
- case Dhcp6Requesting:
- case Dhcp6Confirming:
- case Dhcp6Renewing:
- case Dhcp6Rebinding:
- case Dhcp6Releasing:
- case Dhcp6Declining:
- //
- // Handle the reply message when in the Dhcp6Requesting, Dhcp6Renewing
- // Dhcp6Rebinding, Dhcp6Releasing and Dhcp6Declining state.
- // If failed here, it should reset the current session.
- //
- Status = Dhcp6HandleReplyMsg (Instance, Packet);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
- break;
- default:
- //
- // Other state has not supported yet.
- //
- break;
+ case Dhcp6Selecting:
+ //
+ // Handle the advertisement message when in the Dhcp6Selecting state.
+ // Do not need check return status, if failed, just continue to the next.
+ //
+ Dhcp6HandleAdvertiseMsg (Instance, Packet);
+ break;
+
+ case Dhcp6Requesting:
+ case Dhcp6Confirming:
+ case Dhcp6Renewing:
+ case Dhcp6Rebinding:
+ case Dhcp6Releasing:
+ case Dhcp6Declining:
+ //
+ // Handle the reply message when in the Dhcp6Requesting, Dhcp6Renewing
+ // Dhcp6Rebinding, Dhcp6Releasing and Dhcp6Declining state.
+ // If failed here, it should reset the current session.
+ //
+ Status = Dhcp6HandleReplyMsg (Instance, Packet);
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+
+ break;
+ default:
+ //
+ // Other state has not supported yet.
+ //
+ break;
}
ON_CONTINUE:
@@ -2673,7 +2641,6 @@ ON_EXIT: }
}
-
/**
The Dhcp6 stateless exchange process routine.
@@ -2683,15 +2650,15 @@ ON_EXIT: **/
VOID
Dhcp6HandleStateless (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- DHCP6_SERVICE *Service;
- DHCP6_INF_CB *InfCb;
- UINT8 *Option;
- BOOLEAN IsMatched;
+ EFI_STATUS Status;
+ DHCP6_SERVICE *Service;
+ DHCP6_INF_CB *InfCb;
+ UINT8 *Option;
+ BOOLEAN IsMatched;
Service = Instance->Service;
Status = EFI_SUCCESS;
@@ -2776,7 +2743,6 @@ ON_EXIT: }
}
-
/**
The receive callback function for Dhcp6 exchange process.
@@ -2789,37 +2755,37 @@ ON_EXIT: VOID
EFIAPI
Dhcp6ReceivePacket (
- IN NET_BUF *Udp6Wrap,
- IN UDP_END_POINT *EndPoint,
- IN EFI_STATUS IoStatus,
- IN VOID *Context
+ IN NET_BUF *Udp6Wrap,
+ IN UDP_END_POINT *EndPoint,
+ IN EFI_STATUS IoStatus,
+ IN VOID *Context
)
{
- EFI_DHCP6_HEADER *Head;
- EFI_DHCP6_PACKET *Packet;
- DHCP6_SERVICE *Service;
- DHCP6_INSTANCE *Instance;
- DHCP6_TX_CB *TxCb;
- UINT32 Size;
- BOOLEAN IsDispatched;
- BOOLEAN IsStateless;
- LIST_ENTRY *Entry1;
- LIST_ENTRY *Next1;
- LIST_ENTRY *Entry2;
- LIST_ENTRY *Next2;
- EFI_STATUS Status;
+ EFI_DHCP6_HEADER *Head;
+ EFI_DHCP6_PACKET *Packet;
+ DHCP6_SERVICE *Service;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_TX_CB *TxCb;
+ UINT32 Size;
+ BOOLEAN IsDispatched;
+ BOOLEAN IsStateless;
+ LIST_ENTRY *Entry1;
+ LIST_ENTRY *Next1;
+ LIST_ENTRY *Entry2;
+ LIST_ENTRY *Next2;
+ EFI_STATUS Status;
ASSERT (Udp6Wrap != NULL);
ASSERT (Context != NULL);
- Service = (DHCP6_SERVICE *) Context;
+ Service = (DHCP6_SERVICE *)Context;
Instance = NULL;
Packet = NULL;
IsDispatched = FALSE;
IsStateless = FALSE;
if (EFI_ERROR (IoStatus)) {
- return ;
+ return;
}
if (Udp6Wrap->TotalSize < sizeof (EFI_DHCP6_HEADER)) {
@@ -2830,7 +2796,7 @@ Dhcp6ReceivePacket ( // Copy the net buffer received from upd6 to a Dhcp6 packet.
//
Size = sizeof (EFI_DHCP6_PACKET) + Udp6Wrap->TotalSize;
- Packet = (EFI_DHCP6_PACKET *) AllocateZeroPool (Size);
+ Packet = (EFI_DHCP6_PACKET *)AllocateZeroPool (Size);
if (Packet == NULL) {
goto ON_CONTINUE;
@@ -2838,7 +2804,7 @@ Dhcp6ReceivePacket ( Packet->Size = Size;
Head = &Packet->Dhcp6.Header;
- Packet->Length = NetbufCopy (Udp6Wrap, 0, Udp6Wrap->TotalSize, (UINT8 *) Head);
+ Packet->Length = NetbufCopy (Udp6Wrap, 0, Udp6Wrap->TotalSize, (UINT8 *)Head);
if (Packet->Length == 0) {
goto ON_CONTINUE;
@@ -2848,11 +2814,9 @@ Dhcp6ReceivePacket ( // Dispatch packet to right instance by transaction id.
//
NET_LIST_FOR_EACH_SAFE (Entry1, Next1, &Service->Child) {
-
Instance = NET_LIST_USER_STRUCT (Entry1, DHCP6_INSTANCE, Link);
NET_LIST_FOR_EACH_SAFE (Entry2, Next2, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry2, DHCP6_TX_CB, Link);
if (Packet->Dhcp6.Header.TransactionId == TxCb->Xid) {
@@ -2863,7 +2827,8 @@ Dhcp6ReceivePacket ( if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
IsStateless = TRUE;
}
- IsDispatched = TRUE;
+
+ IsDispatched = TRUE;
break;
}
}
@@ -2893,11 +2858,11 @@ ON_CONTINUE: if (!IsDispatched) {
Status = UdpIoRecvDatagram (
- Service->UdpIo,
- Dhcp6ReceivePacket,
- Service,
- 0
- );
+ Service->UdpIo,
+ Dhcp6ReceivePacket,
+ Service,
+ 0
+ );
if (EFI_ERROR (Status)) {
NET_LIST_FOR_EACH_SAFE (Entry1, Next1, &Service->Child) {
Instance = NET_LIST_USER_STRUCT (Entry1, DHCP6_INSTANCE, Link);
@@ -2929,7 +2894,7 @@ ON_CONTINUE: **/
BOOLEAN
Dhcp6LinkMovDetect (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
UINT32 InterruptStatus;
@@ -2938,7 +2903,7 @@ Dhcp6LinkMovDetect ( EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
ASSERT (Instance != NULL);
- Snp = Instance->Service->Snp;
+ Snp = Instance->Service->Snp;
MediaPresent = Instance->MediaPresent;
//
@@ -2963,10 +2928,10 @@ Dhcp6LinkMovDetect ( if (!MediaPresent && Instance->MediaPresent) {
return TRUE;
}
+
return FALSE;
}
-
/**
The timer routine of the Dhcp6 instance for each second.
@@ -2977,28 +2942,27 @@ Dhcp6LinkMovDetect ( VOID
EFIAPI
Dhcp6OnTimerTick (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- DHCP6_INSTANCE *Instance;
- DHCP6_TX_CB *TxCb;
- DHCP6_IA_CB *IaCb;
- UINT32 LossTime;
- EFI_STATUS Status;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_IA_CB *IaCb;
+ UINT32 LossTime;
+ EFI_STATUS Status;
ASSERT (Context != NULL);
- Instance = (DHCP6_INSTANCE *) Context;
+ Instance = (DHCP6_INSTANCE *)Context;
//
// 1. Loop the tx list, count live time of every tx packet to check whether
// need re-transmit or not.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
TxCb->TickTime++;
@@ -3007,7 +2971,7 @@ Dhcp6OnTimerTick ( //
// Handle the first rt in the transmission of solicit specially.
//
- if ((TxCb->RetryCnt == 0 || TxCb->SolicitRetry) && TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgSolicit) {
+ if (((TxCb->RetryCnt == 0) || TxCb->SolicitRetry) && (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgSolicit)) {
if (Instance->AdSelect == NULL) {
//
// Set adpref as 0xff here to indicate select any advertisement
@@ -3024,9 +2988,11 @@ Dhcp6OnTimerTick ( } else if (EFI_ERROR (Status)) {
TxCb->RetryCnt++;
}
+
return;
}
}
+
//
// Increase the retry count for the packet and add up the total loss time.
//
@@ -3036,7 +3002,7 @@ Dhcp6OnTimerTick ( //
// Check whether overflow the max retry count limit for this packet
//
- if (TxCb->RetryCtl.Mrc != 0 && TxCb->RetryCtl.Mrc < TxCb->RetryCnt) {
+ if ((TxCb->RetryCtl.Mrc != 0) && (TxCb->RetryCtl.Mrc < TxCb->RetryCnt)) {
Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3044,7 +3010,7 @@ Dhcp6OnTimerTick ( //
// Check whether overflow the max retry duration for this packet
//
- if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd <= TxCb->RetryLos) {
+ if ((TxCb->RetryCtl.Mrd != 0) && (TxCb->RetryCtl.Mrd <= TxCb->RetryLos)) {
Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3061,7 +3027,7 @@ Dhcp6OnTimerTick ( TRUE
);
- if (TxCb->RetryCtl.Mrt != 0 && TxCb->RetryCtl.Mrt < TxCb->RetryExp) {
+ if ((TxCb->RetryCtl.Mrt != 0) && (TxCb->RetryCtl.Mrt < TxCb->RetryExp)) {
TxCb->RetryExp = Dhcp6CalculateExpireTime (
TxCb->RetryCtl.Mrt,
TRUE,
@@ -3074,7 +3040,7 @@ Dhcp6OnTimerTick ( // duration time.
//
LossTime = TxCb->RetryLos + TxCb->RetryExp;
- if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd < LossTime) {
+ if ((TxCb->RetryCtl.Mrd != 0) && (TxCb->RetryCtl.Mrd < LossTime)) {
TxCb->RetryExp = TxCb->RetryCtl.Mrd - TxCb->RetryLos;
}
@@ -3100,22 +3066,19 @@ Dhcp6OnTimerTick ( //
IaCb = &Instance->IaCb;
- if (Instance->Config == NULL || IaCb->Ia == NULL) {
+ if ((Instance->Config == NULL) || (IaCb->Ia == NULL)) {
return;
}
- if (IaCb->Ia->State == Dhcp6Bound || IaCb->Ia->State == Dhcp6Renewing || IaCb->Ia->State == Dhcp6Rebinding) {
-
+ if ((IaCb->Ia->State == Dhcp6Bound) || (IaCb->Ia->State == Dhcp6Renewing) || (IaCb->Ia->State == Dhcp6Rebinding)) {
IaCb->LeaseTime++;
- if (IaCb->LeaseTime > IaCb->T2 && IaCb->Ia->State == Dhcp6Bound) {
+ if ((IaCb->LeaseTime > IaCb->T2) && (IaCb->Ia->State == Dhcp6Bound)) {
//
// Exceed t2, send rebind packet to extend the Ia lease.
//
Dhcp6SendRenewRebindMsg (Instance, TRUE);
-
- } else if (IaCb->LeaseTime > IaCb->T1 && IaCb->Ia->State == Dhcp6Bound) {
-
+ } else if ((IaCb->LeaseTime > IaCb->T1) && (IaCb->Ia->State == Dhcp6Bound)) {
//
// Exceed t1, send renew packet to extend the Ia lease.
//
@@ -3133,28 +3096,32 @@ Dhcp6OnTimerTick ( return;
- ON_CLOSE:
+ON_CLOSE:
if (Dhcp6IsValidTxCb (Instance, TxCb) &&
- TxCb->TxPacket != NULL &&
- (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
- TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew ||
- TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)
- ) {
+ (TxCb->TxPacket != NULL) &&
+ ((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) ||
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm))
+ )
+ {
//
// The failure of renew/Confirm will still switch to the bound state.
//
if ((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
- (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)) {
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm))
+ {
ASSERT (Instance->IaCb.Ia);
Instance->IaCb.Ia->State = Dhcp6Bound;
}
+
//
// The failure of info-request will return no response.
//
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
Instance->UdpSts = EFI_NO_RESPONSE;
}
+
Dhcp6DequeueRetry (
Instance,
TxCb->Xid,
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h index 554f0f5e5d..051a652f2b 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h @@ -10,7 +10,6 @@ #ifndef __EFI_DHCP6_IO_H__
#define __EFI_DHCP6_IO_H__
-
/**
Clean up the specific nodes in the retry list.
@@ -20,8 +19,8 @@ **/
VOID
Dhcp6CleanupRetry (
- IN DHCP6_INSTANCE *Instance,
- IN UINT32 Scope
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT32 Scope
);
/**
@@ -33,8 +32,8 @@ Dhcp6CleanupRetry ( **/
VOID
Dhcp6CleanupSession (
- IN OUT DHCP6_INSTANCE *Instance,
- IN EFI_STATUS Status
+ IN OUT DHCP6_INSTANCE *Instance,
+ IN EFI_STATUS Status
);
/**
@@ -49,7 +48,7 @@ Dhcp6CleanupSession ( **/
EFI_STATUS
Dhcp6SendSolicitMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -65,7 +64,7 @@ Dhcp6SendSolicitMsg ( **/
EFI_STATUS
Dhcp6SendRequestMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -83,8 +82,8 @@ Dhcp6SendRequestMsg ( **/
EFI_STATUS
Dhcp6SendRenewRebindMsg (
- IN DHCP6_INSTANCE *Instance,
- IN BOOLEAN RebindRequest
+ IN DHCP6_INSTANCE *Instance,
+ IN BOOLEAN RebindRequest
);
/**
@@ -101,8 +100,8 @@ Dhcp6SendRenewRebindMsg ( **/
EFI_STATUS
Dhcp6SendDeclineMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *DecIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *DecIa
);
/**
@@ -119,8 +118,8 @@ Dhcp6SendDeclineMsg ( **/
EFI_STATUS
Dhcp6SendReleaseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *RelIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *RelIa
);
/**
@@ -198,10 +197,10 @@ Dhcp6SendInfoRequestMsg ( VOID
EFIAPI
Dhcp6ReceivePacket (
- IN NET_BUF *Udp6Wrap,
- IN UDP_END_POINT *EndPoint,
- IN EFI_STATUS IoStatus,
- IN VOID *Context
+ IN NET_BUF *Udp6Wrap,
+ IN UDP_END_POINT *EndPoint,
+ IN EFI_STATUS IoStatus,
+ IN VOID *Context
);
/**
@@ -214,8 +213,8 @@ Dhcp6ReceivePacket ( VOID
EFIAPI
Dhcp6OnTimerTick (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
);
#endif
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c index d249a1cca7..e6368b5b1c 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c @@ -10,7 +10,6 @@ #include "Dhcp6Impl.h"
-
/**
Generate client Duid in the format of Duid-llt.
@@ -22,21 +21,20 @@ **/
EFI_DHCP6_DUID *
Dhcp6GenerateClientId (
- IN EFI_SIMPLE_NETWORK_MODE *Mode
+ IN EFI_SIMPLE_NETWORK_MODE *Mode
)
{
- EFI_STATUS Status;
- EFI_DHCP6_DUID *Duid;
- EFI_TIME Time;
- UINT32 Stamp;
- EFI_GUID Uuid;
-
+ EFI_STATUS Status;
+ EFI_DHCP6_DUID *Duid;
+ EFI_TIME Time;
+ UINT32 Stamp;
+ EFI_GUID Uuid;
//
// Attempt to get client Id from variable to keep it constant.
// See details in section-9 of rfc-3315.
//
- GetVariable2 (L"ClientId", &gEfiDhcp6ServiceBindingProtocolGuid, (VOID**)&Duid, NULL);
+ GetVariable2 (L"ClientId", &gEfiDhcp6ServiceBindingProtocolGuid, (VOID **)&Duid, NULL);
if (Duid != NULL) {
return Duid;
}
@@ -84,17 +82,15 @@ Dhcp6GenerateClientId ( //
// sizeof (Duid-type + UUID-size) = 18 bytes
//
- Duid->Length = (UINT16) (18);
+ Duid->Length = (UINT16)(18);
//
// Set the Duid-type and copy UUID.
//
- WriteUnaligned16 ((UINT16 *) (Duid->Duid), HTONS (Dhcp6DuidTypeUuid));
-
- CopyMem (Duid->Duid + 2, &Uuid, sizeof(EFI_GUID));
+ WriteUnaligned16 ((UINT16 *)(Duid->Duid), HTONS (Dhcp6DuidTypeUuid));
+ CopyMem (Duid->Duid + 2, &Uuid, sizeof (EFI_GUID));
} else {
-
//
//
// The format of DUID-LLT:
@@ -116,11 +112,11 @@ Dhcp6GenerateClientId ( //
gRT->GetTime (&Time, NULL);
Stamp = (UINT32)
- (
- ((((UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *
- 60 +
- Time.Second
- );
+ (
+ ((((UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *
+ 60 +
+ Time.Second
+ );
//
// sizeof (option-len + Duid-type + hardware-type + time) = 10 bytes
@@ -133,14 +129,14 @@ Dhcp6GenerateClientId ( //
// sizeof (Duid-type + hardware-type + time) = 8 bytes
//
- Duid->Length = (UINT16) (Mode->HwAddressSize + 8);
+ Duid->Length = (UINT16)(Mode->HwAddressSize + 8);
//
// Set the Duid-type, hardware-type, time and copy the hardware address.
//
- WriteUnaligned16 ((UINT16 *) ((UINT8 *) Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid)), HTONS (Dhcp6DuidTypeLlt));
- WriteUnaligned16 ((UINT16 *) ((UINT8 *) Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 2), HTONS (NET_IFTYPE_ETHERNET));
- WriteUnaligned32 ((UINT32 *) ((UINT8 *) Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 4), HTONL (Stamp));
+ WriteUnaligned16 ((UINT16 *)((UINT8 *)Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid)), HTONS (Dhcp6DuidTypeLlt));
+ WriteUnaligned16 ((UINT16 *)((UINT8 *)Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 2), HTONS (NET_IFTYPE_ETHERNET));
+ WriteUnaligned32 ((UINT32 *)((UINT8 *)Duid + OFFSET_OF (EFI_DHCP6_DUID, Duid) + 4), HTONL (Stamp));
CopyMem (Duid->Duid + 8, &Mode->CurrentAddress, Mode->HwAddressSize);
}
@@ -150,7 +146,7 @@ Dhcp6GenerateClientId ( &gEfiDhcp6ServiceBindingProtocolGuid,
(EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS),
Duid->Length + 2,
- (VOID *) Duid
+ (VOID *)Duid
);
if (EFI_ERROR (Status)) {
FreePool (Duid);
@@ -160,7 +156,6 @@ Dhcp6GenerateClientId ( return Duid;
}
-
/**
Copy the Dhcp6 configure data.
@@ -173,13 +168,13 @@ Dhcp6GenerateClientId ( **/
EFI_STATUS
Dhcp6CopyConfigData (
- IN EFI_DHCP6_CONFIG_DATA *DstCfg,
- IN EFI_DHCP6_CONFIG_DATA *SorCfg
+ IN EFI_DHCP6_CONFIG_DATA *DstCfg,
+ IN EFI_DHCP6_CONFIG_DATA *SorCfg
)
{
- UINTN Index;
- UINTN OptionListSize;
- UINTN OptionSize;
+ UINTN Index;
+ UINTN OptionListSize;
+ UINTN OptionSize;
CopyMem (DstCfg, SorCfg, sizeof (EFI_DHCP6_CONFIG_DATA));
@@ -187,7 +182,6 @@ Dhcp6CopyConfigData ( // Allocate another buffer for solicitretransmission, and copy it.
//
if (SorCfg->SolicitRetransmission != NULL) {
-
DstCfg->SolicitRetransmission = AllocateZeroPool (sizeof (EFI_DHCP6_RETRANSMISSION));
if (DstCfg->SolicitRetransmission == NULL) {
@@ -204,8 +198,7 @@ Dhcp6CopyConfigData ( );
}
- if (SorCfg->OptionList != NULL && SorCfg->OptionCount != 0) {
-
+ if ((SorCfg->OptionList != NULL) && (SorCfg->OptionCount != 0)) {
OptionListSize = SorCfg->OptionCount * sizeof (EFI_DHCP6_PACKET_OPTION *);
DstCfg->OptionList = AllocateZeroPool (OptionListSize);
@@ -217,7 +210,6 @@ Dhcp6CopyConfigData ( }
for (Index = 0; Index < SorCfg->OptionCount; Index++) {
-
OptionSize = NTOHS (SorCfg->OptionList[Index]->OpLen) + 4;
DstCfg->OptionList[Index] = AllocateZeroPool (OptionSize);
@@ -239,7 +231,6 @@ Dhcp6CopyConfigData ( return EFI_SUCCESS;
}
-
/**
Clean up the configure data.
@@ -248,10 +239,10 @@ Dhcp6CopyConfigData ( **/
VOID
Dhcp6CleanupConfigData (
- IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
+ IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
)
{
- UINTN Index;
+ UINTN Index;
ASSERT (CfgData != NULL);
//
@@ -264,6 +255,7 @@ Dhcp6CleanupConfigData ( FreePool (CfgData->OptionList[Index]);
}
}
+
FreePool (CfgData->OptionList);
}
@@ -274,7 +266,6 @@ Dhcp6CleanupConfigData ( ZeroMem (CfgData, sizeof (EFI_DHCP6_CONFIG_DATA));
}
-
/**
Clean up the mode data.
@@ -283,7 +274,7 @@ Dhcp6CleanupConfigData ( **/
VOID
Dhcp6CleanupModeData (
- IN OUT EFI_DHCP6_MODE_DATA *ModeData
+ IN OUT EFI_DHCP6_MODE_DATA *ModeData
)
{
ASSERT (ModeData != NULL);
@@ -296,17 +287,16 @@ Dhcp6CleanupModeData ( }
if (ModeData->Ia != NULL) {
-
if (ModeData->Ia->ReplyPacket != NULL) {
FreePool (ModeData->Ia->ReplyPacket);
}
+
FreePool (ModeData->Ia);
}
ZeroMem (ModeData, sizeof (EFI_DHCP6_MODE_DATA));
}
-
/**
Calculate the expire time by the algorithm defined in rfc.
@@ -319,15 +309,15 @@ Dhcp6CleanupModeData ( **/
UINT32
Dhcp6CalculateExpireTime (
- IN UINT32 Base,
- IN BOOLEAN IsFirstRt,
- IN BOOLEAN NeedSigned
+ IN UINT32 Base,
+ IN BOOLEAN IsFirstRt,
+ IN BOOLEAN NeedSigned
)
{
- EFI_TIME Time;
- BOOLEAN Signed;
- UINT32 Seed;
- UINT32 Expire;
+ EFI_TIME Time;
+ BOOLEAN Signed;
+ UINT32 Seed;
+ UINT32 Expire;
//
// Take the 10bits of microsecond in system time as a uniform distribution.
@@ -335,8 +325,8 @@ Dhcp6CalculateExpireTime ( //
gRT->GetTime (&Time, NULL);
Seed = ((Time.Nanosecond >> 10) & DHCP6_10_BIT_MASK);
- Signed = (BOOLEAN) ((((Time.Nanosecond >> 9) & 0x01) != 0) ? TRUE : FALSE);
- Signed = (BOOLEAN) (NeedSigned ? Signed : FALSE);
+ Signed = (BOOLEAN)((((Time.Nanosecond >> 9) & 0x01) != 0) ? TRUE : FALSE);
+ Signed = (BOOLEAN)(NeedSigned ? Signed : FALSE);
//
// Calculate expire by the following algo:
@@ -348,20 +338,13 @@ Dhcp6CalculateExpireTime ( // The (Seed / 0x3ff / 10) is used to a random range (0, 0.1).
//
if (IsFirstRt && Signed) {
-
- Expire = Base - (UINT32) (Base * Seed / DHCP6_10_BIT_MASK / 10);
-
+ Expire = Base - (UINT32)(Base * Seed / DHCP6_10_BIT_MASK / 10);
} else if (IsFirstRt && !Signed) {
-
- Expire = Base + (UINT32) (Base * Seed / DHCP6_10_BIT_MASK / 10);
-
+ Expire = Base + (UINT32)(Base * Seed / DHCP6_10_BIT_MASK / 10);
} else if (!IsFirstRt && Signed) {
-
- Expire = 2 * Base - (UINT32) (Base * Seed / DHCP6_10_BIT_MASK / 10);
-
+ Expire = 2 * Base - (UINT32)(Base * Seed / DHCP6_10_BIT_MASK / 10);
} else {
-
- Expire = 2 * Base + (UINT32) (Base * Seed / DHCP6_10_BIT_MASK / 10);
+ Expire = 2 * Base + (UINT32)(Base * Seed / DHCP6_10_BIT_MASK / 10);
}
Expire = (Expire != 0) ? Expire : 1;
@@ -369,7 +352,6 @@ Dhcp6CalculateExpireTime ( return Expire;
}
-
/**
Calculate the lease time by the algorithm defined in rfc.
@@ -378,25 +360,25 @@ Dhcp6CalculateExpireTime ( **/
VOID
Dhcp6CalculateLeaseTime (
- IN DHCP6_IA_CB *IaCb
+ IN DHCP6_IA_CB *IaCb
)
{
- UINT32 MinLt;
- UINT32 MaxLt;
- UINTN Index;
+ UINT32 MinLt;
+ UINT32 MaxLt;
+ UINTN Index;
ASSERT (IaCb->Ia->IaAddressCount > 0);
- MinLt = (UINT32) (-1);
- MaxLt = 0;
+ MinLt = (UINT32)(-1);
+ MaxLt = 0;
//
// Calculate minlt as min of all valid life time, and maxlt as max of all
// valid life time.
//
for (Index = 0; Index < IaCb->Ia->IaAddressCount; Index++) {
- MinLt = MIN (MinLt, IaCb->Ia->IaAddress[Index].ValidLifetime);
- MaxLt = MAX (MinLt, IaCb->Ia->IaAddress[Index].ValidLifetime);
+ MinLt = MIN (MinLt, IaCb->Ia->IaAddress[Index].ValidLifetime);
+ MaxLt = MAX (MinLt, IaCb->Ia->IaAddress[Index].ValidLifetime);
}
//
@@ -409,7 +391,6 @@ Dhcp6CalculateLeaseTime ( IaCb->LeaseTime = 0;
}
-
/**
Check whether the addresses are all included by the configured Ia.
@@ -423,31 +404,29 @@ Dhcp6CalculateLeaseTime ( **/
EFI_STATUS
Dhcp6CheckAddress (
- IN EFI_DHCP6_IA *Ia,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_IA *Ia,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
)
{
- UINTN Index1;
- UINTN Index2;
- BOOLEAN Found;
+ UINTN Index1;
+ UINTN Index2;
+ BOOLEAN Found;
//
// Check whether the addresses are all included by the configured IA. And it
// will return success if address count is zero, which means all addresses.
//
for (Index1 = 0; Index1 < AddressCount; Index1++) {
-
Found = FALSE;
for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) {
-
if (CompareMem (
&Addresses[Index1],
&Ia->IaAddress[Index2],
sizeof (EFI_IPv6_ADDRESS)
- ) == 0) {
-
+ ) == 0)
+ {
Found = TRUE;
break;
}
@@ -461,7 +440,6 @@ Dhcp6CheckAddress ( return EFI_SUCCESS;
}
-
/**
Deprive the addresses from current Ia, and generate another eliminated Ia.
@@ -475,16 +453,16 @@ Dhcp6CheckAddress ( **/
EFI_DHCP6_IA *
Dhcp6DepriveAddress (
- IN EFI_DHCP6_IA *Ia,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_IA *Ia,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
)
{
- EFI_DHCP6_IA *IaCopy;
- UINTN IaCopySize;
- UINTN Index1;
- UINTN Index2;
- BOOLEAN Found;
+ EFI_DHCP6_IA *IaCopy;
+ UINTN IaCopySize;
+ UINTN Index1;
+ UINTN Index2;
+ BOOLEAN Found;
if (AddressCount == 0) {
//
@@ -521,16 +499,15 @@ Dhcp6DepriveAddress ( // Move the addresses from the Ia of instance to the deprived Ia.
//
for (Index1 = 0; Index1 < AddressCount; Index1++) {
-
Found = FALSE;
for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) {
-
if (CompareMem (
&Addresses[Index1],
&Ia->IaAddress[Index2],
sizeof (EFI_IPv6_ADDRESS)
- ) == 0) {
+ ) == 0)
+ {
//
// Copy the deprived address to the copy of Ia
//
@@ -549,10 +526,12 @@ Dhcp6DepriveAddress ( (Ia->IaAddressCount - Index2 - 1) * sizeof (EFI_DHCP6_IA_ADDRESS)
);
}
+
Found = TRUE;
break;
}
}
+
ASSERT (Found == TRUE);
}
@@ -562,7 +541,6 @@ Dhcp6DepriveAddress ( return IaCopy;
}
-
/**
The dummy ext buffer free callback routine.
@@ -572,12 +550,11 @@ Dhcp6DepriveAddress ( VOID
EFIAPI
Dhcp6DummyExtFree (
- IN VOID *Arg
+ IN VOID *Arg
)
{
}
-
/**
The callback routine once message transmitted.
@@ -590,16 +567,15 @@ Dhcp6DummyExtFree ( VOID
EFIAPI
Dhcp6OnTransmitted (
- IN NET_BUF *Wrap,
- IN UDP_END_POINT *EndPoint,
- IN EFI_STATUS IoStatus,
- IN VOID *Context
+ IN NET_BUF *Wrap,
+ IN UDP_END_POINT *EndPoint,
+ IN EFI_STATUS IoStatus,
+ IN VOID *Context
)
{
NetbufFree (Wrap);
}
-
/**
Append the option to Buf, and move Buf to the end.
@@ -613,10 +589,10 @@ Dhcp6OnTransmitted ( **/
UINT8 *
Dhcp6AppendOption (
- IN OUT UINT8 *Buf,
- IN UINT16 OptType,
- IN UINT16 OptLen,
- IN UINT8 *Data
+ IN OUT UINT8 *Buf,
+ IN UINT16 OptType,
+ IN UINT16 OptLen,
+ IN UINT8 *Data
)
{
//
@@ -633,12 +609,12 @@ Dhcp6AppendOption ( ASSERT (OptLen != 0);
- WriteUnaligned16 ((UINT16 *) Buf, OptType);
- Buf += 2;
- WriteUnaligned16 ((UINT16 *) Buf, OptLen);
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, OptType);
+ Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, OptLen);
+ Buf += 2;
CopyMem (Buf, Data, NTOHS (OptLen));
- Buf += NTOHS (OptLen);
+ Buf += NTOHS (OptLen);
return Buf;
}
@@ -655,12 +631,11 @@ Dhcp6AppendOption ( **/
UINT8 *
Dhcp6AppendIaAddrOption (
- IN OUT UINT8 *Buf,
- IN EFI_DHCP6_IA_ADDRESS *IaAddr,
- IN UINT32 MessageType
-)
+ IN OUT UINT8 *Buf,
+ IN EFI_DHCP6_IA_ADDRESS *IaAddr,
+ IN UINT32 MessageType
+ )
{
-
// The format of the IA Address option is:
//
// 0 1 2 3
@@ -685,14 +660,14 @@ Dhcp6AppendIaAddrOption ( //
// Fill the value of Ia Address option type
//
- WriteUnaligned16 ((UINT16 *) Buf, HTONS (Dhcp6OptIaAddr));
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, HTONS (Dhcp6OptIaAddr));
+ Buf += 2;
- WriteUnaligned16 ((UINT16 *) Buf, HTONS (sizeof (EFI_DHCP6_IA_ADDRESS)));
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, HTONS (sizeof (EFI_DHCP6_IA_ADDRESS)));
+ Buf += 2;
- CopyMem (Buf, &IaAddr->IpAddress, sizeof(EFI_IPv6_ADDRESS));
- Buf += sizeof(EFI_IPv6_ADDRESS);
+ CopyMem (Buf, &IaAddr->IpAddress, sizeof (EFI_IPv6_ADDRESS));
+ Buf += sizeof (EFI_IPv6_ADDRESS);
//
// Fill the value of preferred-lifetime and valid-lifetime.
@@ -700,19 +675,20 @@ Dhcp6AppendIaAddrOption ( // should set to 0 when initiate a Confirm message.
//
if (MessageType != Dhcp6MsgConfirm) {
- WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->PreferredLifetime));
+ WriteUnaligned32 ((UINT32 *)Buf, HTONL (IaAddr->PreferredLifetime));
}
- Buf += 4;
+
+ Buf += 4;
if (MessageType != Dhcp6MsgConfirm) {
- WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->ValidLifetime));
+ WriteUnaligned32 ((UINT32 *)Buf, HTONL (IaAddr->ValidLifetime));
}
- Buf += 4;
+
+ Buf += 4;
return Buf;
}
-
/**
Append the appointed Ia option to Buf, and move Buf to the end.
@@ -727,16 +703,16 @@ Dhcp6AppendIaAddrOption ( **/
UINT8 *
Dhcp6AppendIaOption (
- IN OUT UINT8 *Buf,
- IN EFI_DHCP6_IA *Ia,
- IN UINT32 T1,
- IN UINT32 T2,
- IN UINT32 MessageType
+ IN OUT UINT8 *Buf,
+ IN EFI_DHCP6_IA *Ia,
+ IN UINT32 T1,
+ IN UINT32 T2,
+ IN UINT32 MessageType
)
{
- UINT8 *AddrOpt;
- UINT16 *Len;
- UINTN Index;
+ UINT8 *AddrOpt;
+ UINT16 *Len;
+ UINTN Index;
//
// The format of IA_NA and IA_TA option:
@@ -760,43 +736,43 @@ Dhcp6AppendIaOption ( //
// Fill the value of Ia option type
//
- WriteUnaligned16 ((UINT16 *) Buf, HTONS (Ia->Descriptor.Type));
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, HTONS (Ia->Descriptor.Type));
+ Buf += 2;
//
// Fill the len of Ia option later, keep the pointer first
//
- Len = (UINT16 *) Buf;
- Buf += 2;
+ Len = (UINT16 *)Buf;
+ Buf += 2;
//
// Fill the value of iaid
//
- WriteUnaligned32 ((UINT32 *) Buf, HTONL (Ia->Descriptor.IaId));
- Buf += 4;
+ WriteUnaligned32 ((UINT32 *)Buf, HTONL (Ia->Descriptor.IaId));
+ Buf += 4;
//
// Fill the value of t1 and t2 if iana, keep it 0xffffffff if no specified.
//
if (Ia->Descriptor.Type == Dhcp6OptIana) {
- WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T1 != 0) ? T1 : 0xffffffff));
- Buf += 4;
- WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T2 != 0) ? T2 : 0xffffffff));
- Buf += 4;
+ WriteUnaligned32 ((UINT32 *)Buf, HTONL ((T1 != 0) ? T1 : 0xffffffff));
+ Buf += 4;
+ WriteUnaligned32 ((UINT32 *)Buf, HTONL ((T2 != 0) ? T2 : 0xffffffff));
+ Buf += 4;
}
//
// Fill all the addresses belong to the Ia
//
for (Index = 0; Index < Ia->IaAddressCount; Index++) {
- AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS);
- Buf = Dhcp6AppendIaAddrOption (Buf, (EFI_DHCP6_IA_ADDRESS *) AddrOpt, MessageType);
+ AddrOpt = (UINT8 *)Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS);
+ Buf = Dhcp6AppendIaAddrOption (Buf, (EFI_DHCP6_IA_ADDRESS *)AddrOpt, MessageType);
}
//
// Fill the value of Ia option length
//
- *Len = HTONS ((UINT16) (Buf - (UINT8 *) Len - 2));
+ *Len = HTONS ((UINT16)(Buf - (UINT8 *)Len - 2));
return Buf;
}
@@ -814,9 +790,9 @@ Dhcp6AppendIaOption ( **/
UINT8 *
Dhcp6AppendETOption (
- IN OUT UINT8 *Buf,
- IN DHCP6_INSTANCE *Instance,
- OUT UINT16 **Elapsed
+ IN OUT UINT8 *Buf,
+ IN DHCP6_INSTANCE *Instance,
+ OUT UINT16 **Elapsed
)
{
//
@@ -833,22 +809,22 @@ Dhcp6AppendETOption ( //
// Fill the value of elapsed-time option type.
//
- WriteUnaligned16 ((UINT16 *) Buf, HTONS (Dhcp6OptElapsedTime));
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, HTONS (Dhcp6OptElapsedTime));
+ Buf += 2;
//
// Fill the len of elapsed-time option, which is fixed.
//
- WriteUnaligned16 ((UINT16 *) Buf, HTONS(2));
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, HTONS (2));
+ Buf += 2;
//
// Fill in elapsed time value with 0 value for now. The actual value is
// filled in later just before the packet is transmitted.
//
- WriteUnaligned16 ((UINT16 *) Buf, HTONS(0));
- *Elapsed = (UINT16 *) Buf;
- Buf += 2;
+ WriteUnaligned16 ((UINT16 *)Buf, HTONS (0));
+ *Elapsed = (UINT16 *)Buf;
+ Buf += 2;
return Buf;
}
@@ -863,13 +839,13 @@ Dhcp6AppendETOption ( **/
VOID
SetElapsedTime (
- IN UINT16 *Elapsed,
- IN DHCP6_INSTANCE *Instance
+ IN UINT16 *Elapsed,
+ IN DHCP6_INSTANCE *Instance
)
{
- EFI_TIME Time;
- UINT64 CurrentStamp;
- UINT64 ElapsedTimeValue;
+ EFI_TIME Time;
+ UINT64 CurrentStamp;
+ UINT64 ElapsedTimeValue;
//
// Generate a time stamp of the centiseconds from 2000/1/1, assume 30day/month.
@@ -879,7 +855,7 @@ SetElapsedTime ( ((((UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,
100
) +
- DivU64x32(
+ DivU64x32 (
Time.Nanosecond,
10000000
);
@@ -890,7 +866,7 @@ SetElapsedTime ( // gets 0 elapsed-time. Otherwise, calculate based on StartTime.
//
if (Instance->StartTime == 0) {
- ElapsedTimeValue = 0;
+ ElapsedTimeValue = 0;
Instance->StartTime = CurrentStamp;
} else {
ElapsedTimeValue = CurrentStamp - Instance->StartTime;
@@ -902,9 +878,9 @@ SetElapsedTime ( ElapsedTimeValue = 0xffff;
}
}
- WriteUnaligned16 (Elapsed, HTONS((UINT16) ElapsedTimeValue));
-}
+ WriteUnaligned16 (Elapsed, HTONS ((UINT16)ElapsedTimeValue));
+}
/**
Seek the address of the first byte of the option header.
@@ -919,15 +895,15 @@ SetElapsedTime ( **/
UINT8 *
Dhcp6SeekOption (
- IN UINT8 *Buf,
- IN UINT32 SeekLen,
- IN UINT16 OptType
+ IN UINT8 *Buf,
+ IN UINT32 SeekLen,
+ IN UINT16 OptType
)
{
- UINT8 *Cursor;
- UINT8 *Option;
- UINT16 DataLen;
- UINT16 OpCode;
+ UINT8 *Cursor;
+ UINT8 *Option;
+ UINT16 DataLen;
+ UINT16 OpCode;
Option = NULL;
Cursor = Buf;
@@ -936,19 +912,19 @@ Dhcp6SeekOption ( // The format of Dhcp6 option refers to Dhcp6AppendOption().
//
while (Cursor < Buf + SeekLen) {
- OpCode = ReadUnaligned16 ((UINT16 *) Cursor);
+ OpCode = ReadUnaligned16 ((UINT16 *)Cursor);
if (OpCode == HTONS (OptType)) {
Option = Cursor;
break;
}
- DataLen = NTOHS (ReadUnaligned16 ((UINT16 *) (Cursor + 2)));
+
+ DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
Cursor += (DataLen + 4);
}
return Option;
}
-
/**
Seek the address of the first byte of the Ia option header.
@@ -967,11 +943,11 @@ Dhcp6SeekIaOption ( IN EFI_DHCP6_IA_DESCRIPTOR *IaDesc
)
{
- UINT8 *Cursor;
- UINT8 *Option;
- UINT16 DataLen;
- UINT16 OpCode;
- UINT32 IaId;
+ UINT8 *Cursor;
+ UINT8 *Option;
+ UINT16 DataLen;
+ UINT16 OpCode;
+ UINT32 IaId;
//
// The format of IA_NA and IA_TA option refers to Dhcp6AppendIaOption().
@@ -980,13 +956,14 @@ Dhcp6SeekIaOption ( Cursor = Buf;
while (Cursor < Buf + SeekLen) {
- OpCode = ReadUnaligned16 ((UINT16 *) Cursor);
- IaId = ReadUnaligned32 ((UINT32 *) (Cursor + 4));
- if (OpCode == HTONS (IaDesc->Type) && IaId == HTONL (IaDesc->IaId)) {
+ OpCode = ReadUnaligned16 ((UINT16 *)Cursor);
+ IaId = ReadUnaligned32 ((UINT32 *)(Cursor + 4));
+ if ((OpCode == HTONS (IaDesc->Type)) && (IaId == HTONL (IaDesc->IaId))) {
Option = Cursor;
break;
}
- DataLen = NTOHS (ReadUnaligned16 ((UINT16 *) (Cursor + 2)));
+
+ DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
Cursor += (DataLen + 4);
}
@@ -1006,19 +983,20 @@ Dhcp6SeekIaOption ( **/
BOOLEAN
Dhcp6AddrIsInCurrentIa (
- IN EFI_DHCP6_IA_ADDRESS *IaAddr,
- IN EFI_DHCP6_IA *CurrentIa
+ IN EFI_DHCP6_IA_ADDRESS *IaAddr,
+ IN EFI_DHCP6_IA *CurrentIa
)
{
- UINT32 Index;
+ UINT32 Index;
ASSERT (IaAddr != NULL && CurrentIa != NULL);
for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) {
- if (EFI_IP6_EQUAL(&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) {
+ if (EFI_IP6_EQUAL (&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) {
return TRUE;
}
}
+
return FALSE;
}
@@ -1034,19 +1012,19 @@ Dhcp6AddrIsInCurrentIa ( **/
VOID
Dhcp6ParseAddrOption (
- IN EFI_DHCP6_IA *CurrentIa,
- IN UINT8 *IaInnerOpt,
- IN UINT16 IaInnerLen,
- OUT UINT32 *AddrNum,
- IN OUT EFI_DHCP6_IA_ADDRESS *AddrBuf
+ IN EFI_DHCP6_IA *CurrentIa,
+ IN UINT8 *IaInnerOpt,
+ IN UINT16 IaInnerLen,
+ OUT UINT32 *AddrNum,
+ IN OUT EFI_DHCP6_IA_ADDRESS *AddrBuf
)
{
- UINT8 *Cursor;
- UINT16 DataLen;
- UINT16 OpCode;
- UINT32 ValidLt;
- UINT32 PreferredLt;
- EFI_DHCP6_IA_ADDRESS *IaAddr;
+ UINT8 *Cursor;
+ UINT16 DataLen;
+ UINT16 OpCode;
+ UINT32 ValidLt;
+ UINT32 PreferredLt;
+ EFI_DHCP6_IA_ADDRESS *IaAddr;
//
// The format of the IA Address option:
@@ -1086,26 +1064,28 @@ Dhcp6ParseAddrOption ( // Refer to RFC3315 Chapter 18.1.8, we need to update lifetimes for any addresses in the IA option
// that the client already has recorded in the IA, and discard the Ia address option with 0 valid time.
//
- OpCode = ReadUnaligned16 ((UINT16 *) Cursor);
- PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 20)));
- ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 24)));
- IaAddr = (EFI_DHCP6_IA_ADDRESS *) (Cursor + 4);
- if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt >= PreferredLt &&
- (Dhcp6AddrIsInCurrentIa(IaAddr, CurrentIa) || ValidLt !=0)) {
+ OpCode = ReadUnaligned16 ((UINT16 *)Cursor);
+ PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *)(Cursor + 20)));
+ ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *)(Cursor + 24)));
+ IaAddr = (EFI_DHCP6_IA_ADDRESS *)(Cursor + 4);
+ if ((OpCode == HTONS (Dhcp6OptIaAddr)) && (ValidLt >= PreferredLt) &&
+ (Dhcp6AddrIsInCurrentIa (IaAddr, CurrentIa) || (ValidLt != 0)))
+ {
if (AddrBuf != NULL) {
CopyMem (AddrBuf, IaAddr, sizeof (EFI_DHCP6_IA_ADDRESS));
AddrBuf->PreferredLifetime = PreferredLt;
AddrBuf->ValidLifetime = ValidLt;
- AddrBuf = (EFI_DHCP6_IA_ADDRESS *) ((UINT8 *) AddrBuf + sizeof (EFI_DHCP6_IA_ADDRESS));
+ AddrBuf = (EFI_DHCP6_IA_ADDRESS *)((UINT8 *)AddrBuf + sizeof (EFI_DHCP6_IA_ADDRESS));
}
+
(*AddrNum)++;
}
- DataLen = NTOHS (ReadUnaligned16 ((UINT16 *) (Cursor + 2)));
+
+ DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
Cursor += (DataLen + 4);
}
}
-
/**
Create a control block for the Ia according to the corresponding options.
@@ -1123,16 +1103,16 @@ Dhcp6ParseAddrOption ( **/
EFI_STATUS
Dhcp6GenerateIaCb (
- IN DHCP6_INSTANCE *Instance,
- IN UINT8 *IaInnerOpt,
- IN UINT16 IaInnerLen,
- IN UINT32 T1,
- IN UINT32 T2
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT8 *IaInnerOpt,
+ IN UINT16 IaInnerLen,
+ IN UINT32 T1,
+ IN UINT32 T2
)
{
- UINT32 AddrNum;
- UINT32 IaSize;
- EFI_DHCP6_IA *Ia;
+ UINT32 AddrNum;
+ UINT32 IaSize;
+ EFI_DHCP6_IA *Ia;
if (Instance->IaCb.Ia == NULL) {
return EFI_DEVICE_ERROR;
@@ -1152,7 +1132,7 @@ Dhcp6GenerateIaCb ( // Allocate for new IA.
//
IaSize = sizeof (EFI_DHCP6_IA) + (AddrNum - 1) * sizeof (EFI_DHCP6_IA_ADDRESS);
- Ia = AllocateZeroPool (IaSize);
+ Ia = AllocateZeroPool (IaSize);
if (Ia == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -1172,19 +1152,19 @@ Dhcp6GenerateIaCb ( if (Instance->IaCb.Ia->ReplyPacket != NULL) {
FreePool (Instance->IaCb.Ia->ReplyPacket);
}
- FreePool (Instance->IaCb.Ia);
+ FreePool (Instance->IaCb.Ia);
ZeroMem (&Instance->IaCb, sizeof (DHCP6_IA_CB));
//
// Update IaCb to use new IA.
//
- Instance->IaCb.Ia = Ia;
+ Instance->IaCb.Ia = Ia;
//
- // Fill in IaCb fields. Such as T1, T2, AllExpireTime and LeaseTime.
+ // Fill in IaCb fields. Such as T1, T2, AllExpireTime and LeaseTime.
//
Instance->IaCb.T1 = T1;
Instance->IaCb.T2 = T2;
@@ -1193,7 +1173,6 @@ Dhcp6GenerateIaCb ( return EFI_SUCCESS;
}
-
/**
Cache the current IA configuration information.
@@ -1205,11 +1184,11 @@ Dhcp6GenerateIaCb ( **/
EFI_STATUS
Dhcp6CacheIa (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- UINTN IaSize;
- EFI_DHCP6_IA *Ia;
+ UINTN IaSize;
+ EFI_DHCP6_IA *Ia;
Ia = Instance->IaCb.Ia;
@@ -1223,8 +1202,10 @@ Dhcp6CacheIa ( if (Instance->CacheIa == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem (Instance->CacheIa, Ia, IaSize);
}
+
return EFI_SUCCESS;
}
@@ -1236,16 +1217,16 @@ Dhcp6CacheIa ( **/
VOID
Dhcp6AppendCacheIa (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- UINT8 *Ptr;
- UINTN Index;
- UINTN IaSize;
- UINTN NewIaSize;
- EFI_DHCP6_IA *Ia;
- EFI_DHCP6_IA *NewIa;
- EFI_DHCP6_IA *CacheIa;
+ UINT8 *Ptr;
+ UINTN Index;
+ UINTN IaSize;
+ UINTN NewIaSize;
+ EFI_DHCP6_IA *Ia;
+ EFI_DHCP6_IA *NewIa;
+ EFI_DHCP6_IA *CacheIa;
Ia = Instance->IaCb.Ia;
CacheIa = Instance->CacheIa;
@@ -1267,11 +1248,11 @@ Dhcp6AppendCacheIa ( // Clear old address.ValidLifetime
//
for (Index = 0; Index < CacheIa->IaAddressCount; Index++) {
- CacheIa->IaAddress[Index].ValidLifetime = 0;
+ CacheIa->IaAddress[Index].ValidLifetime = 0;
}
NewIa->IaAddressCount += CacheIa->IaAddressCount;
- Ptr = (UINT8*)&NewIa->IaAddress[Ia->IaAddressCount];
+ Ptr = (UINT8 *)&NewIa->IaAddress[Ia->IaAddressCount];
CopyMem (Ptr, CacheIa->IaAddress, CacheIa->IaAddressCount * sizeof (EFI_DHCP6_IA_ADDRESS));
//
@@ -1279,8 +1260,8 @@ Dhcp6AppendCacheIa ( //
FreePool (Instance->CacheIa);
FreePool (Instance->IaCb.Ia);
- Instance->CacheIa = NULL;
- Instance->IaCb.Ia = NewIa;
+ Instance->CacheIa = NULL;
+ Instance->IaCb.Ia = NewIa;
}
}
@@ -1295,25 +1276,25 @@ Dhcp6AppendCacheIa ( **/
EFI_STATUS
Dhcp6GetMappingTimeOut (
- IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
- OUT UINTN *TimeOut
+ IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
+ OUT UINTN *TimeOut
)
{
- EFI_STATUS Status;
- UINTN DataSize;
- EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
+ EFI_STATUS Status;
+ UINTN DataSize;
+ EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
- if (Ip6Cfg == NULL || TimeOut == NULL) {
+ if ((Ip6Cfg == NULL) || (TimeOut == NULL)) {
return EFI_INVALID_PARAMETER;
}
DataSize = sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS);
- Status = Ip6Cfg->GetData (
- Ip6Cfg,
- Ip6ConfigDataTypeDupAddrDetectTransmits,
- &DataSize,
- &DadXmits
- );
+ Status = Ip6Cfg->GetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeDupAddrDetectTransmits,
+ &DataSize,
+ &DadXmits
+ );
if (EFI_ERROR (Status)) {
return Status;
}
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h index 2f18eb3609..046454ff4a 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h @@ -10,9 +10,8 @@ #ifndef __EFI_DHCP6_UTILITY_H__
#define __EFI_DHCP6_UTILITY_H__
-
-#define DHCP6_10_BIT_MASK 0x3ff
-#define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
+#define DHCP6_10_BIT_MASK 0x3ff
+#define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
/**
Generate client Duid in the format of Duid-llt.
@@ -25,7 +24,7 @@ **/
EFI_DHCP6_DUID *
Dhcp6GenerateClientId (
- IN EFI_SIMPLE_NETWORK_MODE *Mode
+ IN EFI_SIMPLE_NETWORK_MODE *Mode
);
/**
@@ -40,8 +39,8 @@ Dhcp6GenerateClientId ( **/
EFI_STATUS
Dhcp6CopyConfigData (
- IN EFI_DHCP6_CONFIG_DATA *DstCfg,
- IN EFI_DHCP6_CONFIG_DATA *SorCfg
+ IN EFI_DHCP6_CONFIG_DATA *DstCfg,
+ IN EFI_DHCP6_CONFIG_DATA *SorCfg
);
/**
@@ -52,7 +51,7 @@ Dhcp6CopyConfigData ( **/
VOID
Dhcp6CleanupConfigData (
- IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
+ IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
);
/**
@@ -63,7 +62,7 @@ Dhcp6CleanupConfigData ( **/
VOID
Dhcp6CleanupModeData (
- IN OUT EFI_DHCP6_MODE_DATA *ModeData
+ IN OUT EFI_DHCP6_MODE_DATA *ModeData
);
/**
@@ -78,9 +77,9 @@ Dhcp6CleanupModeData ( **/
UINT32
Dhcp6CalculateExpireTime (
- IN UINT32 Base,
- IN BOOLEAN IsFirstRt,
- IN BOOLEAN NeedSigned
+ IN UINT32 Base,
+ IN BOOLEAN IsFirstRt,
+ IN BOOLEAN NeedSigned
);
/**
@@ -91,7 +90,7 @@ Dhcp6CalculateExpireTime ( **/
VOID
Dhcp6CalculateLeaseTime (
- IN DHCP6_IA_CB *IaCb
+ IN DHCP6_IA_CB *IaCb
);
/**
@@ -107,9 +106,9 @@ Dhcp6CalculateLeaseTime ( **/
EFI_STATUS
Dhcp6CheckAddress (
- IN EFI_DHCP6_IA *Ia,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_IA *Ia,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
);
/**
@@ -125,9 +124,9 @@ Dhcp6CheckAddress ( **/
EFI_DHCP6_IA *
Dhcp6DepriveAddress (
- IN EFI_DHCP6_IA *Ia,
- IN UINT32 AddressCount,
- IN EFI_IPv6_ADDRESS *Addresses
+ IN EFI_DHCP6_IA *Ia,
+ IN UINT32 AddressCount,
+ IN EFI_IPv6_ADDRESS *Addresses
);
/**
@@ -139,7 +138,7 @@ Dhcp6DepriveAddress ( VOID
EFIAPI
Dhcp6DummyExtFree (
- IN VOID *Arg
+ IN VOID *Arg
);
/**
@@ -154,10 +153,10 @@ Dhcp6DummyExtFree ( VOID
EFIAPI
Dhcp6OnTransmitted (
- IN NET_BUF *Wrap,
- IN UDP_END_POINT *EndPoint,
- IN EFI_STATUS IoStatus,
- IN VOID *Context
+ IN NET_BUF *Wrap,
+ IN UDP_END_POINT *EndPoint,
+ IN EFI_STATUS IoStatus,
+ IN VOID *Context
);
/**
@@ -173,10 +172,10 @@ Dhcp6OnTransmitted ( **/
UINT8 *
Dhcp6AppendOption (
- IN OUT UINT8 *Buf,
- IN UINT16 OptType,
- IN UINT16 OptLen,
- IN UINT8 *Data
+ IN OUT UINT8 *Buf,
+ IN UINT16 OptType,
+ IN UINT16 OptLen,
+ IN UINT8 *Data
);
/**
@@ -193,11 +192,11 @@ Dhcp6AppendOption ( **/
UINT8 *
Dhcp6AppendIaOption (
- IN OUT UINT8 *Buf,
- IN EFI_DHCP6_IA *Ia,
- IN UINT32 T1,
- IN UINT32 T2,
- IN UINT32 MessageType
+ IN OUT UINT8 *Buf,
+ IN EFI_DHCP6_IA *Ia,
+ IN UINT32 T1,
+ IN UINT32 T2,
+ IN UINT32 MessageType
);
/**
@@ -213,9 +212,9 @@ Dhcp6AppendIaOption ( **/
UINT8 *
Dhcp6AppendETOption (
- IN OUT UINT8 *Buf,
- IN DHCP6_INSTANCE *Instance,
- OUT UINT16 **Elapsed
+ IN OUT UINT8 *Buf,
+ IN DHCP6_INSTANCE *Instance,
+ OUT UINT16 **Elapsed
);
/**
@@ -227,8 +226,8 @@ Dhcp6AppendETOption ( **/
VOID
SetElapsedTime (
- IN UINT16 *Elapsed,
- IN DHCP6_INSTANCE *Instance
+ IN UINT16 *Elapsed,
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -244,9 +243,9 @@ SetElapsedTime ( **/
UINT8 *
Dhcp6SeekOption (
- IN UINT8 *Buf,
- IN UINT32 SeekLen,
- IN UINT16 OptType
+ IN UINT8 *Buf,
+ IN UINT32 SeekLen,
+ IN UINT16 OptType
);
/**
@@ -262,9 +261,9 @@ Dhcp6SeekOption ( **/
UINT8 *
Dhcp6SeekIaOption (
- IN UINT8 *Buf,
- IN UINT32 SeekLen,
- IN EFI_DHCP6_IA_DESCRIPTOR *IaDesc
+ IN UINT8 *Buf,
+ IN UINT32 SeekLen,
+ IN EFI_DHCP6_IA_DESCRIPTOR *IaDesc
);
/**
@@ -279,11 +278,11 @@ Dhcp6SeekIaOption ( **/
VOID
Dhcp6ParseAddrOption (
- IN EFI_DHCP6_IA *CurrentIa,
- IN UINT8 *IaInnerOpt,
- IN UINT16 IaInnerLen,
- OUT UINT32 *AddrNum,
- IN OUT EFI_DHCP6_IA_ADDRESS *AddrBuf
+ IN EFI_DHCP6_IA *CurrentIa,
+ IN UINT8 *IaInnerOpt,
+ IN UINT16 IaInnerLen,
+ OUT UINT32 *AddrNum,
+ IN OUT EFI_DHCP6_IA_ADDRESS *AddrBuf
);
/**
@@ -303,14 +302,13 @@ Dhcp6ParseAddrOption ( **/
EFI_STATUS
Dhcp6GenerateIaCb (
- IN DHCP6_INSTANCE *Instance,
- IN UINT8 *IaInnerOpt,
- IN UINT16 IaInnerLen,
- IN UINT32 T1,
- IN UINT32 T2
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT8 *IaInnerOpt,
+ IN UINT16 IaInnerLen,
+ IN UINT32 T1,
+ IN UINT32 T2
);
-
/**
Cache the current IA configuration information.
@@ -322,10 +320,9 @@ Dhcp6GenerateIaCb ( **/
EFI_STATUS
Dhcp6CacheIa (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
-
/**
Append CacheIa to the current IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
@@ -334,7 +331,7 @@ Dhcp6CacheIa ( **/
VOID
Dhcp6AppendCacheIa (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -348,7 +345,8 @@ Dhcp6AppendCacheIa ( **/
EFI_STATUS
Dhcp6GetMappingTimeOut (
- IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
- OUT UINTN *TimeOut
+ IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
+ OUT UINTN *TimeOut
);
+
#endif
|