File ovmf-NetworkPkg-Apply-uncrustify-changes-Dhcp6Dxe-part.patch of Package ovmf.40352
From d4680d0024b71730fd26fec7d446367617c97703 Mon Sep 17 00:00:00 2001
From: Chun-Yi Lee <jlee@suse.com>
Date: Fri, 7 Feb 2025 12:58:53 +0800
Subject: [PATCH] NetworkPkg: Apply uncrustify changes Dhcp6Dxe part
Upstream git commit in edk2: d1050b9dff1cace252aff86630bfdb59dff5f507
This is the Dhcp6Dxe part in 'd1050b9dff1c NetworkPkg: Apply uncrustify changes'
---
NetworkPkg/Dhcp6Dxe/ComponentName.c | 52 +-
NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c | 149 ++--
NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h | 6 +-
NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 284 +++----
NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h | 162 ++--
NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 1145 +++++++++++++--------------
NetworkPkg/Dhcp6Dxe/Dhcp6Io.h | 37 +-
NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 479 ++++++-----
NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h | 116 ++-
9 files changed, 1183 insertions(+), 1247 deletions(-)
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/ComponentName.c
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/ComponentName.c
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/ComponentName.c
@@ -15,7 +15,6 @@
#include "Dhcp6Impl.h"
-
/**
Retrieves a Unicode string that is the user-readable name of the driver.
@@ -63,7 +62,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.
@@ -135,18 +133,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"
@@ -155,13 +152,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPON
//
// 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"
@@ -172,9 +169,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICOD
}
};
-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)",
@@ -254,12 +251,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;
@@ -284,12 +281,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);
}
@@ -385,15 +384,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.
@@ -445,4 +444,3 @@ Dhcp6ComponentNameGetControllerName (
(BOOLEAN)(This == &gDhcp6ComponentName)
);
}
-
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c
@@ -16,8 +16,7 @@
#include "Dhcp6Impl.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
Dhcp6DriverBindingSupported,
Dhcp6DriverBindingStart,
Dhcp6DriverBindingStop,
@@ -26,7 +25,7 @@ EFI_DRIVER_BINDING_PROTOCOL gDhcp6Driver
NULL
};
-EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
+EFI_SERVICE_BINDING_PROTOCOL gDhcp6ServiceBindingTemplate = {
Dhcp6ServiceBindingCreateChild,
Dhcp6ServiceBindingDestroyChild
};
@@ -45,12 +44,12 @@ EFI_SERVICE_BINDING_PROTOCOL gDhcp6Servi
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);
@@ -73,13 +72,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
@@ -90,7 +88,7 @@ Dhcp6ConfigureUdpIo (
**/
VOID
Dhcp6DestroyService (
- IN OUT DHCP6_SERVICE *Service
+ IN OUT DHCP6_SERVICE *Service
)
{
//
@@ -109,7 +107,6 @@ Dhcp6DestroyService (
FreePool (Service);
}
-
/**
Create a new Dhcp6 service for the Nic controller.
@@ -125,13 +122,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));
@@ -153,10 +150,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,
@@ -170,7 +167,7 @@ Dhcp6CreateService (
Status = gBS->HandleProtocol (
Controller,
&gEfiIp6ConfigProtocolGuid,
- (VOID **) &Dhcp6Srv->Ip6Cfg
+ (VOID **)&Dhcp6Srv->Ip6Cfg
);
if (EFI_ERROR (Status)) {
FreePool (Dhcp6Srv);
@@ -181,7 +178,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);
@@ -212,7 +209,6 @@ Dhcp6CreateService (
return EFI_SUCCESS;
}
-
/**
Destroy the Dhcp6 instance and recycle the resources.
@@ -221,7 +217,7 @@ Dhcp6CreateService (
**/
VOID
Dhcp6DestroyInstance (
- IN OUT DHCP6_INSTANCE *Instance
+ IN OUT DHCP6_INSTANCE *Instance
)
{
//
@@ -245,6 +241,7 @@ Dhcp6DestroyInstance (
if (Instance->IaCb.Ia->ReplyPacket != NULL) {
FreePool (Instance->IaCb.Ia->ReplyPacket);
}
+
FreePool (Instance->IaCb.Ia);
}
@@ -259,7 +256,6 @@ Dhcp6DestroyInstance (
FreePool (Instance);
}
-
/**
Create the Dhcp6 instance and initialize it.
@@ -272,12 +268,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));
@@ -289,11 +285,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,
@@ -339,24 +335,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.
@@ -370,8 +365,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 (
@@ -384,7 +379,6 @@ Dhcp6DriverEntryPoint (
);
}
-
/**
Test to see if this driver supports ControllerHandle. This service
is called by the EFI boot service ConnectController(). In
@@ -420,7 +414,6 @@ Dhcp6DriverBindingSupported (
);
}
-
/**
Start this driver on ControllerHandle. This service is called by the
EFI boot service ConnectController(). In order to make
@@ -447,8 +440,8 @@ Dhcp6DriverBindingStart (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
- EFI_STATUS Status;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ DHCP6_SERVICE *Service;
//
// Check the Dhcp6 serivce whether already started.
@@ -496,7 +489,6 @@ Dhcp6DriverBindingStart (
return EFI_SUCCESS;
}
-
/**
Stop this driver on ControllerHandle. This service is called by the
EFI boot service DisconnectController(). In order to
@@ -525,12 +517,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.
@@ -544,7 +536,7 @@ Dhcp6DriverBindingStop (
Status = gBS->OpenProtocol (
NicHandle,
&gEfiDhcp6ServiceBindingProtocolGuid,
- (VOID **) &ServiceBinding,
+ (VOID **)&ServiceBinding,
This->DriverBindingHandle,
NicHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -559,23 +551,23 @@ Dhcp6DriverBindingStop (
//
// Destroy all the children instances before destory 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.
//
@@ -596,7 +588,6 @@ ON_EXIT:
return Status;
}
-
/**
Creates a child handle and installs a protocol.
@@ -621,19 +612,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;
@@ -676,14 +667,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,
@@ -710,7 +700,6 @@ ON_ERROR:
return Status;
}
-
/**
Destroys a child handle with a protocol installed on it.
@@ -736,13 +725,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;
}
@@ -752,7 +741,7 @@ Dhcp6ServiceBindingDestroyChild (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiDhcp6ProtocolGuid,
- (VOID **) &Dhcp6,
+ (VOID **)&Dhcp6,
gDhcp6DriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Driver.h
@@ -19,9 +19,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
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
@@ -21,10 +21,12 @@
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2
// ALL_DHCP_Servers address: FF05::1:3
//
-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_IPv6_ADDRESS mAllDhcpServersAddress = {{0xFF, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3}};
-EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
+EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
EfiDhcp6GetModeData,
EfiDhcp6Configure,
EfiDhcp6Start,
@@ -69,13 +71,13 @@ EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplat
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 Status;
+ EFI_TPL OldTpl;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -100,7 +102,7 @@ EfiDhcp6Start (
return EFI_ALREADY_STARTED;
}
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance->UdpSts = EFI_ALREADY_STARTED;
//
@@ -115,7 +117,7 @@ EfiDhcp6Start (
//
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -132,10 +134,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;
}
@@ -147,7 +149,6 @@ ON_ERROR:
return Status;
}
-
/**
Stops the DHCPv6 standard S.A.R.R. process.
@@ -166,14 +167,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;
@@ -196,10 +197,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;
}
@@ -209,7 +211,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;
@@ -237,7 +239,6 @@ ON_EXIT:
return Status;
}
-
/**
Returns the current operating mode data for the Dhcp6 instance.
@@ -256,26 +257,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;
+ EFI_TPL OldTpl;
+ EFI_DHCP6_IA *Ia;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_SERVICE *Service;
+ UINT32 IaSize;
+ UINT32 IdSize;
- if (This == NULL || (Dhcp6ModeData == NULL && Dhcp6ConfigData == NULL)) {
+ 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;
}
@@ -287,7 +288,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.
//
@@ -343,6 +344,7 @@ EfiDhcp6GetModeData (
if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {
goto ON_ERROR;
}
+
CopyMem (
Dhcp6ModeData->Ia->ReplyPacket,
Ia->ReplyPacket,
@@ -361,15 +363,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.
@@ -401,17 +404,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;
@@ -424,36 +427,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;
}
@@ -462,10 +469,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;
}
}
@@ -492,7 +500,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;
@@ -502,21 +510,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);
@@ -544,7 +551,6 @@ EfiDhcp6Configure (
return EFI_SUCCESS;
}
-
/**
Request configuration information without the assignment of any
Ia addresses of the client.
@@ -600,29 +606,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;
+ 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) {
+ 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;
}
}
@@ -647,8 +653,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;
}
@@ -693,7 +699,6 @@ EfiDhcp6InfoRequest (
// Poll udp out of the net tpl if synchoronus call.
//
if (TimeoutEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
@@ -703,7 +708,6 @@ EfiDhcp6InfoRequest (
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
@@ -752,14 +756,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;
@@ -780,9 +784,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;
}
@@ -805,7 +810,7 @@ EfiDhcp6RenewRebind (
//
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -822,7 +827,6 @@ EfiDhcp6RenewRebind (
// Poll udp out of the net tpl if synchoronus call.
//
if (Instance->Config->IaInfoEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
@@ -837,7 +841,6 @@ ON_ERROR:
return Status;
}
-
/**
Inform that one or more addresses assigned by a server are already
in use by another node.
@@ -873,18 +876,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;
}
@@ -909,7 +912,7 @@ EfiDhcp6Decline (
//
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -939,7 +942,7 @@ EfiDhcp6Decline (
//
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -957,7 +960,6 @@ EfiDhcp6Decline (
// Poll udp out of the net tpl if synchoronus call.
//
if (Instance->Config->IaInfoEvent == NULL) {
-
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
@@ -971,12 +973,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.
@@ -1014,18 +1016,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;
}
@@ -1050,7 +1052,7 @@ EfiDhcp6Release (
//
Status = Dhcp6CheckAddress (Instance->IaCb.Ia, AddressCount, Addresses);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -1080,7 +1082,7 @@ EfiDhcp6Release (
//
// Register receive callback for the stateful exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -1101,6 +1103,7 @@ EfiDhcp6Release (
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
}
+
return Instance->UdpSts;
}
@@ -1111,12 +1114,12 @@ ON_ERROR:
if (RelIa != NULL) {
FreePool (RelIa);
}
+
gBS->RestoreTPL (OldTpl);
return Status;
}
-
/**
Parse the option data in the Dhcp6 packet.
@@ -1142,21 +1145,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;
}
@@ -1181,7 +1184,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++;
}
@@ -1204,13 +1207,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;
}
-
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
@@ -16,7 +16,6 @@
#ifndef __EFI_DHCP6_IMPL_H__
#define __EFI_DHCP6_IMPL_H__
-
#include <Uefi.h>
#include <IndustryStandard/Dhcp.h>
@@ -39,12 +38,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"
@@ -53,103 +51,103 @@ typedef struct _DHCP6_INSTANCE DHCP6_INS
#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 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_IPv6_ADDRESS mAllDhcpRelayAndServersAddress;
extern EFI_IPv6_ADDRESS mAllDhcpServersAddress;
-extern EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate;
+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;
};
/**
@@ -184,7 +182,7 @@ struct _DHCP6_SERVICE {
EFI_STATUS
EFIAPI
EfiDhcp6Start (
- IN EFI_DHCP6_PROTOCOL *This
+ IN EFI_DHCP6_PROTOCOL *This
);
/**
@@ -205,7 +203,7 @@ EfiDhcp6Start (
EFI_STATUS
EFIAPI
EfiDhcp6Stop (
- IN EFI_DHCP6_PROTOCOL *This
+ IN EFI_DHCP6_PROTOCOL *This
);
/**
@@ -227,9 +225,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
);
/**
@@ -264,8 +262,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
);
/**
@@ -371,8 +369,8 @@ EfiDhcp6InfoRequest (
EFI_STATUS
EFIAPI
EfiDhcp6RenewRebind (
- IN EFI_DHCP6_PROTOCOL *This,
- IN BOOLEAN RebindRequest
+ IN EFI_DHCP6_PROTOCOL *This,
+ IN BOOLEAN RebindRequest
);
/**
@@ -410,9 +408,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
);
/**
@@ -451,9 +449,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
);
/**
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
@@ -16,7 +16,6 @@
#include "Dhcp6Impl.h"
-
/**
Enqueue the packet into the retry list in case of timeout.
@@ -40,8 +39,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);
@@ -61,155 +60,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 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.
- //
- 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;
}
//
@@ -220,7 +220,6 @@ Dhcp6EnqueueRetry (
return EFI_SUCCESS;
}
-
/**
Dequeue the packet from retry list if reply received or timeout at last.
@@ -235,40 +234,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);
}
@@ -277,11 +272,12 @@ Dhcp6DequeueRetry (
}
}
}
+
//
// Remove the retransmit node.
//
RemoveEntryList (&TxCb->Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
FreePool (TxCb->TxPacket);
FreePool (TxCb);
return EFI_SUCCESS;
@@ -291,7 +287,6 @@ Dhcp6DequeueRetry (
return EFI_NOT_FOUND;
}
-
/**
Clean up the specific nodes in the retry list.
@@ -301,24 +296,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);
@@ -331,15 +324,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);
@@ -352,12 +343,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);
}
@@ -376,11 +367,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)) {
@@ -400,15 +391,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.
@@ -430,23 +421,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
@@ -466,7 +457,6 @@ Dhcp6CleanupSession (
}
}
-
/**
Callback to user when Dhcp6 transmit/receive occurs.
@@ -482,15 +472,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);
@@ -505,7 +495,6 @@ Dhcp6CallbackUser (
// Callback to user with the new message if has.
//
if (Callback != NULL) {
-
Status = Callback (
&Instance->Dhcp6,
Context,
@@ -527,7 +516,6 @@ Dhcp6CallbackUser (
return Status;
}
-
/**
Update Ia according to the new reply message.
@@ -540,17 +528,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);
//
@@ -616,23 +604,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);
}
//
@@ -658,7 +647,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;
}
@@ -678,8 +667,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.
@@ -695,14 +682,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
@@ -715,7 +702,7 @@ Dhcp6SeekStsOption (
);
if (*Option != NULL) {
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (*Option + 4)));
+ StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)(*Option + 4)));
if (StsCode != Dhcp6StsSuccess) {
return EFI_DEVICE_ERROR;
}
@@ -776,10 +763,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);
}
//
@@ -801,9 +788,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;
}
@@ -812,7 +799,6 @@ Dhcp6SeekStsOption (
return EFI_SUCCESS;
}
-
/**
Transmit Dhcp6 message by udpio.
@@ -827,23 +813,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;
//
@@ -904,7 +890,6 @@ Dhcp6TransmitPacket (
return EFI_SUCCESS;
}
-
/**
Create the solicit message and send it.
@@ -917,19 +902,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;
@@ -990,9 +975,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,
@@ -1003,7 +987,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);
//
@@ -1056,17 +1040,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.
@@ -1080,31 +1063,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.
@@ -1118,7 +1101,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.
@@ -1179,9 +1162,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,
@@ -1192,7 +1174,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);
//
@@ -1228,7 +1210,6 @@ Dhcp6SendRequestMsg (
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
/**
Create the decline message and send it.
@@ -1243,20 +1224,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);
@@ -1284,7 +1265,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 commone fields.
@@ -1330,7 +1311,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);
//
@@ -1366,7 +1347,6 @@ Dhcp6SendDeclineMsg (
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
/**
Create the release message and send it.
@@ -1381,30 +1361,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;
+ 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);
+ 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.
@@ -1418,7 +1398,7 @@ Dhcp6SendReleaseMsg (
return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Create the Dhcp6 packet and initialize commone fields.
@@ -1467,7 +1447,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);
//
@@ -1499,7 +1479,6 @@ Dhcp6SendReleaseMsg (
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
/**
Create the renew/rebind message and send it.
@@ -1515,33 +1494,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;
+ 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);
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
- Service = Instance->Service;
- ClientId = Service->ClientId;
+ Service = Instance->Service;
+ ClientId = Service->ClientId;
- ASSERT(ClientId);
+ ASSERT (ClientId);
//
// Calculate the added length of customized option list.
@@ -1609,7 +1588,7 @@ Dhcp6SendRenewRebindMsg (
return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
Cursor = Dhcp6AppendOption (
Cursor,
@@ -1623,9 +1602,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,
@@ -1636,14 +1614,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);
@@ -1712,19 +1690,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);
@@ -1757,7 +1735,7 @@ Dhcp6StartInfoRequest (
//
// Register receive callback for the stateless exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -1808,24 +1786,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;
+ 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);
+ 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.
@@ -1847,7 +1825,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.
@@ -1881,9 +1859,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,
@@ -1918,7 +1895,6 @@ Dhcp6SendInfoRequestMsg (
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, Retransmission);
}
-
/**
Create the Confirm message and send it.
@@ -1932,19 +1908,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);
@@ -2018,7 +1994,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);
//
@@ -2054,8 +2030,6 @@ Dhcp6SendConfirmMsg (
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
}
-
-
/**
Handle with the Dhcp6 reply message.
@@ -2070,13 +2044,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);
@@ -2101,7 +2075,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;
}
@@ -2109,11 +2083,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,
@@ -2138,10 +2112,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);
@@ -2164,7 +2137,7 @@ Dhcp6HandleReplyMsg (
//
// Reset start time for next exchange.
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
Status = EFI_SUCCESS;
goto ON_EXIT;
@@ -2191,7 +2164,7 @@ Dhcp6HandleReplyMsg (
//
// Reset start time for next exchange.
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
//
// Set bound state and store the reply packet.
@@ -2214,7 +2187,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
@@ -2240,70 +2213,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;
+
+ 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;
+ 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;
+
+ break;
- default:
- //
- // The other status code, just restart solicitation.
- //
- 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;
}
}
@@ -2311,7 +2286,7 @@ Dhcp6HandleReplyMsg (
ON_EXIT:
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = Dhcp6DequeueRetry (
Instance,
Packet->Dhcp6.Header.TransactionId,
@@ -2322,7 +2297,6 @@ ON_EXIT:
return Status;
}
-
/**
Select the appointed Dhcp6 advertisement message.
@@ -2336,12 +2310,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);
@@ -2366,7 +2340,7 @@ Dhcp6SelectAdvertiseMsg (
FALSE
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -2374,21 +2348,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));
}
//
@@ -2406,7 +2379,6 @@ Dhcp6SelectAdvertiseMsg (
return Dhcp6SendRequestMsg (Instance);
}
-
/**
Handle with the Dhcp6 advertisement message.
@@ -2421,16 +2393,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;
@@ -2440,14 +2412,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);
}
@@ -2495,12 +2466,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
@@ -2513,13 +2483,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
@@ -2546,7 +2516,6 @@ Dhcp6HandleAdvertiseMsg (
// preference is less than other advertisements received before.
// Leave the packet alone.
}
-
} else {
//
// Other error status means termination.
@@ -2559,14 +2528,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.
@@ -2576,14 +2544,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;
@@ -2600,27 +2568,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
@@ -2631,35 +2599,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 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 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:
@@ -2678,7 +2647,6 @@ ON_EXIT:
}
}
-
/**
The Dhcp6 stateless exchange process routine.
@@ -2688,15 +2656,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;
@@ -2781,7 +2749,6 @@ ON_EXIT:
}
}
-
/**
The receive callback function for Dhcp6 exchange process.
@@ -2794,37 +2761,37 @@ ON_EXIT:
VOID
EFIAPI
Dhcp6ReceivePacket (
- 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;
+ 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;
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)) {
@@ -2835,7 +2802,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;
@@ -2843,7 +2810,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;
@@ -2853,11 +2820,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) {
@@ -2868,7 +2833,8 @@ Dhcp6ReceivePacket (
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
IsStateless = TRUE;
}
- IsDispatched = TRUE;
+
+ IsDispatched = TRUE;
break;
}
}
@@ -2898,11 +2864,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);
@@ -2934,7 +2900,7 @@ ON_CONTINUE:
**/
BOOLEAN
Dhcp6LinkMovDetect (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
UINT32 InterruptStatus;
@@ -2943,7 +2909,7 @@ Dhcp6LinkMovDetect (
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
ASSERT (Instance != NULL);
- Snp = Instance->Service->Snp;
+ Snp = Instance->Service->Snp;
MediaPresent = Instance->MediaPresent;
//
@@ -2968,10 +2934,10 @@ Dhcp6LinkMovDetect (
if (!MediaPresent && Instance->MediaPresent) {
return TRUE;
}
+
return FALSE;
}
-
/**
The timer routine of the Dhcp6 instance for each second.
@@ -2982,28 +2948,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++;
@@ -3012,7 +2977,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
@@ -3029,9 +2994,11 @@ Dhcp6OnTimerTick (
} else if (EFI_ERROR (Status)) {
TxCb->RetryCnt++;
}
+
return;
}
}
+
//
// Increase the retry count for the packet and add up the total loss time.
//
@@ -3041,7 +3008,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;
}
@@ -3049,7 +3016,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;
}
@@ -3066,7 +3033,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,
@@ -3079,7 +3046,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;
}
@@ -3105,22 +3072,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.
//
@@ -3138,28 +3102,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,
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Io.h
@@ -16,7 +16,6 @@
#ifndef __EFI_DHCP6_IO_H__
#define __EFI_DHCP6_IO_H__
-
/**
Clean up the specific nodes in the retry list.
@@ -26,8 +25,8 @@
**/
VOID
Dhcp6CleanupRetry (
- IN DHCP6_INSTANCE *Instance,
- IN UINT32 Scope
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT32 Scope
);
/**
@@ -39,8 +38,8 @@ Dhcp6CleanupRetry (
**/
VOID
Dhcp6CleanupSession (
- IN OUT DHCP6_INSTANCE *Instance,
- IN EFI_STATUS Status
+ IN OUT DHCP6_INSTANCE *Instance,
+ IN EFI_STATUS Status
);
/**
@@ -55,7 +54,7 @@ Dhcp6CleanupSession (
**/
EFI_STATUS
Dhcp6SendSolicitMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -71,7 +70,7 @@ Dhcp6SendSolicitMsg (
**/
EFI_STATUS
Dhcp6SendRequestMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -89,8 +88,8 @@ Dhcp6SendRequestMsg (
**/
EFI_STATUS
Dhcp6SendRenewRebindMsg (
- IN DHCP6_INSTANCE *Instance,
- IN BOOLEAN RebindRequest
+ IN DHCP6_INSTANCE *Instance,
+ IN BOOLEAN RebindRequest
);
/**
@@ -107,8 +106,8 @@ Dhcp6SendRenewRebindMsg (
**/
EFI_STATUS
Dhcp6SendDeclineMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *DecIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *DecIa
);
/**
@@ -125,8 +124,8 @@ Dhcp6SendDeclineMsg (
**/
EFI_STATUS
Dhcp6SendReleaseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *RelIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *RelIa
);
/**
@@ -204,10 +203,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
);
/**
@@ -220,8 +219,8 @@ Dhcp6ReceivePacket (
VOID
EFIAPI
Dhcp6OnTimerTick (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
);
#endif
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
@@ -16,7 +16,6 @@
#include "Dhcp6Impl.h"
-
/**
Generate client Duid in the format of Duid-llt.
@@ -28,21 +27,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;
}
@@ -90,17 +88,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:
@@ -122,11 +118,11 @@ Dhcp6GenerateClientId (
//
gRT->GetTime (&Time, NULL);
Stamp = (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
@@ -139,14 +135,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);
}
@@ -156,7 +152,7 @@ Dhcp6GenerateClientId (
&gEfiDhcp6ServiceBindingProtocolGuid,
(EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS),
Duid->Length + 2,
- (VOID *) Duid
+ (VOID *)Duid
);
if (EFI_ERROR (Status)) {
FreePool (Duid);
@@ -166,7 +162,6 @@ Dhcp6GenerateClientId (
return Duid;
}
-
/**
Copy the Dhcp6 configure data.
@@ -179,13 +174,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));
@@ -193,7 +188,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) {
@@ -210,8 +204,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);
@@ -223,7 +216,6 @@ Dhcp6CopyConfigData (
}
for (Index = 0; Index < SorCfg->OptionCount; Index++) {
-
OptionSize = NTOHS (SorCfg->OptionList[Index]->OpLen) + 4;
DstCfg->OptionList[Index] = AllocateZeroPool (OptionSize);
@@ -245,7 +237,6 @@ Dhcp6CopyConfigData (
return EFI_SUCCESS;
}
-
/**
Clean up the configure data.
@@ -254,10 +245,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);
//
@@ -270,6 +261,7 @@ Dhcp6CleanupConfigData (
FreePool (CfgData->OptionList[Index]);
}
}
+
FreePool (CfgData->OptionList);
}
@@ -280,7 +272,6 @@ Dhcp6CleanupConfigData (
ZeroMem (CfgData, sizeof (EFI_DHCP6_CONFIG_DATA));
}
-
/**
Clean up the mode data.
@@ -289,7 +280,7 @@ Dhcp6CleanupConfigData (
**/
VOID
Dhcp6CleanupModeData (
- IN OUT EFI_DHCP6_MODE_DATA *ModeData
+ IN OUT EFI_DHCP6_MODE_DATA *ModeData
)
{
ASSERT (ModeData != NULL);
@@ -302,17 +293,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.
@@ -325,15 +315,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.
@@ -341,8 +331,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:
@@ -354,20 +344,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;
@@ -375,7 +358,6 @@ Dhcp6CalculateExpireTime (
return Expire;
}
-
/**
Calculate the lease time by the algorithm defined in rfc.
@@ -384,25 +366,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);
}
//
@@ -415,7 +397,6 @@ Dhcp6CalculateLeaseTime (
IaCb->LeaseTime = 0;
}
-
/**
Check whether the addresses are all included by the configured Ia.
@@ -429,31 +410,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;
}
@@ -467,7 +446,6 @@ Dhcp6CheckAddress (
return EFI_SUCCESS;
}
-
/**
Deprive the addresses from current Ia, and generate another eliminated Ia.
@@ -481,16 +459,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) {
//
@@ -527,16 +505,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
//
@@ -555,10 +532,12 @@ Dhcp6DepriveAddress (
(Ia->IaAddressCount - Index2 - 1) * sizeof (EFI_DHCP6_IA_ADDRESS)
);
}
+
Found = TRUE;
break;
}
}
+
ASSERT (Found == TRUE);
}
@@ -568,7 +547,6 @@ Dhcp6DepriveAddress (
return IaCopy;
}
-
/**
The dummy ext buffer free callback routine.
@@ -578,12 +556,11 @@ Dhcp6DepriveAddress (
VOID
EFIAPI
Dhcp6DummyExtFree (
- IN VOID *Arg
+ IN VOID *Arg
)
{
}
-
/**
The callback routine once message transmitted.
@@ -596,16 +573,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.
@@ -619,10 +595,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
)
{
//
@@ -639,12 +615,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;
}
@@ -661,12 +637,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
@@ -691,14 +666,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.
@@ -706,19 +681,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.
@@ -733,16 +709,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:
@@ -766,43 +742,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;
}
@@ -820,9 +796,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
)
{
//
@@ -839,22 +815,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;
}
@@ -869,13 +845,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.
@@ -887,7 +863,7 @@ SetElapsedTime (
(Time.Month - 1)) * 30 +
(Time.Day - 1)) * 24 + Time.Hour) * 60 +
Time.Minute) * 60 + Time.Second) * 100
- + DivU64x32(Time.Nanosecond, 10000000)
+ + DivU64x32 (Time.Nanosecond, 10000000)
);
//
@@ -896,7 +872,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;
@@ -908,9 +884,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.
@@ -925,15 +901,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;
@@ -942,19 +918,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.
@@ -973,11 +949,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().
@@ -986,13 +962,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);
}
@@ -1012,19 +989,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;
}
@@ -1040,19 +1018,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:
@@ -1092,26 +1070,27 @@ 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 blcok for the Ia according to the corresponding options.
@@ -1129,16 +1108,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;
@@ -1158,7 +1137,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;
@@ -1178,19 +1157,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;
@@ -1199,7 +1178,6 @@ Dhcp6GenerateIaCb (
return EFI_SUCCESS;
}
-
/**
Cache the current IA configuration information.
@@ -1211,11 +1189,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;
@@ -1229,8 +1207,10 @@ Dhcp6CacheIa (
if (Instance->CacheIa == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem (Instance->CacheIa, Ia, IaSize);
}
+
return EFI_SUCCESS;
}
@@ -1242,16 +1222,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;
@@ -1273,11 +1253,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));
//
@@ -1285,8 +1265,8 @@ Dhcp6AppendCacheIa (
//
FreePool (Instance->CacheIa);
FreePool (Instance->IaCb.Ia);
- Instance->CacheIa = NULL;
- Instance->IaCb.Ia = NewIa;
+ Instance->CacheIa = NULL;
+ Instance->IaCb.Ia = NewIa;
}
}
@@ -1301,25 +1281,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;
}
Index: ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
===================================================================
--- ovmf-2017+git1510945757.b2662641d5.orig/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
+++ ovmf-2017+git1510945757.b2662641d5/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
@@ -16,9 +16,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.
@@ -31,7 +30,7 @@
**/
EFI_DHCP6_DUID *
Dhcp6GenerateClientId (
- IN EFI_SIMPLE_NETWORK_MODE *Mode
+ IN EFI_SIMPLE_NETWORK_MODE *Mode
);
/**
@@ -46,8 +45,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
);
/**
@@ -58,7 +57,7 @@ Dhcp6CopyConfigData (
**/
VOID
Dhcp6CleanupConfigData (
- IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
+ IN OUT EFI_DHCP6_CONFIG_DATA *CfgData
);
/**
@@ -69,7 +68,7 @@ Dhcp6CleanupConfigData (
**/
VOID
Dhcp6CleanupModeData (
- IN OUT EFI_DHCP6_MODE_DATA *ModeData
+ IN OUT EFI_DHCP6_MODE_DATA *ModeData
);
/**
@@ -84,9 +83,9 @@ Dhcp6CleanupModeData (
**/
UINT32
Dhcp6CalculateExpireTime (
- IN UINT32 Base,
- IN BOOLEAN IsFirstRt,
- IN BOOLEAN NeedSigned
+ IN UINT32 Base,
+ IN BOOLEAN IsFirstRt,
+ IN BOOLEAN NeedSigned
);
/**
@@ -97,7 +96,7 @@ Dhcp6CalculateExpireTime (
**/
VOID
Dhcp6CalculateLeaseTime (
- IN DHCP6_IA_CB *IaCb
+ IN DHCP6_IA_CB *IaCb
);
/**
@@ -113,9 +112,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
);
/**
@@ -131,9 +130,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
);
/**
@@ -145,7 +144,7 @@ Dhcp6DepriveAddress (
VOID
EFIAPI
Dhcp6DummyExtFree (
- IN VOID *Arg
+ IN VOID *Arg
);
/**
@@ -160,10 +159,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
);
/**
@@ -179,10 +178,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
);
/**
@@ -199,11 +198,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
);
/**
@@ -219,9 +218,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
);
/**
@@ -233,8 +232,8 @@ Dhcp6AppendETOption (
**/
VOID
SetElapsedTime (
- IN UINT16 *Elapsed,
- IN DHCP6_INSTANCE *Instance
+ IN UINT16 *Elapsed,
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -250,9 +249,9 @@ SetElapsedTime (
**/
UINT8 *
Dhcp6SeekOption (
- IN UINT8 *Buf,
- IN UINT32 SeekLen,
- IN UINT16 OptType
+ IN UINT8 *Buf,
+ IN UINT32 SeekLen,
+ IN UINT16 OptType
);
/**
@@ -268,9 +267,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
);
/**
@@ -285,11 +284,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
);
/**
@@ -309,14 +308,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.
@@ -328,10 +326,9 @@ Dhcp6GenerateIaCb (
**/
EFI_STATUS
Dhcp6CacheIa (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
-
/**
Append CacheIa to the currrent IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
@@ -340,7 +337,7 @@ Dhcp6CacheIa (
**/
VOID
Dhcp6AppendCacheIa (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
);
/**
@@ -354,7 +351,8 @@ Dhcp6AppendCacheIa (
**/
EFI_STATUS
Dhcp6GetMappingTimeOut (
- IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
- OUT UINTN *TimeOut
+ IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
+ OUT UINTN *TimeOut
);
+
#endif