NetworkPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the NetworkPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
2f88bd3a12
commit
d1050b9dff
@ -541,7 +541,7 @@ DeleteVlan (
|
|||||||
//
|
//
|
||||||
// Check VLAN ID
|
// Check VLAN ID
|
||||||
//
|
//
|
||||||
if (VlanIdStr == NULL || *VlanIdStr == 0) {
|
if ((VlanIdStr == NULL) || (*VlanIdStr == 0)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_VID), mHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_VID), mHiiHandle);
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create and initialize the arp service context data.
|
Create and initialize the arp service context data.
|
||||||
|
|
||||||
@ -176,7 +175,6 @@ ERROR_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean the arp service context data.
|
Clean the arp service context data.
|
||||||
|
|
||||||
@ -255,7 +253,7 @@ ArpDestroyChildEntryInHandleBuffer (
|
|||||||
ARP_INSTANCE_DATA *Instance;
|
ARP_INSTANCE_DATA *Instance;
|
||||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||||
|
|
||||||
if (Entry == NULL || Context == NULL) {
|
if ((Entry == NULL) || (Context == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +332,6 @@ ArpDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start this driver on ControllerHandle.
|
Start this driver on ControllerHandle.
|
||||||
|
|
||||||
@ -427,7 +424,6 @@ ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stop this driver on ControllerHandle.
|
Stop this driver on ControllerHandle.
|
||||||
|
|
||||||
@ -637,7 +633,6 @@ ArpServiceBindingCreateChild (
|
|||||||
ERROR:
|
ERROR:
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
ArpService->MnpChildHandle,
|
ArpService->MnpChildHandle,
|
||||||
&gEfiManagedNetworkProtocolGuid,
|
&gEfiManagedNetworkProtocolGuid,
|
||||||
@ -661,7 +656,6 @@ ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroys a child handle with a protocol installed on it.
|
Destroys a child handle with a protocol installed on it.
|
||||||
|
|
||||||
@ -746,8 +740,11 @@ ArpServiceBindingDestroyChild (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_ERROR, "ArpSBDestroyChild: Failed to uninstall the arp protocol, %r.\n",
|
DEBUG ((
|
||||||
Status));
|
DEBUG_ERROR,
|
||||||
|
"ArpSBDestroyChild: Failed to uninstall the arp protocol, %r.\n",
|
||||||
|
Status
|
||||||
|
));
|
||||||
|
|
||||||
Instance->InDestroy = FALSE;
|
Instance->InDestroy = FALSE;
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef _ARP_DRIVER_H_
|
#ifndef _ARP_DRIVER_H_
|
||||||
#define _ARP_DRIVER_H_
|
#define _ARP_DRIVER_H_
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <Protocol/Arp.h>
|
#include <Protocol/Arp.h>
|
||||||
@ -21,7 +20,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global variables
|
// Global variables
|
||||||
//
|
//
|
||||||
@ -32,6 +30,7 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2;
|
|||||||
//
|
//
|
||||||
// Function prototypes for the Driver Binding Protocol
|
// Function prototypes for the Driver Binding Protocol
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tests to see if this driver supports a given controller.
|
Tests to see if this driver supports a given controller.
|
||||||
|
|
||||||
@ -199,10 +198,10 @@ ArpServiceBindingDestroyChild (
|
|||||||
IN EFI_HANDLE ChildHandle
|
IN EFI_HANDLE ChildHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
@ -250,7 +249,6 @@ ArpComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -329,6 +327,4 @@ ArpComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ EFI_ARP_PROTOCOL mEfiArpProtocolTemplate = {
|
|||||||
ArpCancel
|
ArpCancel
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the instance context data.
|
Initialize the instance context data.
|
||||||
|
|
||||||
@ -51,7 +50,6 @@ ArpInitInstance (
|
|||||||
InitializeListHead (&Instance->List);
|
InitializeListHead (&Instance->List);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the Arp packets received from Mnp, the procedure conforms to RFC826.
|
Process the Arp packets received from Mnp, the procedure conforms to RFC826.
|
||||||
|
|
||||||
@ -130,7 +128,8 @@ ArpOnFrameRcvdDpc (
|
|||||||
|
|
||||||
if ((Head->HwType != ArpService->SnpMode.IfType) ||
|
if ((Head->HwType != ArpService->SnpMode.IfType) ||
|
||||||
(Head->HwAddrLen != ArpService->SnpMode.HwAddressSize) ||
|
(Head->HwAddrLen != ArpService->SnpMode.HwAddressSize) ||
|
||||||
(RxData->ProtocolType != ARP_ETHER_PROTO_TYPE)) {
|
(RxData->ProtocolType != ARP_ETHER_PROTO_TYPE))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The hardware type or the hardware address length doesn't match.
|
// The hardware type or the hardware address length doesn't match.
|
||||||
// There is a sanity check for the protocol type too.
|
// There is a sanity check for the protocol type too.
|
||||||
@ -183,7 +182,8 @@ ArpOnFrameRcvdDpc (
|
|||||||
|
|
||||||
if ((Instance->Configured) &&
|
if ((Instance->Configured) &&
|
||||||
(Head->ProtoType == ConfigData->SwAddressType) &&
|
(Head->ProtoType == ConfigData->SwAddressType) &&
|
||||||
(Head->ProtoAddrLen == ConfigData->SwAddressLength)) {
|
(Head->ProtoAddrLen == ConfigData->SwAddressLength))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The protocol type is matched for the received arp packet.
|
// The protocol type is matched for the received arp packet.
|
||||||
//
|
//
|
||||||
@ -192,7 +192,8 @@ ArpOnFrameRcvdDpc (
|
|||||||
(VOID *)ArpAddress.TargetProtoAddr,
|
(VOID *)ArpAddress.TargetProtoAddr,
|
||||||
ConfigData->StationAddress,
|
ConfigData->StationAddress,
|
||||||
ConfigData->SwAddressLength
|
ConfigData->SwAddressLength
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The arp driver has the target address required by the received arp packet.
|
// The arp driver has the target address required by the received arp packet.
|
||||||
//
|
//
|
||||||
@ -306,9 +307,14 @@ RESTART_RECEIVE:
|
|||||||
|
|
||||||
DEBUG_CODE_BEGIN ();
|
DEBUG_CODE_BEGIN ();
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_ERROR, "ArpOnFrameRcvd: ArpService->Mnp->Receive "
|
DEBUG ((
|
||||||
"failed, %r\n.", Status));
|
DEBUG_ERROR,
|
||||||
|
"ArpOnFrameRcvd: ArpService->Mnp->Receive "
|
||||||
|
"failed, %r\n.",
|
||||||
|
Status
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_CODE_END ();
|
DEBUG_CODE_END ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,6 +368,7 @@ ArpOnFrameSentDpc (
|
|||||||
if (EFI_ERROR (TxToken->Status)) {
|
if (EFI_ERROR (TxToken->Status)) {
|
||||||
DEBUG ((DEBUG_ERROR, "ArpOnFrameSent: TxToken->Status, %r.\n", TxToken->Status));
|
DEBUG ((DEBUG_ERROR, "ArpOnFrameSent: TxToken->Status, %r.\n", TxToken->Status));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_CODE_END ();
|
DEBUG_CODE_END ();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -396,7 +403,6 @@ ArpOnFrameSent (
|
|||||||
QueueDpc (TPL_CALLBACK, ArpOnFrameSentDpc, Context);
|
QueueDpc (TPL_CALLBACK, ArpOnFrameSentDpc, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the arp cache olding and drive the retrying arp requests.
|
Process the arp cache olding and drive the retrying arp requests.
|
||||||
|
|
||||||
@ -524,7 +530,6 @@ ArpTimerHandler (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Match the two NET_ARP_ADDRESSes.
|
Match the two NET_ARP_ADDRESSes.
|
||||||
|
|
||||||
@ -543,7 +548,8 @@ ArpMatchAddress (
|
|||||||
ASSERT (AddressOne != NULL && AddressTwo != NULL);
|
ASSERT (AddressOne != NULL && AddressTwo != NULL);
|
||||||
|
|
||||||
if ((AddressOne->Type != AddressTwo->Type) ||
|
if ((AddressOne->Type != AddressTwo->Type) ||
|
||||||
(AddressOne->Length != AddressTwo->Length)) {
|
(AddressOne->Length != AddressTwo->Length))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Either Type or Length doesn't match.
|
// Either Type or Length doesn't match.
|
||||||
//
|
//
|
||||||
@ -555,7 +561,8 @@ ArpMatchAddress (
|
|||||||
AddressOne->AddressPtr,
|
AddressOne->AddressPtr,
|
||||||
AddressTwo->AddressPtr,
|
AddressTwo->AddressPtr,
|
||||||
AddressOne->Length
|
AddressOne->Length
|
||||||
) != 0)) {
|
) != 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The address is not the same.
|
// The address is not the same.
|
||||||
//
|
//
|
||||||
@ -565,7 +572,6 @@ ArpMatchAddress (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the CacheEntry which matches the requirements in the specified CacheTable.
|
Find the CacheEntry which matches the requirements in the specified CacheTable.
|
||||||
|
|
||||||
@ -637,7 +643,6 @@ ArpFindNextCacheEntryInTable (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,
|
Find the CacheEntry, using ProtocolAddress or HardwareAddress or both, as the keyword,
|
||||||
in the DeniedCacheTable.
|
in the DeniedCacheTable.
|
||||||
@ -698,7 +703,6 @@ ArpFindDeniedCacheEntry (
|
|||||||
return CacheEntry;
|
return CacheEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate a cache entry and initialize it.
|
Allocate a cache entry and initialize it.
|
||||||
|
|
||||||
@ -765,7 +769,6 @@ ArpAllocCacheEntry (
|
|||||||
return CacheEntry;
|
return CacheEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Turn the CacheEntry into the resolved status.
|
Turn the CacheEntry into the resolved status.
|
||||||
|
|
||||||
@ -797,7 +800,8 @@ ArpAddressResolved (
|
|||||||
Context = NET_LIST_USER_STRUCT (Entry, USER_REQUEST_CONTEXT, List);
|
Context = NET_LIST_USER_STRUCT (Entry, USER_REQUEST_CONTEXT, List);
|
||||||
|
|
||||||
if (((Instance == NULL) || (Context->Instance == Instance)) &&
|
if (((Instance == NULL) || (Context->Instance == Instance)) &&
|
||||||
((UserEvent == NULL) || (Context->UserRequestEvent == UserEvent))) {
|
((UserEvent == NULL) || (Context->UserRequestEvent == UserEvent)))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Copy the address to the user-provided buffer and notify the user.
|
// Copy the address to the user-provided buffer and notify the user.
|
||||||
//
|
//
|
||||||
@ -826,7 +830,6 @@ ArpAddressResolved (
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fill the addresses in the CacheEntry using the information passed in by
|
Fill the addresses in the CacheEntry using the information passed in by
|
||||||
HwAddr and SwAddr.
|
HwAddr and SwAddr.
|
||||||
@ -881,7 +884,6 @@ ArpFillAddressInCacheEntry (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Configure the instance using the ConfigData. ConfigData is already validated.
|
Configure the instance using the ConfigData. ConfigData is already validated.
|
||||||
|
|
||||||
@ -912,7 +914,6 @@ ArpConfigureInstance (
|
|||||||
OldConfigData = &Instance->ConfigData;
|
OldConfigData = &Instance->ConfigData;
|
||||||
|
|
||||||
if (ConfigData != NULL) {
|
if (ConfigData != NULL) {
|
||||||
|
|
||||||
if (Instance->Configured) {
|
if (Instance->Configured) {
|
||||||
//
|
//
|
||||||
// The instance is configured, check the unchangeable fields.
|
// The instance is configured, check the unchangeable fields.
|
||||||
@ -923,7 +924,8 @@ ArpConfigureInstance (
|
|||||||
OldConfigData->StationAddress,
|
OldConfigData->StationAddress,
|
||||||
ConfigData->StationAddress,
|
ConfigData->StationAddress,
|
||||||
OldConfigData->SwAddressLength
|
OldConfigData->SwAddressLength
|
||||||
) != 0)) {
|
) != 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Deny the unallowed changes.
|
// Deny the unallowed changes.
|
||||||
//
|
//
|
||||||
@ -952,8 +954,11 @@ ArpConfigureInstance (
|
|||||||
|
|
||||||
OldConfigData->StationAddress = AllocatePool (OldConfigData->SwAddressLength);
|
OldConfigData->StationAddress = AllocatePool (OldConfigData->SwAddressLength);
|
||||||
if (OldConfigData->StationAddress == NULL) {
|
if (OldConfigData->StationAddress == NULL) {
|
||||||
DEBUG ((DEBUG_ERROR, "ArpConfigInstance: AllocatePool for the StationAddress "
|
DEBUG ((
|
||||||
"failed.\n"));
|
DEBUG_ERROR,
|
||||||
|
"ArpConfigInstance: AllocatePool for the StationAddress "
|
||||||
|
"failed.\n"
|
||||||
|
));
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,7 +1011,6 @@ ArpConfigureInstance (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send out an arp frame using the CacheEntry and the ArpOpCode.
|
Send out an arp frame using the CacheEntry and the ArpOpCode.
|
||||||
|
|
||||||
@ -1109,6 +1113,7 @@ ArpSendFrame (
|
|||||||
SnpMode->HwAddressSize
|
SnpMode->HwAddressSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TmpPtr += SnpMode->HwAddressSize;
|
TmpPtr += SnpMode->HwAddressSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1212,7 +1217,6 @@ CLEAN_EXIT:
|
|||||||
FreePool (TxToken);
|
FreePool (TxToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Delete the cache entries in the specified CacheTable, using the BySwAddress,
|
Delete the cache entries in the specified CacheTable, using the BySwAddress,
|
||||||
SwAddressType, AddressBuffer combination as the matching key, if Force is TRUE,
|
SwAddressType, AddressBuffer combination as the matching key, if Force is TRUE,
|
||||||
@ -1265,7 +1269,8 @@ ArpDeleteCacheEntryInTable (
|
|||||||
AddressBuffer,
|
AddressBuffer,
|
||||||
CacheEntry->Addresses[Protocol].AddressPtr,
|
CacheEntry->Addresses[Protocol].AddressPtr,
|
||||||
CacheEntry->Addresses[Protocol].Length
|
CacheEntry->Addresses[Protocol].Length
|
||||||
) == 0)) {
|
) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Address matched.
|
// Address matched.
|
||||||
//
|
//
|
||||||
@ -1278,7 +1283,8 @@ ArpDeleteCacheEntryInTable (
|
|||||||
AddressBuffer,
|
AddressBuffer,
|
||||||
CacheEntry->Addresses[Hardware].AddressPtr,
|
CacheEntry->Addresses[Hardware].AddressPtr,
|
||||||
CacheEntry->Addresses[Hardware].Length
|
CacheEntry->Addresses[Hardware].Length
|
||||||
) == 0)) {
|
) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Address matched.
|
// Address matched.
|
||||||
//
|
//
|
||||||
@ -1303,7 +1309,6 @@ MATCHED:
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Delete cache entries in all the cache tables.
|
Delete cache entries in all the cache tables.
|
||||||
|
|
||||||
@ -1357,7 +1362,6 @@ ArpDeleteCacheEntry (
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cancel the arp request.
|
Cancel the arp request.
|
||||||
|
|
||||||
@ -1396,7 +1400,8 @@ ArpCancelRequest (
|
|||||||
TargetSwAddress,
|
TargetSwAddress,
|
||||||
CacheEntry->Addresses[Protocol].AddressPtr,
|
CacheEntry->Addresses[Protocol].AddressPtr,
|
||||||
CacheEntry->Addresses[Protocol].Length
|
CacheEntry->Addresses[Protocol].Length
|
||||||
) == 0)) {
|
) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// This request entry matches the TargetSwAddress or all requests are to be
|
// This request entry matches the TargetSwAddress or all requests are to be
|
||||||
// cancelled as TargetSwAddress is NULL.
|
// cancelled as TargetSwAddress is NULL.
|
||||||
@ -1416,7 +1421,6 @@ ArpCancelRequest (
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the cache entry in the cache table.
|
Find the cache entry in the cache table.
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef _ARP_IMPL_H_
|
#ifndef _ARP_IMPL_H_
|
||||||
#define _ARP_IMPL_H_
|
#define _ARP_IMPL_H_
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <Protocol/Arp.h>
|
#include <Protocol/Arp.h>
|
||||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "ArpImpl.h"
|
#include "ArpImpl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to assign a station address to the ARP cache for this instance
|
This function is used to assign a station address to the ARP cache for this instance
|
||||||
of the ARP driver.
|
of the ARP driver.
|
||||||
@ -55,7 +54,8 @@ ArpConfigure (
|
|||||||
if ((ConfigData != NULL) &&
|
if ((ConfigData != NULL) &&
|
||||||
((ConfigData->SwAddressLength == 0) ||
|
((ConfigData->SwAddressLength == 0) ||
|
||||||
(ConfigData->StationAddress == NULL) ||
|
(ConfigData->StationAddress == NULL) ||
|
||||||
(ConfigData->SwAddressType <= 1500))) {
|
(ConfigData->SwAddressType <= 1500)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,6 @@ ArpConfigure (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is used to insert entries into the ARP cache.
|
This function is used to insert entries into the ARP cache.
|
||||||
|
|
||||||
@ -144,7 +143,8 @@ ArpAdd (
|
|||||||
|
|
||||||
if (((!DenyFlag) && ((TargetHwAddress == NULL) || (TargetSwAddress == NULL))) ||
|
if (((!DenyFlag) && ((TargetHwAddress == NULL) || (TargetSwAddress == NULL))) ||
|
||||||
(DenyFlag && (TargetHwAddress != NULL) && (TargetSwAddress != NULL)) ||
|
(DenyFlag && (TargetHwAddress != NULL) && (TargetSwAddress != NULL)) ||
|
||||||
((TargetHwAddress == NULL) && (TargetSwAddress == NULL))) {
|
((TargetHwAddress == NULL) && (TargetSwAddress == NULL)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,6 @@ UNLOCK_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function searches the ARP cache for matching entries and allocates a buffer into
|
This function searches the ARP cache for matching entries and allocates a buffer into
|
||||||
which those entries are copied.
|
which those entries are copied.
|
||||||
@ -324,7 +323,8 @@ ArpFind (
|
|||||||
|
|
||||||
if ((This == NULL) ||
|
if ((This == NULL) ||
|
||||||
(!Refresh && (EntryCount == NULL) && (EntryLength == NULL)) ||
|
(!Refresh && (EntryCount == NULL) && (EntryLength == NULL)) ||
|
||||||
((Entries != NULL) && ((EntryLength == NULL) || (EntryCount == NULL)))) {
|
((Entries != NULL) && ((EntryLength == NULL) || (EntryCount == NULL))))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +354,6 @@ ArpFind (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function removes specified ARP cache entries.
|
This function removes specified ARP cache entries.
|
||||||
|
|
||||||
@ -406,7 +405,6 @@ ArpDelete (
|
|||||||
return (Count == 0) ? EFI_NOT_FOUND : EFI_SUCCESS;
|
return (Count == 0) ? EFI_NOT_FOUND : EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function delete all dynamic entries from the ARP cache that match the specified
|
This function delete all dynamic entries from the ARP cache that match the specified
|
||||||
software protocol type.
|
software protocol type.
|
||||||
@ -451,7 +449,6 @@ ArpFlush (
|
|||||||
return (Count == 0) ? EFI_NOT_FOUND : EFI_SUCCESS;
|
return (Count == 0) ? EFI_NOT_FOUND : EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function tries to resolve the TargetSwAddress and optionally returns a
|
This function tries to resolve the TargetSwAddress and optionally returns a
|
||||||
TargetHwAddress if it already exists in the ARP cache.
|
TargetHwAddress if it already exists in the ARP cache.
|
||||||
@ -509,7 +506,8 @@ ArpRequest (
|
|||||||
|
|
||||||
if ((TargetSwAddress == NULL) ||
|
if ((TargetSwAddress == NULL) ||
|
||||||
((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) &&
|
((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) &&
|
||||||
IP4_IS_LOCAL_BROADCAST (*((UINT32 *)TargetSwAddress)))) {
|
IP4_IS_LOCAL_BROADCAST (*((UINT32 *)TargetSwAddress))))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Return the hardware broadcast address.
|
// Return the hardware broadcast address.
|
||||||
//
|
//
|
||||||
@ -519,7 +517,8 @@ ArpRequest (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) &&
|
if ((Instance->ConfigData.SwAddressType == IPV4_ETHER_PROTO_TYPE) &&
|
||||||
IP4_IS_MULTICAST (NTOHL (*((UINT32 *)TargetSwAddress)))) {
|
IP4_IS_MULTICAST (NTOHL (*((UINT32 *)TargetSwAddress))))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// If the software address is an IPv4 multicast address, invoke Mnp to
|
// If the software address is an IPv4 multicast address, invoke Mnp to
|
||||||
// resolve the address.
|
// resolve the address.
|
||||||
@ -612,7 +611,6 @@ ArpRequest (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (CacheEntry != NULL) {
|
if (CacheEntry != NULL) {
|
||||||
|
|
||||||
CacheEntry->NextRetryTime = Instance->ConfigData.RetryTimeOut;
|
CacheEntry->NextRetryTime = Instance->ConfigData.RetryTimeOut;
|
||||||
CacheEntry->RetryCount = Instance->ConfigData.RetryCount;
|
CacheEntry->RetryCount = Instance->ConfigData.RetryCount;
|
||||||
} else {
|
} else {
|
||||||
@ -668,7 +666,6 @@ SIGNAL_USER:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function aborts the previous ARP request (identified by This, TargetSwAddress
|
This function aborts the previous ARP request (identified by This, TargetSwAddress
|
||||||
and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().
|
and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().
|
||||||
@ -710,7 +707,8 @@ ArpCancel (
|
|||||||
|
|
||||||
if ((This == NULL) ||
|
if ((This == NULL) ||
|
||||||
((TargetSwAddress != NULL) && (ResolvedEvent == NULL)) ||
|
((TargetSwAddress != NULL) && (ResolvedEvent == NULL)) ||
|
||||||
((TargetSwAddress == NULL) && (ResolvedEvent != NULL))) {
|
((TargetSwAddress == NULL) && (ResolvedEvent != NULL)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "ArpDriver.h"
|
#include "ArpDriver.h"
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
@ -27,7 +26,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2 =
|
|||||||
"en"
|
"en"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mArpDriverNameTable[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mArpDriverNameTable[] = {
|
||||||
{ "eng;en", L"ARP Network Service Driver" },
|
{ "eng;en", L"ARP Network Service Driver" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
|
@ -5,12 +5,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Dhcp4Impl.h"
|
#include "Dhcp4Impl.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
@ -58,7 +58,6 @@ DhcpComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -137,7 +136,6 @@ DhcpComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
@ -156,7 +154,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDhcp4ComponentName2
|
|||||||
"en"
|
"en"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDhcpDriverNameTable[] = {
|
||||||
{
|
{
|
||||||
"eng;en",
|
"eng;en",
|
||||||
|
@ -53,7 +53,6 @@ Dhcp4DriverEntryPoint (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test to see if this driver supports ControllerHandle. This service
|
Test to see if this driver supports ControllerHandle. This service
|
||||||
is called by the EFI boot service ConnectController(). In
|
is called by the EFI boot service ConnectController(). In
|
||||||
@ -94,8 +93,6 @@ Dhcp4DriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Configure the default UDP child to receive all the DHCP traffics
|
Configure the default UDP child to receive all the DHCP traffics
|
||||||
on this network interface.
|
on this network interface.
|
||||||
@ -134,11 +131,9 @@ DhcpConfigUdpIo (
|
|||||||
ZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
ZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||||
ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
|
||||||
return UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfigData);;
|
return UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfigData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy the DHCP service. The Dhcp4 service may be partly initialized,
|
Destroy the DHCP service. The Dhcp4 service may be partly initialized,
|
||||||
or partly destroyed. If a resource is destroyed, it is marked as so in
|
or partly destroyed. If a resource is destroyed, it is marked as so in
|
||||||
@ -171,8 +166,6 @@ Dhcp4CloseService (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new DHCP service binding instance for the controller.
|
Create a new DHCP service binding instance for the controller.
|
||||||
|
|
||||||
@ -258,7 +251,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start this driver on ControllerHandle. This service is called by the
|
Start this driver on ControllerHandle. This service is called by the
|
||||||
EFI boot service ConnectController(). In order to make
|
EFI boot service ConnectController(). In order to make
|
||||||
@ -309,6 +301,7 @@ Dhcp4DriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (DhcpSb != NULL);
|
ASSERT (DhcpSb != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -319,6 +312,7 @@ Dhcp4DriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->SetTimer (DhcpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);
|
Status = gBS->SetTimer (DhcpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -367,7 +361,7 @@ Dhcp4DestroyChildEntry (
|
|||||||
DHCP_PROTOCOL *Instance;
|
DHCP_PROTOCOL *Instance;
|
||||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||||
|
|
||||||
if (Entry == NULL || Context == NULL) {
|
if ((Entry == NULL) || (Context == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +371,6 @@ Dhcp4DestroyChildEntry (
|
|||||||
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
|
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stop this driver on ControllerHandle. This service is called by the
|
Stop this driver on ControllerHandle. This service is called by the
|
||||||
EFI boot service DisconnectController(). In order to
|
EFI boot service DisconnectController(). In order to
|
||||||
@ -447,16 +440,16 @@ Dhcp4DriverBindingStop (
|
|||||||
ServiceBinding,
|
ServiceBinding,
|
||||||
&ListLength
|
&ListLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || ListLength != 0) {
|
if (EFI_ERROR (Status) || (ListLength != 0)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberOfChildren == 0 && !IsListEmpty (&DhcpSb->Children)) {
|
if ((NumberOfChildren == 0) && !IsListEmpty (&DhcpSb->Children)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberOfChildren == 0 && IsListEmpty (&DhcpSb->Children)) {
|
if ((NumberOfChildren == 0) && IsListEmpty (&DhcpSb->Children)) {
|
||||||
//
|
//
|
||||||
// Destroy the service itself if no child instance left.
|
// Destroy the service itself if no child instance left.
|
||||||
//
|
//
|
||||||
@ -474,6 +467,7 @@ Dhcp4DriverBindingStop (
|
|||||||
FreeUnicodeStringTable (gDhcpControllerNameTable);
|
FreeUnicodeStringTable (gDhcpControllerNameTable);
|
||||||
gDhcpControllerNameTable = NULL;
|
gDhcpControllerNameTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (DhcpSb);
|
FreePool (DhcpSb);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
@ -482,7 +476,6 @@ Dhcp4DriverBindingStop (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize a new DHCP instance.
|
Initialize a new DHCP instance.
|
||||||
|
|
||||||
@ -510,7 +503,6 @@ DhcpInitProtocol (
|
|||||||
NetbufQueInit (&Instance->ResponseQueue);
|
NetbufQueInit (&Instance->ResponseQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a child handle and installs a protocol.
|
Creates a child handle and installs a protocol.
|
||||||
|
|
||||||
@ -606,7 +598,6 @@ Dhcp4ServiceBindingCreateChild (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroys a child handle with a protocol installed on it.
|
Destroys a child handle with a protocol installed on it.
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Dhcp4Impl.h"
|
#include "Dhcp4Impl.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -404,7 +403,6 @@ EfiDhcp4GetModeData (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free the resource related to the configure parameters.
|
Free the resource related to the configure parameters.
|
||||||
DHCP driver will make a copy of the user's configure
|
DHCP driver will make a copy of the user's configure
|
||||||
@ -441,7 +439,6 @@ DhcpCleanConfigure (
|
|||||||
ZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
|
ZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate memory for configure parameter such as timeout value for Dst,
|
Allocate memory for configure parameter such as timeout value for Dst,
|
||||||
then copy the configure parameter from Src to Dst.
|
then copy the configure parameter from Src to Dst.
|
||||||
@ -536,7 +533,6 @@ ON_ERROR:
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Give up the control of the DHCP service to let other child
|
Give up the control of the DHCP service to let other child
|
||||||
resume. Don't change the service's DHCP state and the Client
|
resume. Don't change the service's DHCP state and the Client
|
||||||
@ -575,7 +571,6 @@ DhcpYieldControl (
|
|||||||
Config->CallbackContext = NULL;
|
Config->CallbackContext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
|
Initializes, changes, or resets the operational settings for the EFI DHCPv4 Protocol driver.
|
||||||
|
|
||||||
@ -675,8 +670,8 @@ EfiDhcp4Configure (
|
|||||||
if ((DhcpSb->DhcpState != Dhcp4Stopped) &&
|
if ((DhcpSb->DhcpState != Dhcp4Stopped) &&
|
||||||
(DhcpSb->DhcpState != Dhcp4Init) &&
|
(DhcpSb->DhcpState != Dhcp4Init) &&
|
||||||
(DhcpSb->DhcpState != Dhcp4InitReboot) &&
|
(DhcpSb->DhcpState != Dhcp4InitReboot) &&
|
||||||
(DhcpSb->DhcpState != Dhcp4Bound)) {
|
(DhcpSb->DhcpState != Dhcp4Bound))
|
||||||
|
{
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +707,6 @@ EfiDhcp4Configure (
|
|||||||
|
|
||||||
DhcpSb->ServiceState = DHCP_CONFIGED;
|
DhcpSb->ServiceState = DHCP_CONFIGED;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
} else if (DhcpSb->ActiveChild == Instance) {
|
} else if (DhcpSb->ActiveChild == Instance) {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
DhcpYieldControl (DhcpSb);
|
DhcpYieldControl (DhcpSb);
|
||||||
@ -723,7 +717,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts the DHCP configuration process.
|
Starts the DHCP configuration process.
|
||||||
|
|
||||||
@ -820,7 +813,6 @@ EfiDhcp4Start (
|
|||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Instance->CompletionEvent = CompletionEvent;
|
Instance->CompletionEvent = CompletionEvent;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -843,7 +835,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extends the lease time by sending a request packet.
|
Extends the lease time by sending a request packet.
|
||||||
|
|
||||||
@ -963,7 +954,6 @@ EfiDhcp4RenewRebind (
|
|||||||
if (CompletionEvent == NULL) {
|
if (CompletionEvent == NULL) {
|
||||||
while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {
|
while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {
|
||||||
DhcpSb->UdpIo->Protocol.Udp4->Poll (DhcpSb->UdpIo->Protocol.Udp4);
|
DhcpSb->UdpIo->Protocol.Udp4->Poll (DhcpSb->UdpIo->Protocol.Udp4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DhcpSb->IoStatus;
|
return DhcpSb->IoStatus;
|
||||||
@ -976,7 +966,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Releases the current address configuration.
|
Releases the current address configuration.
|
||||||
|
|
||||||
@ -1053,7 +1042,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stops the current address configuration.
|
Stops the current address configuration.
|
||||||
|
|
||||||
@ -1104,7 +1092,6 @@ EfiDhcp4Stop (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Builds a DHCP packet, given the options to be appended or deleted or replaced.
|
Builds a DHCP packet, given the options to be appended or deleted or replaced.
|
||||||
|
|
||||||
@ -1152,15 +1139,15 @@ EfiDhcp4Build (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((SeedPacket == NULL) || (SeedPacket->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||
|
if ((SeedPacket == NULL) || (SeedPacket->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||
|
||||||
EFI_ERROR (DhcpValidateOptions (SeedPacket, NULL))) {
|
EFI_ERROR (DhcpValidateOptions (SeedPacket, NULL)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((DeleteCount == 0) && (AppendCount == 0)) ||
|
if (((DeleteCount == 0) && (AppendCount == 0)) ||
|
||||||
((DeleteCount != 0) && (DeleteList == NULL)) ||
|
((DeleteCount != 0) && (DeleteList == NULL)) ||
|
||||||
((AppendCount != 0) && (AppendList == NULL))) {
|
((AppendCount != 0) && (AppendList == NULL)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1293,6 +1280,7 @@ Dhcp4InstanceCreateUdpIo (
|
|||||||
UdpIoFreeIo (Instance->UdpIo);
|
UdpIoFreeIo (Instance->UdpIo);
|
||||||
Instance->UdpIo = NULL;
|
Instance->UdpIo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1386,7 +1374,8 @@ PxeDhcpInput (
|
|||||||
//
|
//
|
||||||
if ((Head->OpCode != BOOTP_REPLY) ||
|
if ((Head->OpCode != BOOTP_REPLY) ||
|
||||||
(Head->Xid != Token->Packet->Dhcp4.Header.Xid) ||
|
(Head->Xid != Token->Packet->Dhcp4.Header.Xid) ||
|
||||||
(CompareMem (&Token->Packet->Dhcp4.Header.ClientHwAddr[0], Head->ClientHwAddr, Head->HwAddrLen) != 0)) {
|
(CompareMem (&Token->Packet->Dhcp4.Header.ClientHwAddr[0], Head->ClientHwAddr, Head->HwAddrLen) != 0))
|
||||||
|
{
|
||||||
goto RESTART;
|
goto RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1395,8 +1384,8 @@ PxeDhcpInput (
|
|||||||
//
|
//
|
||||||
if ((Packet->Length > sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32)) &&
|
if ((Packet->Length > sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32)) &&
|
||||||
(Packet->Dhcp4.Magik == DHCP_OPTION_MAGIC) &&
|
(Packet->Dhcp4.Magik == DHCP_OPTION_MAGIC) &&
|
||||||
EFI_ERROR (DhcpValidateOptions (Packet, NULL))) {
|
EFI_ERROR (DhcpValidateOptions (Packet, NULL)))
|
||||||
|
{
|
||||||
goto RESTART;
|
goto RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1474,7 +1463,6 @@ SIGNAL_USER:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Transmits a DHCP formatted packet and optionally waits for responses.
|
Transmits a DHCP formatted packet and optionally waits for responses.
|
||||||
|
|
||||||
@ -1532,7 +1520,8 @@ EfiDhcp4TransmitReceive (
|
|||||||
((Token->ListenPointCount != 0) && (Token->ListenPoints == NULL)) ||
|
((Token->ListenPointCount != 0) && (Token->ListenPoints == NULL)) ||
|
||||||
EFI_ERROR (DhcpValidateOptions (Token->Packet, NULL)) ||
|
EFI_ERROR (DhcpValidateOptions (Token->Packet, NULL)) ||
|
||||||
EFI_IP4_EQUAL (&Token->RemoteAddress, &mZeroIp4Addr)
|
EFI_IP4_EQUAL (&Token->RemoteAddress, &mZeroIp4Addr)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The DHCP packet isn't well-formed, the Transaction ID is already used,
|
// The DHCP packet isn't well-formed, the Transaction ID is already used,
|
||||||
// the timeout value is zero, the ListenPoint is invalid, or the
|
// the timeout value is zero, the ListenPoint is invalid, or the
|
||||||
@ -1667,7 +1656,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function for DhcpIterateOptions. This callback sets the
|
Callback function for DhcpIterateOptions. This callback sets the
|
||||||
EFI_DHCP4_PACKET_OPTION array in the DHCP_PARSE_CONTEXT to point
|
EFI_DHCP4_PACKET_OPTION array in the DHCP_PARSE_CONTEXT to point
|
||||||
@ -1706,7 +1694,6 @@ Dhcp4ParseCheckOption (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parses the packed DHCP option data.
|
Parses the packed DHCP option data.
|
||||||
|
|
||||||
@ -1755,8 +1742,8 @@ EfiDhcp4Parse (
|
|||||||
|
|
||||||
if ((Packet->Size < Packet->Length + 2 * sizeof (UINT32)) ||
|
if ((Packet->Size < Packet->Length + 2 * sizeof (UINT32)) ||
|
||||||
(Packet->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||
|
(Packet->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||
|
||||||
EFI_ERROR (DhcpValidateOptions (Packet, NULL))) {
|
EFI_ERROR (DhcpValidateOptions (Packet, NULL)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef __EFI_DHCP4_IMPL_H__
|
#ifndef __EFI_DHCP4_IMPL_H__
|
||||||
#define __EFI_DHCP4_IMPL_H__
|
#define __EFI_DHCP4_IMPL_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <Protocol/Dhcp4.h>
|
#include <Protocol/Dhcp4.h>
|
||||||
@ -50,7 +48,6 @@ typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
|
|||||||
#define DHCP_CONFIGED 1
|
#define DHCP_CONFIGED 1
|
||||||
#define DHCP_DESTROY 2
|
#define DHCP_DESTROY 2
|
||||||
|
|
||||||
|
|
||||||
struct _DHCP_PROTOCOL {
|
struct _DHCP_PROTOCOL {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
EFI_DHCP4_PROTOCOL Dhcp4Protocol;
|
EFI_DHCP4_PROTOCOL Dhcp4Protocol;
|
||||||
|
@ -6,12 +6,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "Dhcp4Impl.h"
|
#include "Dhcp4Impl.h"
|
||||||
|
|
||||||
UINT32 mDhcp4DefaultTimeout[4] = { 4, 8, 16, 32 };
|
UINT32 mDhcp4DefaultTimeout[4] = { 4, 8, 16, 32 };
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send an initial DISCOVER or REQUEST message according to the
|
Send an initial DISCOVER or REQUEST message according to the
|
||||||
DHCP service's current state.
|
DHCP service's current state.
|
||||||
@ -57,7 +55,6 @@ DhcpInitRequest (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call user provided callback function, and return the value the
|
Call user provided callback function, and return the value the
|
||||||
function returns. If the user doesn't provide a callback, a
|
function returns. If the user doesn't provide a callback, a
|
||||||
@ -127,7 +124,6 @@ DhcpCallUser (
|
|||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Notify the user about the operation result.
|
Notify the user about the operation result.
|
||||||
|
|
||||||
@ -149,23 +145,21 @@ DhcpNotifyUser (
|
|||||||
|
|
||||||
if ((Child->CompletionEvent != NULL) &&
|
if ((Child->CompletionEvent != NULL) &&
|
||||||
((Which == DHCP_NOTIFY_COMPLETION) || (Which == DHCP_NOTIFY_ALL))
|
((Which == DHCP_NOTIFY_COMPLETION) || (Which == DHCP_NOTIFY_ALL))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
gBS->SignalEvent (Child->CompletionEvent);
|
gBS->SignalEvent (Child->CompletionEvent);
|
||||||
Child->CompletionEvent = NULL;
|
Child->CompletionEvent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Child->RenewRebindEvent != NULL) &&
|
if ((Child->RenewRebindEvent != NULL) &&
|
||||||
((Which == DHCP_NOTIFY_RENEWREBIND) || (Which == DHCP_NOTIFY_ALL))
|
((Which == DHCP_NOTIFY_RENEWREBIND) || (Which == DHCP_NOTIFY_ALL))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
gBS->SignalEvent (Child->RenewRebindEvent);
|
gBS->SignalEvent (Child->RenewRebindEvent);
|
||||||
Child->RenewRebindEvent = NULL;
|
Child->RenewRebindEvent = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the DHCP state. If CallUser is true, it will try to notify
|
Set the DHCP state. If CallUser is true, it will try to notify
|
||||||
the user before change the state by DhcpNotifyUser. It returns
|
the user before change the state by DhcpNotifyUser. It returns
|
||||||
@ -195,13 +189,10 @@ DhcpSetState (
|
|||||||
|
|
||||||
if (State == Dhcp4Renewing) {
|
if (State == Dhcp4Renewing) {
|
||||||
Status = DhcpCallUser (DhcpSb, Dhcp4EnterRenewing, NULL, NULL);
|
Status = DhcpCallUser (DhcpSb, Dhcp4EnterRenewing, NULL, NULL);
|
||||||
|
|
||||||
} else if (State == Dhcp4Rebinding) {
|
} else if (State == Dhcp4Rebinding) {
|
||||||
Status = DhcpCallUser (DhcpSb, Dhcp4EnterRebinding, NULL, NULL);
|
Status = DhcpCallUser (DhcpSb, Dhcp4EnterRebinding, NULL, NULL);
|
||||||
|
|
||||||
} else if (State == Dhcp4Bound) {
|
} else if (State == Dhcp4Bound) {
|
||||||
Status = DhcpCallUser (DhcpSb, Dhcp4BoundCompleted, NULL, NULL);
|
Status = DhcpCallUser (DhcpSb, Dhcp4BoundCompleted, NULL, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -231,7 +222,6 @@ DhcpSetState (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the retransmit timer for the packet. It will select from either
|
Set the retransmit timer for the packet. It will select from either
|
||||||
the discover timeouts/request timeouts or the default timeout values.
|
the discover timeouts/request timeouts or the default timeout values.
|
||||||
@ -298,7 +288,6 @@ DhcpComputeLease (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Configure a UDP IO port to use the acquired lease address.
|
Configure a UDP IO port to use the acquired lease address.
|
||||||
DHCP driver needs this port to unicast packet to the server
|
DHCP driver needs this port to unicast packet to the server
|
||||||
@ -370,7 +359,6 @@ DhcpConfigLeaseIoPort (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the lease states when a new lease is acquired. It will not only
|
Update the lease states when a new lease is acquired. It will not only
|
||||||
save the acquired the address and lease time, it will also create a UDP
|
save the acquired the address and lease time, it will also create a UDP
|
||||||
@ -426,7 +414,6 @@ DhcpLeaseAcquired (
|
|||||||
return DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);
|
return DhcpSetState (DhcpSb, Dhcp4Bound, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the DHCP related states, IoStatus isn't reset.
|
Clean up the DHCP related states, IoStatus isn't reset.
|
||||||
|
|
||||||
@ -486,7 +473,6 @@ DhcpCleanLease (
|
|||||||
DhcpCleanConfigure (&DhcpSb->ActiveConfig);
|
DhcpCleanConfigure (&DhcpSb->ActiveConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Select a offer among all the offers collected. If the offer selected is
|
Select a offer among all the offers collected. If the offer selected is
|
||||||
of BOOTP, the lease is recorded and user notified. If the offer is of
|
of BOOTP, the lease is recorded and user notified. If the offer is of
|
||||||
@ -565,7 +551,6 @@ DhcpChooseOffer (
|
|||||||
return DhcpSendMessage (DhcpSb, Selected, DhcpSb->Para, DHCP_MSG_REQUEST, NULL);
|
return DhcpSendMessage (DhcpSb, Selected, DhcpSb->Para, DHCP_MSG_REQUEST, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Terminate the current address acquire. All the allocated resources
|
Terminate the current address acquire. All the allocated resources
|
||||||
are released. Be careful when calling this function. A rule related
|
are released. Be careful when calling this function. A rule related
|
||||||
@ -594,7 +579,6 @@ DhcpEndSession (
|
|||||||
DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_ALL);
|
DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle packets in DHCP select state.
|
Handle packets in DHCP select state.
|
||||||
|
|
||||||
@ -626,7 +610,8 @@ DhcpHandleSelect (
|
|||||||
//
|
//
|
||||||
if (!DHCP_IS_BOOTP (Para) &&
|
if (!DHCP_IS_BOOTP (Para) &&
|
||||||
((Para->DhcpType != DHCP_MSG_OFFER) || (Para->ServerId == 0))
|
((Para->DhcpType != DHCP_MSG_OFFER) || (Para->ServerId == 0))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,14 +631,12 @@ DhcpHandleSelect (
|
|||||||
DhcpSb->LastOffer = Packet;
|
DhcpSb->LastOffer = Packet;
|
||||||
|
|
||||||
return DhcpChooseOffer (DhcpSb);
|
return DhcpChooseOffer (DhcpSb);
|
||||||
|
|
||||||
} else if (Status == EFI_NOT_READY) {
|
} else if (Status == EFI_NOT_READY) {
|
||||||
if (DhcpSb->LastOffer != NULL) {
|
if (DhcpSb->LastOffer != NULL) {
|
||||||
FreePool (DhcpSb->LastOffer);
|
FreePool (DhcpSb->LastOffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
DhcpSb->LastOffer = Packet;
|
DhcpSb->LastOffer = Packet;
|
||||||
|
|
||||||
} else if (Status == EFI_ABORTED) {
|
} else if (Status == EFI_ABORTED) {
|
||||||
//
|
//
|
||||||
// DhcpInput will end the session upon error return. Remember
|
// DhcpInput will end the session upon error return. Remember
|
||||||
@ -669,7 +652,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle packets in DHCP request state.
|
Handle packets in DHCP request state.
|
||||||
|
|
||||||
@ -705,8 +687,8 @@ DhcpHandleRequest (
|
|||||||
if (DHCP_IS_BOOTP (Para) ||
|
if (DHCP_IS_BOOTP (Para) ||
|
||||||
(Para->ServerId != DhcpSb->Para->ServerId) ||
|
(Para->ServerId != DhcpSb->Para->ServerId) ||
|
||||||
((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))
|
((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -762,7 +744,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle packets in DHCP renew/rebound state.
|
Handle packets in DHCP renew/rebound state.
|
||||||
|
|
||||||
@ -797,8 +778,8 @@ DhcpHandleRenewRebind (
|
|||||||
if (DHCP_IS_BOOTP (Para) ||
|
if (DHCP_IS_BOOTP (Para) ||
|
||||||
(Para->ServerId != DhcpSb->Para->ServerId) ||
|
(Para->ServerId != DhcpSb->Para->ServerId) ||
|
||||||
((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))
|
((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -846,7 +827,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle packets in DHCP reboot state.
|
Handle packets in DHCP reboot state.
|
||||||
|
|
||||||
@ -876,8 +856,8 @@ DhcpHandleReboot (
|
|||||||
//
|
//
|
||||||
if (DHCP_IS_BOOTP (Para) ||
|
if (DHCP_IS_BOOTP (Para) ||
|
||||||
((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))
|
((Para->DhcpType != DHCP_MSG_ACK) && (Para->DhcpType != DHCP_MSG_NAK))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -932,7 +912,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle the received DHCP packets. This function drives the DHCP
|
Handle the received DHCP packets. This function drives the DHCP
|
||||||
state machine.
|
state machine.
|
||||||
@ -1008,7 +987,8 @@ DhcpInput (
|
|||||||
//
|
//
|
||||||
if ((Head->OpCode != BOOTP_REPLY) ||
|
if ((Head->OpCode != BOOTP_REPLY) ||
|
||||||
(NTOHL (Head->Xid) != DhcpSb->Xid) ||
|
(NTOHL (Head->Xid) != DhcpSb->Xid) ||
|
||||||
(CompareMem (DhcpSb->ClientAddressSendOut, Head->ClientHwAddr, Head->HwAddrLen) != 0)) {
|
(CompareMem (DhcpSb->ClientAddressSendOut, Head->ClientHwAddr, Head->HwAddrLen) != 0))
|
||||||
|
{
|
||||||
goto RESTART;
|
goto RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,8 +998,8 @@ DhcpInput (
|
|||||||
Para = NULL;
|
Para = NULL;
|
||||||
if ((Packet->Length > sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32)) &&
|
if ((Packet->Length > sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32)) &&
|
||||||
(Packet->Dhcp4.Magik == DHCP_OPTION_MAGIC) &&
|
(Packet->Dhcp4.Magik == DHCP_OPTION_MAGIC) &&
|
||||||
EFI_ERROR (DhcpValidateOptions (Packet, &Para))) {
|
EFI_ERROR (DhcpValidateOptions (Packet, &Para)))
|
||||||
|
{
|
||||||
goto RESTART;
|
goto RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1111,8 +1091,6 @@ DhcpOnPacketSent (
|
|||||||
NetbufFree (Packet);
|
NetbufFree (Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Build and transmit a DHCP message according to the current states.
|
Build and transmit a DHCP message according to the current states.
|
||||||
This function implement the Table 5. of RFC 2131. Always transits
|
This function implement the Table 5. of RFC 2131. Always transits
|
||||||
@ -1223,8 +1201,8 @@ DhcpSendMessage (
|
|||||||
//
|
//
|
||||||
if ((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE) ||
|
if ((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE) ||
|
||||||
((Type == DHCP_MSG_REQUEST) && (DhcpSb->DhcpState == Dhcp4Requesting))
|
((Type == DHCP_MSG_REQUEST) && (DhcpSb->DhcpState == Dhcp4Requesting))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
ASSERT ((Para != NULL) && (Para->ServerId != 0));
|
ASSERT ((Para != NULL) && (Para->ServerId != 0));
|
||||||
|
|
||||||
IpAddr = HTONL (Para->ServerId);
|
IpAddr = HTONL (Para->ServerId);
|
||||||
@ -1242,12 +1220,10 @@ DhcpSendMessage (
|
|||||||
if (Type == DHCP_MSG_REQUEST) {
|
if (Type == DHCP_MSG_REQUEST) {
|
||||||
if (DhcpSb->DhcpState == Dhcp4Rebooting) {
|
if (DhcpSb->DhcpState == Dhcp4Rebooting) {
|
||||||
IpAddr = EFI_IP4 (Config->ClientAddress);
|
IpAddr = EFI_IP4 (Config->ClientAddress);
|
||||||
|
|
||||||
} else if (DhcpSb->DhcpState == Dhcp4Requesting) {
|
} else if (DhcpSb->DhcpState == Dhcp4Requesting) {
|
||||||
ASSERT (SeedHead != NULL);
|
ASSERT (SeedHead != NULL);
|
||||||
IpAddr = EFI_IP4 (SeedHead->YourAddr);
|
IpAddr = EFI_IP4 (SeedHead->YourAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (Type == DHCP_MSG_DECLINE) {
|
} else if (Type == DHCP_MSG_DECLINE) {
|
||||||
ASSERT (SeedHead != NULL);
|
ASSERT (SeedHead != NULL);
|
||||||
IpAddr = EFI_IP4 (SeedHead->YourAddr);
|
IpAddr = EFI_IP4 (SeedHead->YourAddr);
|
||||||
@ -1285,7 +1261,8 @@ DhcpSendMessage (
|
|||||||
// if it is a DHCP decline or DHCP release .
|
// if it is a DHCP decline or DHCP release .
|
||||||
//
|
//
|
||||||
if (((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE)) &&
|
if (((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE)) &&
|
||||||
(Config->OptionList[Index]->OpCode != DHCP4_TAG_CLIENT_ID)) {
|
(Config->OptionList[Index]->OpCode != DHCP4_TAG_CLIENT_ID))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1309,10 +1286,8 @@ DhcpSendMessage (
|
|||||||
|
|
||||||
if (Type == DHCP_MSG_DISCOVER) {
|
if (Type == DHCP_MSG_DISCOVER) {
|
||||||
Status = DhcpCallUser (DhcpSb, Dhcp4SendDiscover, Packet, &NewPacket);
|
Status = DhcpCallUser (DhcpSb, Dhcp4SendDiscover, Packet, &NewPacket);
|
||||||
|
|
||||||
} else if (Type == DHCP_MSG_REQUEST) {
|
} else if (Type == DHCP_MSG_REQUEST) {
|
||||||
Status = DhcpCallUser (DhcpSb, Dhcp4SendRequest, Packet, &NewPacket);
|
Status = DhcpCallUser (DhcpSb, Dhcp4SendRequest, Packet, &NewPacket);
|
||||||
|
|
||||||
} else if (Type == DHCP_MSG_DECLINE) {
|
} else if (Type == DHCP_MSG_DECLINE) {
|
||||||
Status = DhcpCallUser (DhcpSb, Dhcp4SendDecline, Packet, &NewPacket);
|
Status = DhcpCallUser (DhcpSb, Dhcp4SendDecline, Packet, &NewPacket);
|
||||||
}
|
}
|
||||||
@ -1393,7 +1368,6 @@ DhcpSendMessage (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retransmit a saved packet. Only DISCOVER and REQUEST messages
|
Retransmit a saved packet. Only DISCOVER and REQUEST messages
|
||||||
will be retransmitted.
|
will be retransmitted.
|
||||||
@ -1469,7 +1443,6 @@ DhcpRetransmit (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Each DHCP service has three timer. Two of them are count down timer.
|
Each DHCP service has three timer. Two of them are count down timer.
|
||||||
One for the packet retransmission. The other is to collect the offers.
|
One for the packet retransmission. The other is to collect the offers.
|
||||||
@ -1500,7 +1473,7 @@ DhcpOnTimerTick (
|
|||||||
//
|
//
|
||||||
// 0xffff is the maximum supported value for elapsed time according to RFC.
|
// 0xffff is the maximum supported value for elapsed time according to RFC.
|
||||||
//
|
//
|
||||||
if (Instance != NULL && Instance->ElaspedTime < 0xffff) {
|
if ((Instance != NULL) && (Instance->ElaspedTime < 0xffff)) {
|
||||||
Instance->ElaspedTime++;
|
Instance->ElaspedTime++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1508,12 +1481,10 @@ DhcpOnTimerTick (
|
|||||||
// Check the retransmit timer
|
// Check the retransmit timer
|
||||||
//
|
//
|
||||||
if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {
|
if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Select offer at each timeout if any offer received.
|
// Select offer at each timeout if any offer received.
|
||||||
//
|
//
|
||||||
if (DhcpSb->DhcpState == Dhcp4Selecting && DhcpSb->LastOffer != NULL) {
|
if ((DhcpSb->DhcpState == Dhcp4Selecting) && (DhcpSb->LastOffer != NULL)) {
|
||||||
|
|
||||||
Status = DhcpChooseOffer (DhcpSb);
|
Status = DhcpChooseOffer (DhcpSb);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -1532,9 +1503,7 @@ DhcpOnTimerTick (
|
|||||||
//
|
//
|
||||||
DhcpRetransmit (DhcpSb);
|
DhcpRetransmit (DhcpSb);
|
||||||
DhcpSetTransmitTimer (DhcpSb);
|
DhcpSetTransmitTimer (DhcpSb);
|
||||||
|
|
||||||
} else if (DHCP_CONNECTED (DhcpSb->DhcpState)) {
|
} else if (DHCP_CONNECTED (DhcpSb->DhcpState)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retransmission failed, if the DHCP request is initiated by
|
// Retransmission failed, if the DHCP request is initiated by
|
||||||
// user, adjust the current state according to the lease life.
|
// user, adjust the current state according to the lease life.
|
||||||
@ -1545,16 +1514,12 @@ DhcpOnTimerTick (
|
|||||||
|
|
||||||
if (DhcpSb->LeaseLife < DhcpSb->T1) {
|
if (DhcpSb->LeaseLife < DhcpSb->T1) {
|
||||||
Status = DhcpSetState (DhcpSb, Dhcp4Bound, FALSE);
|
Status = DhcpSetState (DhcpSb, Dhcp4Bound, FALSE);
|
||||||
|
|
||||||
} else if (DhcpSb->LeaseLife < DhcpSb->T2) {
|
} else if (DhcpSb->LeaseLife < DhcpSb->T2) {
|
||||||
Status = DhcpSetState (DhcpSb, Dhcp4Renewing, FALSE);
|
Status = DhcpSetState (DhcpSb, Dhcp4Renewing, FALSE);
|
||||||
|
|
||||||
} else if (DhcpSb->LeaseLife < DhcpSb->Lease) {
|
} else if (DhcpSb->LeaseLife < DhcpSb->Lease) {
|
||||||
Status = DhcpSetState (DhcpSb, Dhcp4Rebinding, FALSE);
|
Status = DhcpSetState (DhcpSb, Dhcp4Rebinding, FALSE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
goto END_SESSION;
|
goto END_SESSION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DhcpSb->IoStatus = EFI_TIMEOUT;
|
DhcpSb->IoStatus = EFI_TIMEOUT;
|
||||||
@ -1585,7 +1550,6 @@ DhcpOnTimerTick (
|
|||||||
// Lease expires, end the session
|
// Lease expires, end the session
|
||||||
//
|
//
|
||||||
goto END_SESSION;
|
goto END_SESSION;
|
||||||
|
|
||||||
} else if (DhcpSb->LeaseLife == DhcpSb->T2) {
|
} else if (DhcpSb->LeaseLife == DhcpSb->T2) {
|
||||||
//
|
//
|
||||||
// T2 expires, transit to rebinding then send a REQUEST to any server
|
// T2 expires, transit to rebinding then send a REQUEST to any server
|
||||||
@ -1609,7 +1573,6 @@ DhcpOnTimerTick (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto END_SESSION;
|
goto END_SESSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (DhcpSb->LeaseLife == DhcpSb->T1) {
|
} else if (DhcpSb->LeaseLife == DhcpSb->T1) {
|
||||||
//
|
//
|
||||||
// T1 expires, transit to renewing, then send a REQUEST to the server
|
// T1 expires, transit to renewing, then send a REQUEST to the server
|
||||||
@ -1643,7 +1606,7 @@ ON_EXIT:
|
|||||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, &DhcpSb->Children) {
|
NET_LIST_FOR_EACH_SAFE (Entry, Next, &DhcpSb->Children) {
|
||||||
Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
|
Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
|
||||||
Instance->Timeout--;
|
Instance->Timeout--;
|
||||||
if (Instance->Timeout == 0 && Instance->Token != NULL) {
|
if ((Instance->Timeout == 0) && (Instance->Token != NULL)) {
|
||||||
PxeDhcpDone (Instance);
|
PxeDhcpDone (Instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DHCP_WAIT_OFFER 3 // Time to wait the offers
|
#define DHCP_WAIT_OFFER 3 // Time to wait the offers
|
||||||
#define DHCP_DEFAULT_LEASE 7 * 24 * 60 * 60 // Seven days as default.
|
#define DHCP_DEFAULT_LEASE 7 * 24 * 60 * 60 // Seven days as default.
|
||||||
#define DHCP_SERVER_PORT 67
|
#define DHCP_SERVER_PORT 67
|
||||||
|
@ -101,7 +101,6 @@ DHCP_OPTION_FORMAT DhcpOptionFormats[] = {
|
|||||||
{ DHCP4_TAG_CLASSLESS_ROUTE, DHCP_OPTION_INT8, 5, -1, FALSE },
|
{ DHCP4_TAG_CLASSLESS_ROUTE, DHCP_OPTION_INT8, 5, -1, FALSE },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Binary search the DhcpOptionFormats array to find the format
|
Binary search the DhcpOptionFormats array to find the format
|
||||||
information about a specific option.
|
information about a specific option.
|
||||||
@ -140,7 +139,6 @@ DhcpFindOptionFormat (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Validate whether a single DHCP option is valid according to its format.
|
Validate whether a single DHCP option is valid according to its format.
|
||||||
|
|
||||||
@ -201,7 +199,8 @@ DhcpOptionIsValid (
|
|||||||
|
|
||||||
if (((Format->MinOccur != -1) && (Occur < Format->MinOccur)) ||
|
if (((Format->MinOccur != -1) && (Occur < Format->MinOccur)) ||
|
||||||
((Format->MaxOccur != -1) && (Occur > Format->MaxOccur))
|
((Format->MaxOccur != -1) && (Occur > Format->MaxOccur))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +218,6 @@ DhcpOptionIsValid (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extract the client interested options, all the parameters are
|
Extract the client interested options, all the parameters are
|
||||||
converted to host byte order.
|
converted to host byte order.
|
||||||
@ -263,6 +261,7 @@ DhcpGetParameter (
|
|||||||
if ((Para->Overload < 1) || (Para->Overload > 3)) {
|
if ((Para->Overload < 1) || (Para->Overload > 3)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCP4_TAG_MSG_TYPE:
|
case DHCP4_TAG_MSG_TYPE:
|
||||||
@ -271,6 +270,7 @@ DhcpGetParameter (
|
|||||||
if ((Para->DhcpType < 1) || (Para->DhcpType > 9)) {
|
if ((Para->DhcpType < 1) || (Para->DhcpType > 9)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCP4_TAG_SERVER_ID:
|
case DHCP4_TAG_SERVER_ID:
|
||||||
@ -289,7 +289,6 @@ DhcpGetParameter (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inspect all the options in a single buffer. DHCP options may be contained
|
Inspect all the options in a single buffer. DHCP options may be contained
|
||||||
in several buffers, such as the BOOTP options filed, boot file or server
|
in several buffers, such as the BOOTP options filed, boot file or server
|
||||||
@ -364,7 +363,6 @@ DhcpIterateBufferOptions (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Iterate through a DHCP message to visit each option. First inspect
|
Iterate through a DHCP message to visit each option. First inspect
|
||||||
all the options in the OPTION field. Then if overloaded, inspect
|
all the options in the OPTION field. Then if overloaded, inspect
|
||||||
@ -435,7 +433,6 @@ DhcpIterateOptions (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call back function to DhcpIterateOptions to compute each option's
|
Call back function to DhcpIterateOptions to compute each option's
|
||||||
length. It just adds the data length of all the occurrences of this
|
length. It just adds the data length of all the occurrences of this
|
||||||
@ -466,7 +463,6 @@ DhcpGetOptionLen (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call back function to DhcpIterateOptions to consolidate each option's
|
Call back function to DhcpIterateOptions to consolidate each option's
|
||||||
data. There are maybe several occurrence of the same option.
|
data. There are maybe several occurrence of the same option.
|
||||||
@ -513,7 +509,6 @@ DhcpFillOption (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parse the options of a DHCP packet. It supports RFC 3396: Encoding
|
Parse the options of a DHCP packet. It supports RFC 3396: Encoding
|
||||||
Long Options in DHCP. That is, it will combine all the option value
|
Long Options in DHCP. That is, it will combine all the option value
|
||||||
@ -630,7 +625,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Validate the packet's options. If necessary, allocate
|
Validate the packet's options. If necessary, allocate
|
||||||
and fill in the interested parameters.
|
and fill in the interested parameters.
|
||||||
@ -668,6 +662,7 @@ DhcpValidateOptions (
|
|||||||
if (EFI_ERROR (Status) || (Count == 0)) {
|
if (EFI_ERROR (Status) || (Count == 0)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (AllOption != NULL);
|
ASSERT (AllOption != NULL);
|
||||||
|
|
||||||
Updated = FALSE;
|
Updated = FALSE;
|
||||||
@ -716,8 +711,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Append an option to the memory, if the option is longer than
|
Append an option to the memory, if the option is longer than
|
||||||
255 bytes, splits it into several options.
|
255 bytes, splits it into several options.
|
||||||
@ -756,7 +749,6 @@ DhcpAppendOption (
|
|||||||
return Buf;
|
return Buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Build a new DHCP packet from a seed packet. Options may be deleted or
|
Build a new DHCP packet from a seed packet. Options may be deleted or
|
||||||
appended. The caller should free the NewPacket when finished using it.
|
appended. The caller should free the NewPacket when finished using it.
|
||||||
|
@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define DHCP_OPTION_MAGIC 0x63538263 // Network byte order
|
#define DHCP_OPTION_MAGIC 0x63538263 // Network byte order
|
||||||
#define DHCP_MAX_OPTIONS 256
|
#define DHCP_MAX_OPTIONS 256
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DHCP option types, this is used to validate the DHCP options.
|
// DHCP option types, this is used to validate the DHCP options.
|
||||||
//
|
//
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "Dhcp6Impl.h"
|
#include "Dhcp6Impl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user-readable name of the driver.
|
Retrieves a Unicode string that is the user-readable name of the driver.
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ Dhcp6ComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user-readable name of the controller
|
Retrieves a Unicode string that is the user-readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -136,7 +134,6 @@ Dhcp6ComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
@ -278,12 +275,14 @@ UpdateName (
|
|||||||
if (Dhcp6ModeData.Ia->State > Dhcp6Rebinding) {
|
if (Dhcp6ModeData.Ia->State > Dhcp6Rebinding) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State];
|
HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6ModeData.Ia != NULL) {
|
if (Dhcp6ModeData.Ia != NULL) {
|
||||||
FreePool (Dhcp6ModeData.Ia);
|
FreePool (Dhcp6ModeData.Ia);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6ModeData.ClientId != NULL) {
|
if (Dhcp6ModeData.ClientId != NULL) {
|
||||||
FreePool (Dhcp6ModeData.ClientId);
|
FreePool (Dhcp6ModeData.ClientId);
|
||||||
}
|
}
|
||||||
@ -439,4 +438,3 @@ Dhcp6ComponentNameGetControllerName (
|
|||||||
(BOOLEAN)(This == &gDhcp6ComponentName)
|
(BOOLEAN)(This == &gDhcp6ComponentName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "Dhcp6Impl.h"
|
#include "Dhcp6Impl.h"
|
||||||
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
|
EFI_DRIVER_BINDING_PROTOCOL gDhcp6DriverBinding = {
|
||||||
Dhcp6DriverBindingSupported,
|
Dhcp6DriverBindingSupported,
|
||||||
Dhcp6DriverBindingStart,
|
Dhcp6DriverBindingStart,
|
||||||
@ -70,10 +69,9 @@ Dhcp6ConfigureUdpIo (
|
|||||||
Config->StationPort = DHCP6_PORT_CLIENT;
|
Config->StationPort = DHCP6_PORT_CLIENT;
|
||||||
Config->RemotePort = 0;
|
Config->RemotePort = 0;
|
||||||
|
|
||||||
return Udp6->Configure (Udp6, Config);;
|
return Udp6->Configure (Udp6, Config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized,
|
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
|
or partly destroyed. If a resource is destroyed, it is marked as such in
|
||||||
@ -103,7 +101,6 @@ Dhcp6DestroyService (
|
|||||||
FreePool (Service);
|
FreePool (Service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new Dhcp6 service for the Nic controller.
|
Create a new Dhcp6 service for the Nic controller.
|
||||||
|
|
||||||
@ -206,7 +203,6 @@ Dhcp6CreateService (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy the Dhcp6 instance and recycle the resources.
|
Destroy the Dhcp6 instance and recycle the resources.
|
||||||
|
|
||||||
@ -239,6 +235,7 @@ Dhcp6DestroyInstance (
|
|||||||
if (Instance->IaCb.Ia->ReplyPacket != NULL) {
|
if (Instance->IaCb.Ia->ReplyPacket != NULL) {
|
||||||
FreePool (Instance->IaCb.Ia->ReplyPacket);
|
FreePool (Instance->IaCb.Ia->ReplyPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Instance->IaCb.Ia);
|
FreePool (Instance->IaCb.Ia);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +250,6 @@ Dhcp6DestroyInstance (
|
|||||||
FreePool (Instance);
|
FreePool (Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the Dhcp6 instance and initialize it.
|
Create the Dhcp6 instance and initialize it.
|
||||||
|
|
||||||
@ -340,7 +336,7 @@ Dhcp6DestroyChildEntry (
|
|||||||
DHCP6_INSTANCE *Instance;
|
DHCP6_INSTANCE *Instance;
|
||||||
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
|
||||||
|
|
||||||
if (Entry == NULL || Context == NULL) {
|
if ((Entry == NULL) || (Context == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +346,6 @@ Dhcp6DestroyChildEntry (
|
|||||||
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
|
return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Entry point of the DHCP6 driver to install various protocols.
|
Entry point of the DHCP6 driver to install various protocols.
|
||||||
|
|
||||||
@ -378,7 +373,6 @@ Dhcp6DriverEntryPoint (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test to see if this driver supports ControllerHandle. This service
|
Test to see if this driver supports ControllerHandle. This service
|
||||||
is called by the EFI boot service ConnectController(). In
|
is called by the EFI boot service ConnectController(). In
|
||||||
@ -414,7 +408,6 @@ Dhcp6DriverBindingSupported (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start this driver on ControllerHandle. This service is called by the
|
Start this driver on ControllerHandle. This service is called by the
|
||||||
EFI boot service ConnectController(). In order to make
|
EFI boot service ConnectController(). In order to make
|
||||||
@ -490,7 +483,6 @@ Dhcp6DriverBindingStart (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stop this driver on ControllerHandle. This service is called by the
|
Stop this driver on ControllerHandle. This service is called by the
|
||||||
EFI boot service DisconnectController(). In order to
|
EFI boot service DisconnectController(). In order to
|
||||||
@ -560,16 +552,16 @@ Dhcp6DriverBindingStop (
|
|||||||
ServiceBinding,
|
ServiceBinding,
|
||||||
&ListLength
|
&ListLength
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || ListLength != 0) {
|
if (EFI_ERROR (Status) || (ListLength != 0)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberOfChildren == 0 && !IsListEmpty (&Service->Child)) {
|
if ((NumberOfChildren == 0) && !IsListEmpty (&Service->Child)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
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.
|
// Destroy the service itself if no child instance left.
|
||||||
//
|
//
|
||||||
@ -590,7 +582,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a child handle and installs a protocol.
|
Creates a child handle and installs a protocol.
|
||||||
|
|
||||||
@ -621,7 +612,7 @@ Dhcp6ServiceBindingCreateChild (
|
|||||||
DHCP6_INSTANCE *Instance;
|
DHCP6_INSTANCE *Instance;
|
||||||
VOID *Udp6;
|
VOID *Udp6;
|
||||||
|
|
||||||
if (This == NULL || ChildHandle == NULL) {
|
if ((This == NULL) || (ChildHandle == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +668,6 @@ Dhcp6ServiceBindingCreateChild (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
gBS->UninstallMultipleProtocolInterfaces (
|
||||||
Instance->Handle,
|
Instance->Handle,
|
||||||
&gEfiDhcp6ProtocolGuid,
|
&gEfiDhcp6ProtocolGuid,
|
||||||
@ -704,7 +694,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroys a child handle with a protocol installed on it.
|
Destroys a child handle with a protocol installed on it.
|
||||||
|
|
||||||
@ -736,7 +725,7 @@ Dhcp6ServiceBindingDestroyChild (
|
|||||||
DHCP6_SERVICE *Service;
|
DHCP6_SERVICE *Service;
|
||||||
DHCP6_INSTANCE *Instance;
|
DHCP6_INSTANCE *Instance;
|
||||||
|
|
||||||
if (This == NULL || ChildHandle == NULL) {
|
if ((This == NULL) || (ChildHandle == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
//
|
//
|
||||||
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2
|
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2
|
||||||
//
|
//
|
||||||
EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {{0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2}};
|
EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {
|
||||||
|
{ 0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2 }
|
||||||
|
};
|
||||||
|
|
||||||
EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
|
EFI_DHCP6_PROTOCOL gDhcp6ProtocolTemplate = {
|
||||||
EfiDhcp6GetModeData,
|
EfiDhcp6GetModeData,
|
||||||
@ -136,10 +138,10 @@ EfiDhcp6Start (
|
|||||||
// Poll udp out of the net tpl if synchronous call.
|
// Poll udp out of the net tpl if synchronous call.
|
||||||
//
|
//
|
||||||
if (Instance->Config->IaInfoEvent == NULL) {
|
if (Instance->Config->IaInfoEvent == NULL) {
|
||||||
|
|
||||||
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
||||||
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Instance->UdpSts;
|
return Instance->UdpSts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +153,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stops the DHCPv6 standard S.A.R.R. process.
|
Stops the DHCPv6 standard S.A.R.R. process.
|
||||||
|
|
||||||
@ -200,10 +201,11 @@ EfiDhcp6Stop (
|
|||||||
//
|
//
|
||||||
// No valid REPLY message received yet, cleanup this instance directly.
|
// No valid REPLY message received yet, cleanup this instance directly.
|
||||||
//
|
//
|
||||||
if (Instance->IaCb.Ia->State == Dhcp6Init ||
|
if ((Instance->IaCb.Ia->State == Dhcp6Init) ||
|
||||||
Instance->IaCb.Ia->State == Dhcp6Selecting ||
|
(Instance->IaCb.Ia->State == Dhcp6Selecting) ||
|
||||||
Instance->IaCb.Ia->State == Dhcp6Requesting
|
(Instance->IaCb.Ia->State == Dhcp6Requesting)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,6 +229,7 @@ EfiDhcp6Stop (
|
|||||||
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
||||||
Udp6->Poll (Udp6);
|
Udp6->Poll (Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Instance->UdpSts;
|
Status = Instance->UdpSts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +244,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the current operating mode data for the Dhcp6 instance.
|
Returns the current operating mode data for the Dhcp6 instance.
|
||||||
|
|
||||||
@ -272,14 +274,14 @@ EfiDhcp6GetModeData (
|
|||||||
UINT32 IaSize;
|
UINT32 IaSize;
|
||||||
UINT32 IdSize;
|
UINT32 IdSize;
|
||||||
|
|
||||||
if (This == NULL || (Dhcp6ModeData == NULL && Dhcp6ConfigData == NULL)) {
|
if ((This == NULL) || ((Dhcp6ModeData == NULL) && (Dhcp6ConfigData == NULL))) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance = DHCP6_INSTANCE_FROM_THIS (This);
|
Instance = DHCP6_INSTANCE_FROM_THIS (This);
|
||||||
Service = Instance->Service;
|
Service = Instance->Service;
|
||||||
|
|
||||||
if (Instance->Config == NULL && Dhcp6ConfigData != NULL) {
|
if ((Instance->Config == NULL) && (Dhcp6ConfigData != NULL)) {
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,6 +349,7 @@ EfiDhcp6GetModeData (
|
|||||||
if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {
|
if (Dhcp6ModeData->Ia->ReplyPacket == NULL) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (
|
CopyMem (
|
||||||
Dhcp6ModeData->Ia->ReplyPacket,
|
Dhcp6ModeData->Ia->ReplyPacket,
|
||||||
Ia->ReplyPacket,
|
Ia->ReplyPacket,
|
||||||
@ -365,15 +368,16 @@ ON_ERROR:
|
|||||||
if (Dhcp6ConfigData != NULL) {
|
if (Dhcp6ConfigData != NULL) {
|
||||||
Dhcp6CleanupConfigData (Dhcp6ConfigData);
|
Dhcp6CleanupConfigData (Dhcp6ConfigData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6ModeData != NULL) {
|
if (Dhcp6ModeData != NULL) {
|
||||||
Dhcp6CleanupModeData (Dhcp6ModeData);
|
Dhcp6CleanupModeData (Dhcp6ModeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes, changes, or resets the operational settings for the Dhcp6 instance.
|
Initializes, changes, or resets the operational settings for the Dhcp6 instance.
|
||||||
|
|
||||||
@ -428,36 +432,40 @@ EfiDhcp6Configure (
|
|||||||
// Check the parameter of configure data.
|
// Check the parameter of configure data.
|
||||||
//
|
//
|
||||||
if (Dhcp6CfgData != NULL) {
|
if (Dhcp6CfgData != NULL) {
|
||||||
if (Dhcp6CfgData->OptionCount > 0 && Dhcp6CfgData->OptionList == NULL) {
|
if ((Dhcp6CfgData->OptionCount > 0) && (Dhcp6CfgData->OptionList == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6CfgData->OptionList != NULL) {
|
if (Dhcp6CfgData->OptionList != NULL) {
|
||||||
for (Index = 0; Index < Dhcp6CfgData->OptionCount; Index++) {
|
for (Index = 0; Index < Dhcp6CfgData->OptionCount; Index++) {
|
||||||
if (Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId ||
|
if ((Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptClientId) ||
|
||||||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit ||
|
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptRapidCommit) ||
|
||||||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept ||
|
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptReconfigureAccept) ||
|
||||||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana ||
|
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIana) ||
|
||||||
Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata
|
(Dhcp6CfgData->OptionList[Index]->OpCode == Dhcp6OptIata)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA &&
|
if ((Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_NA) &&
|
||||||
Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA
|
(Dhcp6CfgData->IaDescriptor.Type != EFI_DHCP6_IA_TYPE_TA)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6CfgData->IaInfoEvent == NULL && Dhcp6CfgData->SolicitRetransmission == NULL) {
|
if ((Dhcp6CfgData->IaInfoEvent == NULL) && (Dhcp6CfgData->SolicitRetransmission == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dhcp6CfgData->SolicitRetransmission != NULL &&
|
if ((Dhcp6CfgData->SolicitRetransmission != NULL) &&
|
||||||
Dhcp6CfgData->SolicitRetransmission->Mrc == 0 &&
|
(Dhcp6CfgData->SolicitRetransmission->Mrc == 0) &&
|
||||||
Dhcp6CfgData->SolicitRetransmission->Mrd == 0
|
(Dhcp6CfgData->SolicitRetransmission->Mrd == 0)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,10 +474,11 @@ EfiDhcp6Configure (
|
|||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH (Entry, &Service->Child) {
|
NET_LIST_FOR_EACH (Entry, &Service->Child) {
|
||||||
Other = NET_LIST_USER_STRUCT (Entry, DHCP6_INSTANCE, Link);
|
Other = NET_LIST_USER_STRUCT (Entry, DHCP6_INSTANCE, Link);
|
||||||
if (Other->IaCb.Ia != NULL &&
|
if ((Other->IaCb.Ia != NULL) &&
|
||||||
Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type &&
|
(Other->IaCb.Ia->Descriptor.Type == Dhcp6CfgData->IaDescriptor.Type) &&
|
||||||
Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId
|
(Other->IaCb.Ia->Descriptor.IaId == Dhcp6CfgData->IaDescriptor.IaId)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -513,14 +522,13 @@ EfiDhcp6Configure (
|
|||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (
|
CopyMem (
|
||||||
&Instance->IaCb.Ia->Descriptor,
|
&Instance->IaCb.Ia->Descriptor,
|
||||||
&Dhcp6CfgData->IaDescriptor,
|
&Dhcp6CfgData->IaDescriptor,
|
||||||
sizeof (EFI_DHCP6_IA_DESCRIPTOR)
|
sizeof (EFI_DHCP6_IA_DESCRIPTOR)
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (Instance->Config == NULL) {
|
if (Instance->Config == NULL) {
|
||||||
ASSERT (Instance->IaCb.Ia == NULL);
|
ASSERT (Instance->IaCb.Ia == NULL);
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
@ -548,7 +556,6 @@ EfiDhcp6Configure (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Request configuration information without the assignment of any
|
Request configuration information without the assignment of any
|
||||||
Ia addresses of the client.
|
Ia addresses of the client.
|
||||||
@ -612,21 +619,21 @@ EfiDhcp6InfoRequest (
|
|||||||
EFI_STATUS TimerStatus;
|
EFI_STATUS TimerStatus;
|
||||||
UINTN GetMappingTimeOut;
|
UINTN GetMappingTimeOut;
|
||||||
|
|
||||||
if (This == NULL || OptionRequest == NULL || Retransmission == NULL || ReplyCallback == NULL) {
|
if ((This == NULL) || (OptionRequest == NULL) || (Retransmission == NULL) || (ReplyCallback == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptionCount > 0 && OptionList == NULL) {
|
if ((OptionCount > 0) && (OptionList == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptionList != NULL) {
|
if (OptionList != NULL) {
|
||||||
for (Index = 0; Index < OptionCount; Index++) {
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -689,6 +696,7 @@ EfiDhcp6InfoRequest (
|
|||||||
|
|
||||||
gBS->CloseEvent (Timer);
|
gBS->CloseEvent (Timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -697,17 +705,16 @@ EfiDhcp6InfoRequest (
|
|||||||
// Poll udp out of the net tpl if synchronous call.
|
// Poll udp out of the net tpl if synchronous call.
|
||||||
//
|
//
|
||||||
if (TimeoutEvent == NULL) {
|
if (TimeoutEvent == NULL) {
|
||||||
|
|
||||||
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
||||||
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Instance->UdpSts;
|
return Instance->UdpSts;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Manually extend the valid and preferred lifetimes for the IPv6 addresses
|
Manually extend the valid and preferred lifetimes for the IPv6 addresses
|
||||||
of the configured IA and update other configuration parameters by sending a
|
of the configured IA and update other configuration parameters by sending a
|
||||||
@ -784,9 +791,10 @@ EfiDhcp6RenewRebind (
|
|||||||
//
|
//
|
||||||
// The instance has already entered renewing or rebinding state.
|
// The instance has already entered renewing or rebinding state.
|
||||||
//
|
//
|
||||||
if ((Instance->IaCb.Ia->State == Dhcp6Rebinding && RebindRequest) ||
|
if (((Instance->IaCb.Ia->State == Dhcp6Rebinding) && RebindRequest) ||
|
||||||
(Instance->IaCb.Ia->State == Dhcp6Renewing && !RebindRequest)
|
((Instance->IaCb.Ia->State == Dhcp6Renewing) && !RebindRequest)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,10 +834,10 @@ EfiDhcp6RenewRebind (
|
|||||||
// Poll udp out of the net tpl if synchronous call.
|
// Poll udp out of the net tpl if synchronous call.
|
||||||
//
|
//
|
||||||
if (Instance->Config->IaInfoEvent == NULL) {
|
if (Instance->Config->IaInfoEvent == NULL) {
|
||||||
|
|
||||||
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
||||||
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Instance->UdpSts;
|
return Instance->UdpSts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,7 +849,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inform that one or more addresses assigned by a server are already
|
Inform that one or more addresses assigned by a server are already
|
||||||
in use by another node.
|
in use by another node.
|
||||||
@ -888,7 +895,7 @@ EfiDhcp6Decline (
|
|||||||
DHCP6_INSTANCE *Instance;
|
DHCP6_INSTANCE *Instance;
|
||||||
DHCP6_SERVICE *Service;
|
DHCP6_SERVICE *Service;
|
||||||
|
|
||||||
if (This == NULL || AddressCount == 0 || Addresses == NULL) {
|
if ((This == NULL) || (AddressCount == 0) || (Addresses == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -961,10 +968,10 @@ EfiDhcp6Decline (
|
|||||||
// Poll udp out of the net tpl if synchronous call.
|
// Poll udp out of the net tpl if synchronous call.
|
||||||
//
|
//
|
||||||
if (Instance->Config->IaInfoEvent == NULL) {
|
if (Instance->Config->IaInfoEvent == NULL) {
|
||||||
|
|
||||||
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
||||||
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Instance->UdpSts;
|
return Instance->UdpSts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,12 +982,12 @@ ON_ERROR:
|
|||||||
if (DecIa != NULL) {
|
if (DecIa != NULL) {
|
||||||
FreePool (DecIa);
|
FreePool (DecIa);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release one or more addresses associated with the configured Ia
|
Release one or more addresses associated with the configured Ia
|
||||||
for current instance.
|
for current instance.
|
||||||
@ -1029,7 +1036,7 @@ EfiDhcp6Release (
|
|||||||
DHCP6_INSTANCE *Instance;
|
DHCP6_INSTANCE *Instance;
|
||||||
DHCP6_SERVICE *Service;
|
DHCP6_SERVICE *Service;
|
||||||
|
|
||||||
if (This == NULL || (AddressCount != 0 && Addresses == NULL)) {
|
if ((This == NULL) || ((AddressCount != 0) && (Addresses == NULL))) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,6 +1112,7 @@ EfiDhcp6Release (
|
|||||||
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
while (Instance->UdpSts == EFI_ALREADY_STARTED) {
|
||||||
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
Service->UdpIo->Protocol.Udp6->Poll (Service->UdpIo->Protocol.Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Instance->UdpSts;
|
return Instance->UdpSts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,12 +1123,12 @@ ON_ERROR:
|
|||||||
if (RelIa != NULL) {
|
if (RelIa != NULL) {
|
||||||
FreePool (RelIa);
|
FreePool (RelIa);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parse the option data in the Dhcp6 packet.
|
Parse the option data in the Dhcp6 packet.
|
||||||
|
|
||||||
@ -1152,15 +1160,15 @@ EfiDhcp6Parse (
|
|||||||
UINT8 *Start;
|
UINT8 *Start;
|
||||||
UINT8 *End;
|
UINT8 *End;
|
||||||
|
|
||||||
if (This == NULL || Packet == NULL || OptionCount == NULL) {
|
if ((This == NULL) || (Packet == NULL) || (OptionCount == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*OptionCount != 0 && PacketOptionList == NULL) {
|
if ((*OptionCount != 0) && (PacketOptionList == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
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;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1208,7 +1216,6 @@ EfiDhcp6Parse (
|
|||||||
Start = Packet->Dhcp6.Option;
|
Start = Packet->Dhcp6.Option;
|
||||||
|
|
||||||
while (Start < End) {
|
while (Start < End) {
|
||||||
|
|
||||||
PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *)Start;
|
PacketOptionList[OptCnt] = (EFI_DHCP6_PACKET_OPTION *)Start;
|
||||||
DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;
|
DataLen = ((EFI_DHCP6_PACKET_OPTION *)Start)->OpLen;
|
||||||
Start += (NTOHS (DataLen) + 4);
|
Start += (NTOHS (DataLen) + 4);
|
||||||
@ -1217,4 +1224,3 @@ EfiDhcp6Parse (
|
|||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#ifndef __EFI_DHCP6_IMPL_H__
|
#ifndef __EFI_DHCP6_IMPL_H__
|
||||||
#define __EFI_DHCP6_IMPL_H__
|
#define __EFI_DHCP6_IMPL_H__
|
||||||
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include <IndustryStandard/Dhcp.h>
|
#include <IndustryStandard/Dhcp.h>
|
||||||
@ -33,7 +32,6 @@
|
|||||||
#include <Library/PrintLib.h>
|
#include <Library/PrintLib.h>
|
||||||
#include <Guid/ZeroGuid.h>
|
#include <Guid/ZeroGuid.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct _DHCP6_IA_CB DHCP6_IA_CB;
|
typedef struct _DHCP6_IA_CB DHCP6_IA_CB;
|
||||||
typedef struct _DHCP6_INF_CB DHCP6_INF_CB;
|
typedef struct _DHCP6_INF_CB DHCP6_INF_CB;
|
||||||
typedef struct _DHCP6_TX_CB DHCP6_TX_CB;
|
typedef struct _DHCP6_TX_CB DHCP6_TX_CB;
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "Dhcp6Impl.h"
|
#include "Dhcp6Impl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enqueue the packet into the retry list in case of timeout.
|
Enqueue the packet into the retry list in case of timeout.
|
||||||
|
|
||||||
@ -215,7 +214,6 @@ Dhcp6EnqueueRetry (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Dequeue the packet from retry list if reply received or timeout at last.
|
Dequeue the packet from retry list if reply received or timeout at last.
|
||||||
|
|
||||||
@ -244,26 +242,22 @@ Dhcp6DequeueRetry (
|
|||||||
// Seek the retransmit node in the retransmit list by packet xid.
|
// Seek the retransmit node in the retransmit list by packet xid.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
||||||
|
|
||||||
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
||||||
ASSERT (TxCb->TxPacket);
|
ASSERT (TxCb->TxPacket);
|
||||||
|
|
||||||
if (TxCb->Xid == PacketXid) {
|
if (TxCb->Xid == PacketXid) {
|
||||||
|
|
||||||
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
|
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Seek the info-request node in the info-request list by packet xid.
|
// Seek the info-request node in the info-request list by packet xid.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
|
||||||
|
|
||||||
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
|
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
|
||||||
|
|
||||||
if (InfCb->Xid == PacketXid) {
|
if (InfCb->Xid == PacketXid) {
|
||||||
//
|
//
|
||||||
// Remove the info-request node, and signal the event if timeout.
|
// 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);
|
gBS->SignalEvent (InfCb->TimeoutEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +266,7 @@ Dhcp6DequeueRetry (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remove the retransmit node.
|
// Remove the retransmit node.
|
||||||
//
|
//
|
||||||
@ -286,7 +281,6 @@ Dhcp6DequeueRetry (
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the specific nodes in the retry list.
|
Clean up the specific nodes in the retry list.
|
||||||
|
|
||||||
@ -308,10 +302,8 @@ Dhcp6CleanupRetry (
|
|||||||
//
|
//
|
||||||
// Clean up all the stateful messages from the retransmit list.
|
// 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) {
|
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
||||||
|
|
||||||
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
||||||
ASSERT (TxCb->TxPacket);
|
ASSERT (TxCb->TxPacket);
|
||||||
|
|
||||||
@ -326,13 +318,11 @@ Dhcp6CleanupRetry (
|
|||||||
//
|
//
|
||||||
// Clean up all the stateless messages from the retransmit list.
|
// 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.
|
// Clean up all the retransmit list for stateless messages.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
||||||
|
|
||||||
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
||||||
ASSERT (TxCb->TxPacket);
|
ASSERT (TxCb->TxPacket);
|
||||||
|
|
||||||
@ -347,12 +337,12 @@ Dhcp6CleanupRetry (
|
|||||||
// Clean up all the info-request messages list.
|
// Clean up all the info-request messages list.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
|
||||||
|
|
||||||
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
|
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
|
||||||
|
|
||||||
if (InfCb->TimeoutEvent != NULL) {
|
if (InfCb->TimeoutEvent != NULL) {
|
||||||
gBS->SignalEvent (InfCb->TimeoutEvent);
|
gBS->SignalEvent (InfCb->TimeoutEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryList (&InfCb->Link);
|
RemoveEntryList (&InfCb->Link);
|
||||||
FreePool (InfCb);
|
FreePool (InfCb);
|
||||||
}
|
}
|
||||||
@ -461,7 +451,6 @@ Dhcp6CleanupSession (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback to user when Dhcp6 transmit/receive occurs.
|
Callback to user when Dhcp6 transmit/receive occurs.
|
||||||
|
|
||||||
@ -500,7 +489,6 @@ Dhcp6CallbackUser (
|
|||||||
// Callback to user with the new message if has.
|
// Callback to user with the new message if has.
|
||||||
//
|
//
|
||||||
if (Callback != NULL) {
|
if (Callback != NULL) {
|
||||||
|
|
||||||
Status = Callback (
|
Status = Callback (
|
||||||
&Instance->Dhcp6,
|
&Instance->Dhcp6,
|
||||||
Context,
|
Context,
|
||||||
@ -522,7 +510,6 @@ Dhcp6CallbackUser (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update Ia according to the new reply message.
|
Update Ia according to the new reply message.
|
||||||
|
|
||||||
@ -618,9 +605,10 @@ Dhcp6UpdateIaInfo (
|
|||||||
// and both T1 and T2 are greater than 0, the client discards the IA_NA option and processes
|
// 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.
|
// 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;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
IaInnerOpt = Option + 16;
|
IaInnerOpt = Option + 16;
|
||||||
IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(Option + 2))) - 12);
|
IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(Option + 2))) - 12);
|
||||||
} else {
|
} else {
|
||||||
@ -673,8 +661,6 @@ Dhcp6UpdateIaInfo (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Seek StatusCode Option in package. A Status Code option may appear in the
|
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.
|
options field of a DHCP message and/or in the options field of another option.
|
||||||
@ -807,7 +793,6 @@ Dhcp6SeekStsOption (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Transmit Dhcp6 message by udpio.
|
Transmit Dhcp6 message by udpio.
|
||||||
|
|
||||||
@ -899,7 +884,6 @@ Dhcp6TransmitPacket (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the solicit message and send it.
|
Create the solicit message and send it.
|
||||||
|
|
||||||
@ -985,7 +969,6 @@ Dhcp6SendSolicitMsg (
|
|||||||
// Append user-defined when configurate Dhcp6 service.
|
// Append user-defined when configurate Dhcp6 service.
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
|
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
|
||||||
|
|
||||||
UserOpt = Instance->Config->OptionList[Index];
|
UserOpt = Instance->Config->OptionList[Index];
|
||||||
Cursor = Dhcp6AppendOption (
|
Cursor = Dhcp6AppendOption (
|
||||||
Cursor,
|
Cursor,
|
||||||
@ -1061,7 +1044,6 @@ Dhcp6InitSolicitMsg (
|
|||||||
return Dhcp6SendSolicitMsg (Instance);
|
return Dhcp6SendSolicitMsg (Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the request message and send it.
|
Create the request message and send it.
|
||||||
|
|
||||||
@ -1174,7 +1156,6 @@ Dhcp6SendRequestMsg (
|
|||||||
// Append user-defined when configurate Dhcp6 service.
|
// Append user-defined when configurate Dhcp6 service.
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
|
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
|
||||||
|
|
||||||
UserOpt = Instance->Config->OptionList[Index];
|
UserOpt = Instance->Config->OptionList[Index];
|
||||||
Cursor = Dhcp6AppendOption (
|
Cursor = Dhcp6AppendOption (
|
||||||
Cursor,
|
Cursor,
|
||||||
@ -1223,7 +1204,6 @@ Dhcp6SendRequestMsg (
|
|||||||
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the decline message and send it.
|
Create the decline message and send it.
|
||||||
|
|
||||||
@ -1361,7 +1341,6 @@ Dhcp6SendDeclineMsg (
|
|||||||
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the release message and send it.
|
Create the release message and send it.
|
||||||
|
|
||||||
@ -1494,7 +1473,6 @@ Dhcp6SendReleaseMsg (
|
|||||||
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the renew/rebind message and send it.
|
Create the renew/rebind message and send it.
|
||||||
|
|
||||||
@ -1618,7 +1596,6 @@ Dhcp6SendRenewRebindMsg (
|
|||||||
// Append user-defined when configurate Dhcp6 service.
|
// Append user-defined when configurate Dhcp6 service.
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
|
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
|
||||||
|
|
||||||
UserOpt = Instance->Config->OptionList[Index];
|
UserOpt = Instance->Config->OptionList[Index];
|
||||||
Cursor = Dhcp6AppendOption (
|
Cursor = Dhcp6AppendOption (
|
||||||
Cursor,
|
Cursor,
|
||||||
@ -1876,7 +1853,6 @@ Dhcp6SendInfoRequestMsg (
|
|||||||
// Append user-defined when configurate Dhcp6 service.
|
// Append user-defined when configurate Dhcp6 service.
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < OptionCount; Index++) {
|
for (Index = 0; Index < OptionCount; Index++) {
|
||||||
|
|
||||||
UserOpt = OptionList[Index];
|
UserOpt = OptionList[Index];
|
||||||
Cursor = Dhcp6AppendOption (
|
Cursor = Dhcp6AppendOption (
|
||||||
Cursor,
|
Cursor,
|
||||||
@ -1913,7 +1889,6 @@ Dhcp6SendInfoRequestMsg (
|
|||||||
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, Retransmission);
|
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, Retransmission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the Confirm message and send it.
|
Create the Confirm message and send it.
|
||||||
|
|
||||||
@ -2049,8 +2024,6 @@ Dhcp6SendConfirmMsg (
|
|||||||
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
return Dhcp6EnqueueRetry (Instance, Packet, Elapsed, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle with the Dhcp6 reply message.
|
Handle with the Dhcp6 reply message.
|
||||||
|
|
||||||
@ -2096,7 +2069,7 @@ Dhcp6HandleReplyMsg (
|
|||||||
Dhcp6OptRapidCommit
|
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;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2104,11 +2077,11 @@ Dhcp6HandleReplyMsg (
|
|||||||
// As to a valid reply packet in response to a request/renew/rebind packet,
|
// As to a valid reply packet in response to a request/renew/rebind packet,
|
||||||
// ignore the packet if not contains the Ia option
|
// ignore the packet if not contains the Ia option
|
||||||
//
|
//
|
||||||
if (Instance->IaCb.Ia->State == Dhcp6Requesting ||
|
if ((Instance->IaCb.Ia->State == Dhcp6Requesting) ||
|
||||||
Instance->IaCb.Ia->State == Dhcp6Renewing ||
|
(Instance->IaCb.Ia->State == Dhcp6Renewing) ||
|
||||||
Instance->IaCb.Ia->State == Dhcp6Rebinding
|
(Instance->IaCb.Ia->State == Dhcp6Rebinding)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Option = Dhcp6SeekIaOption (
|
Option = Dhcp6SeekIaOption (
|
||||||
Packet->Dhcp6.Option,
|
Packet->Dhcp6.Option,
|
||||||
Packet->Length,
|
Packet->Length,
|
||||||
@ -2133,8 +2106,7 @@ Dhcp6HandleReplyMsg (
|
|||||||
// the client considers the decline/release event completed regardless of the
|
// the client considers the decline/release event completed regardless of the
|
||||||
// status code.
|
// 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) {
|
if (Instance->IaCb.Ia->IaAddressCount != 0) {
|
||||||
Instance->IaCb.Ia->State = Dhcp6Bound;
|
Instance->IaCb.Ia->State = Dhcp6Bound;
|
||||||
} else {
|
} else {
|
||||||
@ -2235,7 +2207,6 @@ Dhcp6HandleReplyMsg (
|
|||||||
}
|
}
|
||||||
|
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
|
|
||||||
} else if (Option != NULL) {
|
} else if (Option != NULL) {
|
||||||
//
|
//
|
||||||
// Any error status code option is found.
|
// Any error status code option is found.
|
||||||
@ -2259,6 +2230,7 @@ Dhcp6HandleReplyMsg (
|
|||||||
FreePool (Instance->Unicast);
|
FreePool (Instance->Unicast);
|
||||||
Instance->Unicast = NULL;
|
Instance->Unicast = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Dhcp6StsNotOnLink:
|
case Dhcp6StsNotOnLink:
|
||||||
@ -2279,10 +2251,11 @@ Dhcp6HandleReplyMsg (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Dhcp6StsNoBinding:
|
case Dhcp6StsNoBinding:
|
||||||
if (Instance->IaCb.Ia->State == Dhcp6Renewing || Instance->IaCb.Ia->State == Dhcp6Rebinding) {
|
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
|
// 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.
|
// sends a Request message if the IA contained a Status Code option with the NoBinding status.
|
||||||
@ -2292,6 +2265,7 @@ Dhcp6HandleReplyMsg (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2317,7 +2291,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Select the appointed Dhcp6 advertisement message.
|
Select the appointed Dhcp6 advertisement message.
|
||||||
|
|
||||||
@ -2376,7 +2349,6 @@ Dhcp6SelectAdvertiseMsg (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (Option != NULL) {
|
if (Option != NULL) {
|
||||||
|
|
||||||
Instance->Unicast = AllocateZeroPool (sizeof (EFI_IPv6_ADDRESS));
|
Instance->Unicast = AllocateZeroPool (sizeof (EFI_IPv6_ADDRESS));
|
||||||
|
|
||||||
if (Instance->Unicast == NULL) {
|
if (Instance->Unicast == NULL) {
|
||||||
@ -2401,7 +2373,6 @@ Dhcp6SelectAdvertiseMsg (
|
|||||||
return Dhcp6SendRequestMsg (Instance);
|
return Dhcp6SendRequestMsg (Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle with the Dhcp6 advertisement message.
|
Handle with the Dhcp6 advertisement message.
|
||||||
|
|
||||||
@ -2441,8 +2412,7 @@ Dhcp6HandleAdvertiseMsg (
|
|||||||
Dhcp6OptRapidCommit
|
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);
|
return Dhcp6HandleReplyMsg (Instance, Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2490,12 +2460,11 @@ Dhcp6HandleAdvertiseMsg (
|
|||||||
CopyMem (Instance->AdSelect, Packet, Packet->Size);
|
CopyMem (Instance->AdSelect, Packet, Packet->Size);
|
||||||
|
|
||||||
Instance->AdPref = 0xff;
|
Instance->AdPref = 0xff;
|
||||||
|
|
||||||
} else if (Status == EFI_NOT_READY) {
|
} else if (Status == EFI_NOT_READY) {
|
||||||
//
|
//
|
||||||
// Not_ready means user wants to continue to receive more advertise packets.
|
// 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
|
// 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
|
// rt timeout and no advertisement received, which means any advertisement
|
||||||
@ -2514,7 +2483,7 @@ Dhcp6HandleAdvertiseMsg (
|
|||||||
Dhcp6OptPreference
|
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
|
// No advertisements received before or preference is more than other
|
||||||
// advertisements received before. Then store the new packet and the
|
// advertisements received before. Then store the new packet and the
|
||||||
@ -2541,7 +2510,6 @@ Dhcp6HandleAdvertiseMsg (
|
|||||||
// preference is less than other advertisements received before.
|
// preference is less than other advertisements received before.
|
||||||
// Leave the packet alone.
|
// Leave the packet alone.
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Other error status means termination.
|
// Other error status means termination.
|
||||||
@ -2554,14 +2522,13 @@ Dhcp6HandleAdvertiseMsg (
|
|||||||
// RT has elapsed, or get a highest preference 255 advertise.
|
// RT has elapsed, or get a highest preference 255 advertise.
|
||||||
// See details in the section-17.1.2 of rfc-3315.
|
// 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);
|
Status = Dhcp6SelectAdvertiseMsg (Instance, Instance->AdSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The Dhcp6 stateful exchange process routine.
|
The Dhcp6 stateful exchange process routine.
|
||||||
|
|
||||||
@ -2595,7 +2562,7 @@ Dhcp6HandleStateful (
|
|||||||
//
|
//
|
||||||
// Discard the packet if not advertisement or reply packet.
|
// 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;
|
goto ON_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2608,7 +2575,7 @@ Dhcp6HandleStateful (
|
|||||||
Dhcp6OptClientId
|
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;
|
goto ON_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2649,6 +2616,7 @@ Dhcp6HandleStateful (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//
|
//
|
||||||
@ -2673,7 +2641,6 @@ ON_EXIT:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The Dhcp6 stateless exchange process routine.
|
The Dhcp6 stateless exchange process routine.
|
||||||
|
|
||||||
@ -2776,7 +2743,6 @@ ON_EXIT:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The receive callback function for Dhcp6 exchange process.
|
The receive callback function for Dhcp6 exchange process.
|
||||||
|
|
||||||
@ -2848,11 +2814,9 @@ Dhcp6ReceivePacket (
|
|||||||
// Dispatch packet to right instance by transaction id.
|
// Dispatch packet to right instance by transaction id.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry1, Next1, &Service->Child) {
|
NET_LIST_FOR_EACH_SAFE (Entry1, Next1, &Service->Child) {
|
||||||
|
|
||||||
Instance = NET_LIST_USER_STRUCT (Entry1, DHCP6_INSTANCE, Link);
|
Instance = NET_LIST_USER_STRUCT (Entry1, DHCP6_INSTANCE, Link);
|
||||||
|
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry2, Next2, &Instance->TxList) {
|
NET_LIST_FOR_EACH_SAFE (Entry2, Next2, &Instance->TxList) {
|
||||||
|
|
||||||
TxCb = NET_LIST_USER_STRUCT (Entry2, DHCP6_TX_CB, Link);
|
TxCb = NET_LIST_USER_STRUCT (Entry2, DHCP6_TX_CB, Link);
|
||||||
|
|
||||||
if (Packet->Dhcp6.Header.TransactionId == TxCb->Xid) {
|
if (Packet->Dhcp6.Header.TransactionId == TxCb->Xid) {
|
||||||
@ -2863,6 +2827,7 @@ Dhcp6ReceivePacket (
|
|||||||
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
|
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
|
||||||
IsStateless = TRUE;
|
IsStateless = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsDispatched = TRUE;
|
IsDispatched = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2963,10 +2928,10 @@ Dhcp6LinkMovDetect (
|
|||||||
if (!MediaPresent && Instance->MediaPresent) {
|
if (!MediaPresent && Instance->MediaPresent) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The timer routine of the Dhcp6 instance for each second.
|
The timer routine of the Dhcp6 instance for each second.
|
||||||
|
|
||||||
@ -2998,7 +2963,6 @@ Dhcp6OnTimerTick (
|
|||||||
// need re-transmit or not.
|
// need re-transmit or not.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
|
||||||
|
|
||||||
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
|
||||||
|
|
||||||
TxCb->TickTime++;
|
TxCb->TickTime++;
|
||||||
@ -3007,7 +2971,7 @@ Dhcp6OnTimerTick (
|
|||||||
//
|
//
|
||||||
// Handle the first rt in the transmission of solicit specially.
|
// 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) {
|
if (Instance->AdSelect == NULL) {
|
||||||
//
|
//
|
||||||
// Set adpref as 0xff here to indicate select any advertisement
|
// Set adpref as 0xff here to indicate select any advertisement
|
||||||
@ -3024,9 +2988,11 @@ Dhcp6OnTimerTick (
|
|||||||
} else if (EFI_ERROR (Status)) {
|
} else if (EFI_ERROR (Status)) {
|
||||||
TxCb->RetryCnt++;
|
TxCb->RetryCnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Increase the retry count for the packet and add up the total loss time.
|
// Increase the retry count for the packet and add up the total loss time.
|
||||||
//
|
//
|
||||||
@ -3036,7 +3002,7 @@ Dhcp6OnTimerTick (
|
|||||||
//
|
//
|
||||||
// Check whether overflow the max retry count limit for this packet
|
// 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;
|
Status = EFI_NO_RESPONSE;
|
||||||
goto ON_CLOSE;
|
goto ON_CLOSE;
|
||||||
}
|
}
|
||||||
@ -3044,7 +3010,7 @@ Dhcp6OnTimerTick (
|
|||||||
//
|
//
|
||||||
// Check whether overflow the max retry duration for this packet
|
// 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;
|
Status = EFI_NO_RESPONSE;
|
||||||
goto ON_CLOSE;
|
goto ON_CLOSE;
|
||||||
}
|
}
|
||||||
@ -3061,7 +3027,7 @@ Dhcp6OnTimerTick (
|
|||||||
TRUE
|
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->RetryExp = Dhcp6CalculateExpireTime (
|
||||||
TxCb->RetryCtl.Mrt,
|
TxCb->RetryCtl.Mrt,
|
||||||
TRUE,
|
TRUE,
|
||||||
@ -3074,7 +3040,7 @@ Dhcp6OnTimerTick (
|
|||||||
// duration time.
|
// duration time.
|
||||||
//
|
//
|
||||||
LossTime = TxCb->RetryLos + TxCb->RetryExp;
|
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;
|
TxCb->RetryExp = TxCb->RetryCtl.Mrd - TxCb->RetryLos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3100,22 +3066,19 @@ Dhcp6OnTimerTick (
|
|||||||
//
|
//
|
||||||
IaCb = &Instance->IaCb;
|
IaCb = &Instance->IaCb;
|
||||||
|
|
||||||
if (Instance->Config == NULL || IaCb->Ia == NULL) {
|
if ((Instance->Config == NULL) || (IaCb->Ia == NULL)) {
|
||||||
return;
|
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++;
|
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.
|
// Exceed t2, send rebind packet to extend the Ia lease.
|
||||||
//
|
//
|
||||||
Dhcp6SendRenewRebindMsg (Instance, TRUE);
|
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.
|
// Exceed t1, send renew packet to extend the Ia lease.
|
||||||
//
|
//
|
||||||
@ -3136,25 +3099,29 @@ Dhcp6OnTimerTick (
|
|||||||
ON_CLOSE:
|
ON_CLOSE:
|
||||||
|
|
||||||
if (Dhcp6IsValidTxCb (Instance, TxCb) &&
|
if (Dhcp6IsValidTxCb (Instance, TxCb) &&
|
||||||
TxCb->TxPacket != NULL &&
|
(TxCb->TxPacket != NULL) &&
|
||||||
(TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
|
((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) ||
|
||||||
TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew ||
|
(TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
|
||||||
TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)
|
(TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The failure of renew/Confirm will still switch to the bound state.
|
// The failure of renew/Confirm will still switch to the bound state.
|
||||||
//
|
//
|
||||||
if ((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
|
if ((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
|
||||||
(TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)) {
|
(TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm))
|
||||||
|
{
|
||||||
ASSERT (Instance->IaCb.Ia);
|
ASSERT (Instance->IaCb.Ia);
|
||||||
Instance->IaCb.Ia->State = Dhcp6Bound;
|
Instance->IaCb.Ia->State = Dhcp6Bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The failure of info-request will return no response.
|
// The failure of info-request will return no response.
|
||||||
//
|
//
|
||||||
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
|
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
|
||||||
Instance->UdpSts = EFI_NO_RESPONSE;
|
Instance->UdpSts = EFI_NO_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dhcp6DequeueRetry (
|
Dhcp6DequeueRetry (
|
||||||
Instance,
|
Instance,
|
||||||
TxCb->Xid,
|
TxCb->Xid,
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#ifndef __EFI_DHCP6_IO_H__
|
#ifndef __EFI_DHCP6_IO_H__
|
||||||
#define __EFI_DHCP6_IO_H__
|
#define __EFI_DHCP6_IO_H__
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the specific nodes in the retry list.
|
Clean up the specific nodes in the retry list.
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "Dhcp6Impl.h"
|
#include "Dhcp6Impl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generate client Duid in the format of Duid-llt.
|
Generate client Duid in the format of Duid-llt.
|
||||||
|
|
||||||
@ -31,7 +30,6 @@ Dhcp6GenerateClientId (
|
|||||||
UINT32 Stamp;
|
UINT32 Stamp;
|
||||||
EFI_GUID Uuid;
|
EFI_GUID Uuid;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attempt to get client Id from variable to keep it constant.
|
// Attempt to get client Id from variable to keep it constant.
|
||||||
// See details in section-9 of rfc-3315.
|
// See details in section-9 of rfc-3315.
|
||||||
@ -92,9 +90,7 @@ Dhcp6GenerateClientId (
|
|||||||
WriteUnaligned16 ((UINT16 *)(Duid->Duid), HTONS (Dhcp6DuidTypeUuid));
|
WriteUnaligned16 ((UINT16 *)(Duid->Duid), HTONS (Dhcp6DuidTypeUuid));
|
||||||
|
|
||||||
CopyMem (Duid->Duid + 2, &Uuid, sizeof (EFI_GUID));
|
CopyMem (Duid->Duid + 2, &Uuid, sizeof (EFI_GUID));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// The format of DUID-LLT:
|
// The format of DUID-LLT:
|
||||||
@ -160,7 +156,6 @@ Dhcp6GenerateClientId (
|
|||||||
return Duid;
|
return Duid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Copy the Dhcp6 configure data.
|
Copy the Dhcp6 configure data.
|
||||||
|
|
||||||
@ -187,7 +182,6 @@ Dhcp6CopyConfigData (
|
|||||||
// Allocate another buffer for solicitretransmission, and copy it.
|
// Allocate another buffer for solicitretransmission, and copy it.
|
||||||
//
|
//
|
||||||
if (SorCfg->SolicitRetransmission != NULL) {
|
if (SorCfg->SolicitRetransmission != NULL) {
|
||||||
|
|
||||||
DstCfg->SolicitRetransmission = AllocateZeroPool (sizeof (EFI_DHCP6_RETRANSMISSION));
|
DstCfg->SolicitRetransmission = AllocateZeroPool (sizeof (EFI_DHCP6_RETRANSMISSION));
|
||||||
|
|
||||||
if (DstCfg->SolicitRetransmission == NULL) {
|
if (DstCfg->SolicitRetransmission == NULL) {
|
||||||
@ -204,8 +198,7 @@ Dhcp6CopyConfigData (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SorCfg->OptionList != NULL && SorCfg->OptionCount != 0) {
|
if ((SorCfg->OptionList != NULL) && (SorCfg->OptionCount != 0)) {
|
||||||
|
|
||||||
OptionListSize = SorCfg->OptionCount * sizeof (EFI_DHCP6_PACKET_OPTION *);
|
OptionListSize = SorCfg->OptionCount * sizeof (EFI_DHCP6_PACKET_OPTION *);
|
||||||
DstCfg->OptionList = AllocateZeroPool (OptionListSize);
|
DstCfg->OptionList = AllocateZeroPool (OptionListSize);
|
||||||
|
|
||||||
@ -217,7 +210,6 @@ Dhcp6CopyConfigData (
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < SorCfg->OptionCount; Index++) {
|
for (Index = 0; Index < SorCfg->OptionCount; Index++) {
|
||||||
|
|
||||||
OptionSize = NTOHS (SorCfg->OptionList[Index]->OpLen) + 4;
|
OptionSize = NTOHS (SorCfg->OptionList[Index]->OpLen) + 4;
|
||||||
DstCfg->OptionList[Index] = AllocateZeroPool (OptionSize);
|
DstCfg->OptionList[Index] = AllocateZeroPool (OptionSize);
|
||||||
|
|
||||||
@ -239,7 +231,6 @@ Dhcp6CopyConfigData (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the configure data.
|
Clean up the configure data.
|
||||||
|
|
||||||
@ -264,6 +255,7 @@ Dhcp6CleanupConfigData (
|
|||||||
FreePool (CfgData->OptionList[Index]);
|
FreePool (CfgData->OptionList[Index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (CfgData->OptionList);
|
FreePool (CfgData->OptionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +266,6 @@ Dhcp6CleanupConfigData (
|
|||||||
ZeroMem (CfgData, sizeof (EFI_DHCP6_CONFIG_DATA));
|
ZeroMem (CfgData, sizeof (EFI_DHCP6_CONFIG_DATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the mode data.
|
Clean up the mode data.
|
||||||
|
|
||||||
@ -296,17 +287,16 @@ Dhcp6CleanupModeData (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ModeData->Ia != NULL) {
|
if (ModeData->Ia != NULL) {
|
||||||
|
|
||||||
if (ModeData->Ia->ReplyPacket != NULL) {
|
if (ModeData->Ia->ReplyPacket != NULL) {
|
||||||
FreePool (ModeData->Ia->ReplyPacket);
|
FreePool (ModeData->Ia->ReplyPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (ModeData->Ia);
|
FreePool (ModeData->Ia);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (ModeData, sizeof (EFI_DHCP6_MODE_DATA));
|
ZeroMem (ModeData, sizeof (EFI_DHCP6_MODE_DATA));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate the expire time by the algorithm defined in rfc.
|
Calculate the expire time by the algorithm defined in rfc.
|
||||||
|
|
||||||
@ -348,19 +338,12 @@ Dhcp6CalculateExpireTime (
|
|||||||
// The (Seed / 0x3ff / 10) is used to a random range (0, 0.1).
|
// The (Seed / 0x3ff / 10) is used to a random range (0, 0.1).
|
||||||
//
|
//
|
||||||
if (IsFirstRt && Signed) {
|
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) {
|
} 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) {
|
} 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 {
|
} else {
|
||||||
|
|
||||||
Expire = 2 * Base + (UINT32)(Base * Seed / DHCP6_10_BIT_MASK / 10);
|
Expire = 2 * Base + (UINT32)(Base * Seed / DHCP6_10_BIT_MASK / 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +352,6 @@ Dhcp6CalculateExpireTime (
|
|||||||
return Expire;
|
return Expire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate the lease time by the algorithm defined in rfc.
|
Calculate the lease time by the algorithm defined in rfc.
|
||||||
|
|
||||||
@ -409,7 +391,6 @@ Dhcp6CalculateLeaseTime (
|
|||||||
IaCb->LeaseTime = 0;
|
IaCb->LeaseTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether the addresses are all included by the configured Ia.
|
Check whether the addresses are all included by the configured Ia.
|
||||||
|
|
||||||
@ -437,17 +418,15 @@ Dhcp6CheckAddress (
|
|||||||
// will return success if address count is zero, which means all addresses.
|
// will return success if address count is zero, which means all addresses.
|
||||||
//
|
//
|
||||||
for (Index1 = 0; Index1 < AddressCount; Index1++) {
|
for (Index1 = 0; Index1 < AddressCount; Index1++) {
|
||||||
|
|
||||||
Found = FALSE;
|
Found = FALSE;
|
||||||
|
|
||||||
for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) {
|
for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) {
|
||||||
|
|
||||||
if (CompareMem (
|
if (CompareMem (
|
||||||
&Addresses[Index1],
|
&Addresses[Index1],
|
||||||
&Ia->IaAddress[Index2],
|
&Ia->IaAddress[Index2],
|
||||||
sizeof (EFI_IPv6_ADDRESS)
|
sizeof (EFI_IPv6_ADDRESS)
|
||||||
) == 0) {
|
) == 0)
|
||||||
|
{
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -461,7 +440,6 @@ Dhcp6CheckAddress (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deprive the addresses from current Ia, and generate another eliminated Ia.
|
Deprive the addresses from current Ia, and generate another eliminated Ia.
|
||||||
|
|
||||||
@ -521,16 +499,15 @@ Dhcp6DepriveAddress (
|
|||||||
// Move the addresses from the Ia of instance to the deprived Ia.
|
// Move the addresses from the Ia of instance to the deprived Ia.
|
||||||
//
|
//
|
||||||
for (Index1 = 0; Index1 < AddressCount; Index1++) {
|
for (Index1 = 0; Index1 < AddressCount; Index1++) {
|
||||||
|
|
||||||
Found = FALSE;
|
Found = FALSE;
|
||||||
|
|
||||||
for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) {
|
for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) {
|
||||||
|
|
||||||
if (CompareMem (
|
if (CompareMem (
|
||||||
&Addresses[Index1],
|
&Addresses[Index1],
|
||||||
&Ia->IaAddress[Index2],
|
&Ia->IaAddress[Index2],
|
||||||
sizeof (EFI_IPv6_ADDRESS)
|
sizeof (EFI_IPv6_ADDRESS)
|
||||||
) == 0) {
|
) == 0)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Copy the deprived address to the copy of Ia
|
// Copy the deprived address to the copy of Ia
|
||||||
//
|
//
|
||||||
@ -549,10 +526,12 @@ Dhcp6DepriveAddress (
|
|||||||
(Ia->IaAddressCount - Index2 - 1) * sizeof (EFI_DHCP6_IA_ADDRESS)
|
(Ia->IaAddressCount - Index2 - 1) * sizeof (EFI_DHCP6_IA_ADDRESS)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Found == TRUE);
|
ASSERT (Found == TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,7 +541,6 @@ Dhcp6DepriveAddress (
|
|||||||
return IaCopy;
|
return IaCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The dummy ext buffer free callback routine.
|
The dummy ext buffer free callback routine.
|
||||||
|
|
||||||
@ -577,7 +555,6 @@ Dhcp6DummyExtFree (
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The callback routine once message transmitted.
|
The callback routine once message transmitted.
|
||||||
|
|
||||||
@ -599,7 +576,6 @@ Dhcp6OnTransmitted (
|
|||||||
NetbufFree (Wrap);
|
NetbufFree (Wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Append the option to Buf, and move Buf to the end.
|
Append the option to Buf, and move Buf to the end.
|
||||||
|
|
||||||
@ -660,7 +636,6 @@ Dhcp6AppendIaAddrOption (
|
|||||||
IN UINT32 MessageType
|
IN UINT32 MessageType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
// The format of the IA Address option is:
|
// The format of the IA Address option is:
|
||||||
//
|
//
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
@ -702,17 +677,18 @@ Dhcp6AppendIaAddrOption (
|
|||||||
if (MessageType != Dhcp6MsgConfirm) {
|
if (MessageType != Dhcp6MsgConfirm) {
|
||||||
WriteUnaligned32 ((UINT32 *)Buf, HTONL (IaAddr->PreferredLifetime));
|
WriteUnaligned32 ((UINT32 *)Buf, HTONL (IaAddr->PreferredLifetime));
|
||||||
}
|
}
|
||||||
|
|
||||||
Buf += 4;
|
Buf += 4;
|
||||||
|
|
||||||
if (MessageType != Dhcp6MsgConfirm) {
|
if (MessageType != Dhcp6MsgConfirm) {
|
||||||
WriteUnaligned32 ((UINT32 *)Buf, HTONL (IaAddr->ValidLifetime));
|
WriteUnaligned32 ((UINT32 *)Buf, HTONL (IaAddr->ValidLifetime));
|
||||||
}
|
}
|
||||||
|
|
||||||
Buf += 4;
|
Buf += 4;
|
||||||
|
|
||||||
return Buf;
|
return Buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Append the appointed Ia option to Buf, and move Buf to the end.
|
Append the appointed Ia option to Buf, and move Buf to the end.
|
||||||
|
|
||||||
@ -902,10 +878,10 @@ SetElapsedTime (
|
|||||||
ElapsedTimeValue = 0xffff;
|
ElapsedTimeValue = 0xffff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteUnaligned16 (Elapsed, HTONS ((UINT16)ElapsedTimeValue));
|
WriteUnaligned16 (Elapsed, HTONS ((UINT16)ElapsedTimeValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Seek the address of the first byte of the option header.
|
Seek the address of the first byte of the option header.
|
||||||
|
|
||||||
@ -941,6 +917,7 @@ Dhcp6SeekOption (
|
|||||||
Option = Cursor;
|
Option = Cursor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
|
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
|
||||||
Cursor += (DataLen + 4);
|
Cursor += (DataLen + 4);
|
||||||
}
|
}
|
||||||
@ -948,7 +925,6 @@ Dhcp6SeekOption (
|
|||||||
return Option;
|
return Option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Seek the address of the first byte of the Ia option header.
|
Seek the address of the first byte of the Ia option header.
|
||||||
|
|
||||||
@ -982,10 +958,11 @@ Dhcp6SeekIaOption (
|
|||||||
while (Cursor < Buf + SeekLen) {
|
while (Cursor < Buf + SeekLen) {
|
||||||
OpCode = ReadUnaligned16 ((UINT16 *)Cursor);
|
OpCode = ReadUnaligned16 ((UINT16 *)Cursor);
|
||||||
IaId = ReadUnaligned32 ((UINT32 *)(Cursor + 4));
|
IaId = ReadUnaligned32 ((UINT32 *)(Cursor + 4));
|
||||||
if (OpCode == HTONS (IaDesc->Type) && IaId == HTONL (IaDesc->IaId)) {
|
if ((OpCode == HTONS (IaDesc->Type)) && (IaId == HTONL (IaDesc->IaId))) {
|
||||||
Option = Cursor;
|
Option = Cursor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
|
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
|
||||||
Cursor += (DataLen + 4);
|
Cursor += (DataLen + 4);
|
||||||
}
|
}
|
||||||
@ -1019,6 +996,7 @@ Dhcp6AddrIsInCurrentIa (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1090,22 +1068,24 @@ Dhcp6ParseAddrOption (
|
|||||||
PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *)(Cursor + 20)));
|
PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *)(Cursor + 20)));
|
||||||
ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *)(Cursor + 24)));
|
ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *)(Cursor + 24)));
|
||||||
IaAddr = (EFI_DHCP6_IA_ADDRESS *)(Cursor + 4);
|
IaAddr = (EFI_DHCP6_IA_ADDRESS *)(Cursor + 4);
|
||||||
if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt >= PreferredLt &&
|
if ((OpCode == HTONS (Dhcp6OptIaAddr)) && (ValidLt >= PreferredLt) &&
|
||||||
(Dhcp6AddrIsInCurrentIa(IaAddr, CurrentIa) || ValidLt !=0)) {
|
(Dhcp6AddrIsInCurrentIa (IaAddr, CurrentIa) || (ValidLt != 0)))
|
||||||
|
{
|
||||||
if (AddrBuf != NULL) {
|
if (AddrBuf != NULL) {
|
||||||
CopyMem (AddrBuf, IaAddr, sizeof (EFI_DHCP6_IA_ADDRESS));
|
CopyMem (AddrBuf, IaAddr, sizeof (EFI_DHCP6_IA_ADDRESS));
|
||||||
AddrBuf->PreferredLifetime = PreferredLt;
|
AddrBuf->PreferredLifetime = PreferredLt;
|
||||||
AddrBuf->ValidLifetime = ValidLt;
|
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)++;
|
(*AddrNum)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
|
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *)(Cursor + 2)));
|
||||||
Cursor += (DataLen + 4);
|
Cursor += (DataLen + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a control block for the Ia according to the corresponding options.
|
Create a control block for the Ia according to the corresponding options.
|
||||||
|
|
||||||
@ -1172,8 +1152,8 @@ Dhcp6GenerateIaCb (
|
|||||||
if (Instance->IaCb.Ia->ReplyPacket != NULL) {
|
if (Instance->IaCb.Ia->ReplyPacket != NULL) {
|
||||||
FreePool (Instance->IaCb.Ia->ReplyPacket);
|
FreePool (Instance->IaCb.Ia->ReplyPacket);
|
||||||
}
|
}
|
||||||
FreePool (Instance->IaCb.Ia);
|
|
||||||
|
|
||||||
|
FreePool (Instance->IaCb.Ia);
|
||||||
|
|
||||||
ZeroMem (&Instance->IaCb, sizeof (DHCP6_IA_CB));
|
ZeroMem (&Instance->IaCb, sizeof (DHCP6_IA_CB));
|
||||||
|
|
||||||
@ -1193,7 +1173,6 @@ Dhcp6GenerateIaCb (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cache the current IA configuration information.
|
Cache the current IA configuration information.
|
||||||
|
|
||||||
@ -1223,8 +1202,10 @@ Dhcp6CacheIa (
|
|||||||
if (Instance->CacheIa == NULL) {
|
if (Instance->CacheIa == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Instance->CacheIa, Ia, IaSize);
|
CopyMem (Instance->CacheIa, Ia, IaSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1303,7 +1284,7 @@ Dhcp6GetMappingTimeOut (
|
|||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
|
EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS DadXmits;
|
||||||
|
|
||||||
if (Ip6Cfg == NULL || TimeOut == NULL) {
|
if ((Ip6Cfg == NULL) || (TimeOut == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#ifndef __EFI_DHCP6_UTILITY_H__
|
#ifndef __EFI_DHCP6_UTILITY_H__
|
||||||
#define __EFI_DHCP6_UTILITY_H__
|
#define __EFI_DHCP6_UTILITY_H__
|
||||||
|
|
||||||
|
|
||||||
#define DHCP6_10_BIT_MASK 0x3ff
|
#define DHCP6_10_BIT_MASK 0x3ff
|
||||||
#define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
|
#define DHCP6_DAD_ADDITIONAL_DELAY 30000000 // 3 seconds
|
||||||
|
|
||||||
@ -310,7 +309,6 @@ Dhcp6GenerateIaCb (
|
|||||||
IN UINT32 T2
|
IN UINT32 T2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cache the current IA configuration information.
|
Cache the current IA configuration information.
|
||||||
|
|
||||||
@ -325,7 +323,6 @@ Dhcp6CacheIa (
|
|||||||
IN DHCP6_INSTANCE *Instance
|
IN DHCP6_INSTANCE *Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Append CacheIa to the current IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
|
Append CacheIa to the current IA. Meanwhile, clear CacheIa.ValidLifetime to 0.
|
||||||
|
|
||||||
@ -351,4 +348,5 @@ Dhcp6GetMappingTimeOut (
|
|||||||
IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
|
IN EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg,
|
||||||
OUT UINTN *TimeOut
|
OUT UINTN *TimeOut
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
|
Retrieves a Unicode string that is the user-readable name of the EFI Driver.
|
||||||
|
|
||||||
@ -91,7 +92,6 @@ DnsComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Component Name Protocol instance
|
/// Component Name Protocol instance
|
||||||
///
|
///
|
||||||
@ -208,6 +208,7 @@ UpdateDns4Name (
|
|||||||
if (ModeData.DnsCacheList != NULL) {
|
if (ModeData.DnsCacheList != NULL) {
|
||||||
FreePool (ModeData.DnsCacheList);
|
FreePool (ModeData.DnsCacheList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModeData.DnsServerList != NULL) {
|
if (ModeData.DnsServerList != NULL) {
|
||||||
FreePool (ModeData.DnsServerList);
|
FreePool (ModeData.DnsServerList);
|
||||||
}
|
}
|
||||||
@ -274,6 +275,7 @@ UpdateDns6Name (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
HandleName,
|
HandleName,
|
||||||
sizeof (HandleName),
|
sizeof (HandleName),
|
||||||
@ -285,6 +287,7 @@ UpdateDns6Name (
|
|||||||
if (ModeData.DnsCacheList != NULL) {
|
if (ModeData.DnsCacheList != NULL) {
|
||||||
FreePool (ModeData.DnsCacheList);
|
FreePool (ModeData.DnsCacheList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModeData.DnsServerList != NULL) {
|
if (ModeData.DnsServerList != NULL) {
|
||||||
FreePool (ModeData.DnsServerList);
|
FreePool (ModeData.DnsServerList);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,6 @@ ParseDhcp4Ack (
|
|||||||
// Get DNS server addresses
|
// Get DNS server addresses
|
||||||
//
|
//
|
||||||
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
|
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
|
||||||
|
|
||||||
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
|
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
break;
|
break;
|
||||||
@ -211,7 +210,6 @@ ParseDhcp6Ack (
|
|||||||
// Get DNS server addresses from this reply packet.
|
// Get DNS server addresses from this reply packet.
|
||||||
//
|
//
|
||||||
if (OptionList[Index]->OpCode == DHCP6_TAG_DNS_SERVER) {
|
if (OptionList[Index]->OpCode == DHCP6_TAG_DNS_SERVER) {
|
||||||
|
|
||||||
if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {
|
if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
gBS->FreePool (OptionList);
|
gBS->FreePool (OptionList);
|
||||||
@ -237,7 +235,6 @@ ParseDhcp6Ack (
|
|||||||
gBS->FreePool (OptionList);
|
gBS->FreePool (OptionList);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -391,7 +388,7 @@ GetDns4ServerFromDhcp4 (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status = Ip4Config2->GetData (Ip4Config2, Ip4Config2DataTypeInterfaceInfo, &DataSize, Data);
|
Status = Ip4Config2->GetData (Ip4Config2, Ip4Config2DataTypeInterfaceInfo, &DataSize, Data);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,6 +750,4 @@ ON_EXIT:
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define DHCP4_TAG_PARA_LIST 55
|
#define DHCP4_TAG_PARA_LIST 55
|
||||||
#define DHCP4_TAG_DNS_SERVER 6
|
#define DHCP4_TAG_DNS_SERVER 6
|
||||||
|
|
||||||
|
|
||||||
#define DHCP6_TAG_DNS_REQUEST 6
|
#define DHCP6_TAG_DNS_REQUEST 6
|
||||||
#define DHCP6_TAG_DNS_SERVER 23
|
#define DHCP6_TAG_DNS_SERVER 23
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ DnsDestroyChildEntryInHandleBuffer (
|
|||||||
UINTN NumberOfChildren;
|
UINTN NumberOfChildren;
|
||||||
EFI_HANDLE *ChildHandleBuffer;
|
EFI_HANDLE *ChildHandleBuffer;
|
||||||
|
|
||||||
if (Entry == NULL || Context == NULL) {
|
if ((Entry == NULL) || (Context == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,6 +299,7 @@ DnsCreateService (
|
|||||||
if (DnsSb->TimerToGetMap != NULL) {
|
if (DnsSb->TimerToGetMap != NULL) {
|
||||||
gBS->CloseEvent (DnsSb->TimerToGetMap);
|
gBS->CloseEvent (DnsSb->TimerToGetMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (DnsSb);
|
FreePool (DnsSb);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -315,6 +316,7 @@ DnsCreateService (
|
|||||||
if (DnsSb->TimerToGetMap != NULL) {
|
if (DnsSb->TimerToGetMap != NULL) {
|
||||||
gBS->CloseEvent (DnsSb->TimerToGetMap);
|
gBS->CloseEvent (DnsSb->TimerToGetMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseEvent (DnsSb->Timer);
|
gBS->CloseEvent (DnsSb->Timer);
|
||||||
FreePool (DnsSb);
|
FreePool (DnsSb);
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
@ -760,7 +762,7 @@ Dns4DriverBindingStop (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberOfChildren == 0 && IsListEmpty (&DnsSb->Dns4ChildrenList)) {
|
if ((NumberOfChildren == 0) && IsListEmpty (&DnsSb->Dns4ChildrenList)) {
|
||||||
gBS->UninstallProtocolInterface (
|
gBS->UninstallProtocolInterface (
|
||||||
NicHandle,
|
NicHandle,
|
||||||
&gEfiDns4ServiceBindingProtocolGuid,
|
&gEfiDns4ServiceBindingProtocolGuid,
|
||||||
@ -1025,7 +1027,7 @@ Dns6DriverBindingStop (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberOfChildren == 0 && IsListEmpty (&DnsSb->Dns6ChildrenList)) {
|
if ((NumberOfChildren == 0) && IsListEmpty (&DnsSb->Dns6ChildrenList)) {
|
||||||
gBS->UninstallProtocolInterface (
|
gBS->UninstallProtocolInterface (
|
||||||
NicHandle,
|
NicHandle,
|
||||||
&gEfiDns6ServiceBindingProtocolGuid,
|
&gEfiDns6ServiceBindingProtocolGuid,
|
||||||
@ -1087,6 +1089,7 @@ Dns4ServiceBindingCreateChild (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Instance != NULL);
|
ASSERT (Instance != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1330,6 +1333,7 @@ Dns6ServiceBindingCreateChild (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Instance != NULL);
|
ASSERT (Instance != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -103,7 +103,6 @@ extern DNS_DRIVER_DATA *mDriverData;
|
|||||||
#define DNS_INSTANCE_FROM_THIS_PROTOCOL6(a) \
|
#define DNS_INSTANCE_FROM_THIS_PROTOCOL6(a) \
|
||||||
CR (a, DNS_INSTANCE, Dns6, DNS_INSTANCE_SIGNATURE)
|
CR (a, DNS_INSTANCE, Dns6, DNS_INSTANCE_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy the DNS instance and recycle the resources.
|
Destroy the DNS instance and recycle the resources.
|
||||||
|
|
||||||
@ -594,5 +593,4 @@ Dns6ServiceBindingDestroyChild (
|
|||||||
IN EFI_HANDLE ChildHandle
|
IN EFI_HANDLE ChildHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -315,6 +315,7 @@ Dns4InstanceCancelToken (
|
|||||||
if (NetMapIsEmpty (&Instance->Dns4TxTokens)) {
|
if (NetMapIsEmpty (&Instance->Dns4TxTokens)) {
|
||||||
Instance->UdpIo->Protocol.Udp4->Cancel (Instance->UdpIo->Protocol.Udp4, &Instance->UdpIo->RecvRequest->Token.Udp4);
|
Instance->UdpIo->Protocol.Udp4->Cancel (Instance->UdpIo->Protocol.Udp4, &Instance->UdpIo->RecvRequest->Token.Udp4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,6 +373,7 @@ Dns6InstanceCancelToken (
|
|||||||
if (NetMapIsEmpty (&Instance->Dns6TxTokens)) {
|
if (NetMapIsEmpty (&Instance->Dns6TxTokens)) {
|
||||||
Instance->UdpIo->Protocol.Udp6->Cancel (Instance->UdpIo->Protocol.Udp6, &Instance->UdpIo->RecvRequest->Token.Udp6);
|
Instance->UdpIo->Protocol.Udp6->Cancel (Instance->UdpIo->Protocol.Udp6, &Instance->UdpIo->RecvRequest->Token.Udp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,8 +565,8 @@ Dns4GetMapping (
|
|||||||
Udp->Poll (Udp);
|
Udp->Poll (Udp);
|
||||||
|
|
||||||
if (!EFI_ERROR (Udp->GetModeData (Udp, NULL, &Ip4Mode, NULL, NULL)) &&
|
if (!EFI_ERROR (Udp->GetModeData (Udp, NULL, &Ip4Mode, NULL, NULL)) &&
|
||||||
Ip4Mode.IsConfigured) {
|
Ip4Mode.IsConfigured)
|
||||||
|
{
|
||||||
Udp->Configure (Udp, NULL);
|
Udp->Configure (Udp, NULL);
|
||||||
return (BOOLEAN)(Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS);
|
return (BOOLEAN)(Udp->Configure (Udp, UdpCfgData) == EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -776,8 +778,9 @@ UpdateDns4Cache (
|
|||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, Dns4CacheList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, Next, Dns4CacheList) {
|
||||||
Item = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
|
Item = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
|
||||||
if (StrCmp (DnsCacheEntry.HostName, Item->DnsCache.HostName) == 0 && \
|
if ((StrCmp (DnsCacheEntry.HostName, Item->DnsCache.HostName) == 0) && \
|
||||||
CompareMem (DnsCacheEntry.IpAddress, Item->DnsCache.IpAddress, sizeof (EFI_IPv4_ADDRESS)) == 0) {
|
(CompareMem (DnsCacheEntry.IpAddress, Item->DnsCache.IpAddress, sizeof (EFI_IPv4_ADDRESS)) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// This is the Dns cache entry
|
// This is the Dns cache entry
|
||||||
//
|
//
|
||||||
@ -874,8 +877,9 @@ UpdateDns6Cache (
|
|||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, Dns6CacheList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, Next, Dns6CacheList) {
|
||||||
Item = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
|
Item = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
|
||||||
if (StrCmp (DnsCacheEntry.HostName, Item->DnsCache.HostName) == 0 && \
|
if ((StrCmp (DnsCacheEntry.HostName, Item->DnsCache.HostName) == 0) && \
|
||||||
CompareMem (DnsCacheEntry.IpAddress, Item->DnsCache.IpAddress, sizeof (EFI_IPv6_ADDRESS)) == 0) {
|
(CompareMem (DnsCacheEntry.IpAddress, Item->DnsCache.IpAddress, sizeof (EFI_IPv6_ADDRESS)) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// This is the Dns cache entry
|
// This is the Dns cache entry
|
||||||
//
|
//
|
||||||
@ -1081,7 +1085,6 @@ IsValidDnsResponse (
|
|||||||
*Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);
|
*Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);
|
||||||
Packet = (NET_BUF *)((*Item)->Value);
|
Packet = (NET_BUF *)((*Item)->Value);
|
||||||
if (Packet == NULL) {
|
if (Packet == NULL) {
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
TxString = NetbufGetByte (Packet, 0, NULL);
|
TxString = NetbufGetByte (Packet, 0, NULL);
|
||||||
@ -1090,9 +1093,10 @@ IsValidDnsResponse (
|
|||||||
QueryName = (CHAR8 *)(TxString + sizeof (*DnsHeader));
|
QueryName = (CHAR8 *)(TxString + sizeof (*DnsHeader));
|
||||||
QuerySection = (DNS_QUERY_SECTION *)(QueryName + AsciiStrLen (QueryName) + 1);
|
QuerySection = (DNS_QUERY_SECTION *)(QueryName + AsciiStrLen (QueryName) + 1);
|
||||||
|
|
||||||
if (NTOHS (DnsHeader->Identification) == Identification &&
|
if ((NTOHS (DnsHeader->Identification) == Identification) &&
|
||||||
NTOHS (QuerySection->Type) == Type &&
|
(NTOHS (QuerySection->Type) == Type) &&
|
||||||
NTOHS (QuerySection->Class) == Class) {
|
(NTOHS (QuerySection->Class) == Class))
|
||||||
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1245,11 +1249,13 @@ ParseDnsResponse (
|
|||||||
QuerySection->Type,
|
QuerySection->Type,
|
||||||
QuerySection->Class,
|
QuerySection->Class,
|
||||||
&Item
|
&Item
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
*Completed = FALSE;
|
*Completed = FALSE;
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Item != NULL);
|
ASSERT (Item != NULL);
|
||||||
Dns4TokenEntry = (DNS4_TOKEN_ENTRY *)(Item->Key);
|
Dns4TokenEntry = (DNS4_TOKEN_ENTRY *)(Item->Key);
|
||||||
} else {
|
} else {
|
||||||
@ -1259,11 +1265,13 @@ ParseDnsResponse (
|
|||||||
QuerySection->Type,
|
QuerySection->Type,
|
||||||
QuerySection->Class,
|
QuerySection->Class,
|
||||||
&Item
|
&Item
|
||||||
)) {
|
))
|
||||||
|
{
|
||||||
*Completed = FALSE;
|
*Completed = FALSE;
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Item != NULL);
|
ASSERT (Item != NULL);
|
||||||
Dns6TokenEntry = (DNS6_TOKEN_ENTRY *)(Item->Key);
|
Dns6TokenEntry = (DNS6_TOKEN_ENTRY *)(Item->Key);
|
||||||
}
|
}
|
||||||
@ -1271,8 +1279,9 @@ ParseDnsResponse (
|
|||||||
//
|
//
|
||||||
// Continue Check Some Errors.
|
// Continue Check Some Errors.
|
||||||
//
|
//
|
||||||
if (DnsHeader->Flags.Bits.RCode != DNS_FLAGS_RCODE_NO_ERROR || DnsHeader->AnswersNum < 1 || \
|
if ((DnsHeader->Flags.Bits.RCode != DNS_FLAGS_RCODE_NO_ERROR) || (DnsHeader->AnswersNum < 1) || \
|
||||||
DnsHeader->Flags.Bits.QR != DNS_FLAGS_QR_RESPONSE) {
|
(DnsHeader->Flags.Bits.QR != DNS_FLAGS_QR_RESPONSE))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// The domain name referenced in the query does not exist.
|
// The domain name referenced in the query does not exist.
|
||||||
//
|
//
|
||||||
@ -1300,6 +1309,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns4TokenEntry->Token->RspData.GLookupData->RRList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD));
|
Dns4TokenEntry->Token->RspData.GLookupData->RRList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD));
|
||||||
if (Dns4TokenEntry->Token->RspData.GLookupData->RRList == NULL) {
|
if (Dns4TokenEntry->Token->RspData.GLookupData->RRList == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
@ -1315,6 +1325,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns4TokenEntry->Token->RspData.H2AData->IpList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (EFI_IPv4_ADDRESS));
|
Dns4TokenEntry->Token->RspData.H2AData->IpList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (EFI_IPv4_ADDRESS));
|
||||||
if (Dns4TokenEntry->Token->RspData.H2AData->IpList == NULL) {
|
if (Dns4TokenEntry->Token->RspData.H2AData->IpList == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
@ -1337,6 +1348,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns6TokenEntry->Token->RspData.GLookupData->RRList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD));
|
Dns6TokenEntry->Token->RspData.GLookupData->RRList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (DNS_RESOURCE_RECORD));
|
||||||
if (Dns6TokenEntry->Token->RspData.GLookupData->RRList == NULL) {
|
if (Dns6TokenEntry->Token->RspData.GLookupData->RRList == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
@ -1352,6 +1364,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns6TokenEntry->Token->RspData.H2AData->IpList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (EFI_IPv6_ADDRESS));
|
Dns6TokenEntry->Token->RspData.H2AData->IpList = AllocateZeroPool (DnsHeader->AnswersNum * sizeof (EFI_IPv6_ADDRESS));
|
||||||
if (Dns6TokenEntry->Token->RspData.H2AData->IpList == NULL) {
|
if (Dns6TokenEntry->Token->RspData.H2AData->IpList == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
@ -1417,7 +1430,7 @@ ParseDnsResponse (
|
|||||||
//
|
//
|
||||||
// Check whether it's the GeneralLookUp querying.
|
// Check whether it's the GeneralLookUp querying.
|
||||||
//
|
//
|
||||||
if (Instance->Service->IpVersion == IP_VERSION_4 && Dns4TokenEntry->GeneralLookUp) {
|
if ((Instance->Service->IpVersion == IP_VERSION_4) && Dns4TokenEntry->GeneralLookUp) {
|
||||||
Dns4RR = Dns4TokenEntry->Token->RspData.GLookupData->RRList;
|
Dns4RR = Dns4TokenEntry->Token->RspData.GLookupData->RRList;
|
||||||
AnswerData = (UINT8 *)AnswerSection + sizeof (*AnswerSection);
|
AnswerData = (UINT8 *)AnswerSection + sizeof (*AnswerSection);
|
||||||
|
|
||||||
@ -1429,6 +1442,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns4RR[RRCount].QName, QueryName, AsciiStrLen (QueryName));
|
CopyMem (Dns4RR[RRCount].QName, QueryName, AsciiStrLen (QueryName));
|
||||||
Dns4RR[RRCount].QType = AnswerSection->Type;
|
Dns4RR[RRCount].QType = AnswerSection->Type;
|
||||||
Dns4RR[RRCount].QClass = AnswerSection->Class;
|
Dns4RR[RRCount].QClass = AnswerSection->Class;
|
||||||
@ -1439,11 +1453,12 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns4RR[RRCount].RData, AnswerData, Dns4RR[RRCount].DataLength);
|
CopyMem (Dns4RR[RRCount].RData, AnswerData, Dns4RR[RRCount].DataLength);
|
||||||
|
|
||||||
RRCount++;
|
RRCount++;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else if (Instance->Service->IpVersion == IP_VERSION_6 && Dns6TokenEntry->GeneralLookUp) {
|
} else if ((Instance->Service->IpVersion == IP_VERSION_6) && Dns6TokenEntry->GeneralLookUp) {
|
||||||
Dns6RR = Dns6TokenEntry->Token->RspData.GLookupData->RRList;
|
Dns6RR = Dns6TokenEntry->Token->RspData.GLookupData->RRList;
|
||||||
AnswerData = (UINT8 *)AnswerSection + sizeof (*AnswerSection);
|
AnswerData = (UINT8 *)AnswerSection + sizeof (*AnswerSection);
|
||||||
|
|
||||||
@ -1455,6 +1470,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns6RR[RRCount].QName, QueryName, AsciiStrLen (QueryName));
|
CopyMem (Dns6RR[RRCount].QName, QueryName, AsciiStrLen (QueryName));
|
||||||
Dns6RR[RRCount].QType = AnswerSection->Type;
|
Dns6RR[RRCount].QType = AnswerSection->Type;
|
||||||
Dns6RR[RRCount].QClass = AnswerSection->Class;
|
Dns6RR[RRCount].QClass = AnswerSection->Class;
|
||||||
@ -1465,6 +1481,7 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns6RR[RRCount].RData, AnswerData, Dns6RR[RRCount].DataLength);
|
CopyMem (Dns6RR[RRCount].RData, AnswerData, Dns6RR[RRCount].DataLength);
|
||||||
|
|
||||||
RRCount++;
|
RRCount++;
|
||||||
@ -1498,20 +1515,23 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns4CacheEntry->HostName = AllocateZeroPool (2 * (StrLen (Dns4TokenEntry->QueryHostName) + 1));
|
Dns4CacheEntry->HostName = AllocateZeroPool (2 * (StrLen (Dns4TokenEntry->QueryHostName) + 1));
|
||||||
if (Dns4CacheEntry->HostName == NULL) {
|
if (Dns4CacheEntry->HostName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns4CacheEntry->HostName, Dns4TokenEntry->QueryHostName, 2 * (StrLen (Dns4TokenEntry->QueryHostName) + 1));
|
CopyMem (Dns4CacheEntry->HostName, Dns4TokenEntry->QueryHostName, 2 * (StrLen (Dns4TokenEntry->QueryHostName) + 1));
|
||||||
Dns4CacheEntry->IpAddress = AllocateZeroPool (sizeof (EFI_IPv4_ADDRESS));
|
Dns4CacheEntry->IpAddress = AllocateZeroPool (sizeof (EFI_IPv4_ADDRESS));
|
||||||
if (Dns4CacheEntry->IpAddress == NULL) {
|
if (Dns4CacheEntry->IpAddress == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns4CacheEntry->IpAddress, AnswerData, sizeof (EFI_IPv4_ADDRESS));
|
CopyMem (Dns4CacheEntry->IpAddress, AnswerData, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
|
||||||
if (CNameTtl != 0 && AnswerSection->Ttl != 0) {
|
if ((CNameTtl != 0) && (AnswerSection->Ttl != 0)) {
|
||||||
Dns4CacheEntry->Timeout = MIN (CNameTtl, AnswerSection->Ttl);
|
Dns4CacheEntry->Timeout = MIN (CNameTtl, AnswerSection->Ttl);
|
||||||
} else {
|
} else {
|
||||||
Dns4CacheEntry->Timeout = MAX (CNameTtl, AnswerSection->Ttl);
|
Dns4CacheEntry->Timeout = MAX (CNameTtl, AnswerSection->Ttl);
|
||||||
@ -1557,20 +1577,23 @@ ParseDnsResponse (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns6CacheEntry->HostName = AllocateZeroPool (2 * (StrLen (Dns6TokenEntry->QueryHostName) + 1));
|
Dns6CacheEntry->HostName = AllocateZeroPool (2 * (StrLen (Dns6TokenEntry->QueryHostName) + 1));
|
||||||
if (Dns6CacheEntry->HostName == NULL) {
|
if (Dns6CacheEntry->HostName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns6CacheEntry->HostName, Dns6TokenEntry->QueryHostName, 2 * (StrLen (Dns6TokenEntry->QueryHostName) + 1));
|
CopyMem (Dns6CacheEntry->HostName, Dns6TokenEntry->QueryHostName, 2 * (StrLen (Dns6TokenEntry->QueryHostName) + 1));
|
||||||
Dns6CacheEntry->IpAddress = AllocateZeroPool (sizeof (EFI_IPv6_ADDRESS));
|
Dns6CacheEntry->IpAddress = AllocateZeroPool (sizeof (EFI_IPv6_ADDRESS));
|
||||||
if (Dns6CacheEntry->IpAddress == NULL) {
|
if (Dns6CacheEntry->IpAddress == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Dns6CacheEntry->IpAddress, AnswerData, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (Dns6CacheEntry->IpAddress, AnswerData, sizeof (EFI_IPv6_ADDRESS));
|
||||||
|
|
||||||
if (CNameTtl != 0 && AnswerSection->Ttl != 0) {
|
if ((CNameTtl != 0) && (AnswerSection->Ttl != 0)) {
|
||||||
Dns6CacheEntry->Timeout = MIN (CNameTtl, AnswerSection->Ttl);
|
Dns6CacheEntry->Timeout = MIN (CNameTtl, AnswerSection->Ttl);
|
||||||
} else {
|
} else {
|
||||||
Dns6CacheEntry->Timeout = MAX (CNameTtl, AnswerSection->Ttl);
|
Dns6CacheEntry->Timeout = MAX (CNameTtl, AnswerSection->Ttl);
|
||||||
@ -1646,7 +1669,7 @@ ON_COMPLETE:
|
|||||||
//
|
//
|
||||||
// Parsing is complete, free the sending packet and signal Event here.
|
// Parsing is complete, free the sending packet and signal Event here.
|
||||||
//
|
//
|
||||||
if (Item != NULL && Item->Value != NULL) {
|
if ((Item != NULL) && (Item->Value != NULL)) {
|
||||||
NetbufFree ((NET_BUF *)(Item->Value));
|
NetbufFree ((NET_BUF *)(Item->Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1694,7 +1717,7 @@ ON_EXIT:
|
|||||||
FreePool (Dns4TokenEntry->Token->RspData.GLookupData);
|
FreePool (Dns4TokenEntry->Token->RspData.GLookupData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (QuerySection->Type == DNS_TYPE_A && Dns4TokenEntry->Token->RspData.H2AData != NULL) {
|
if ((QuerySection->Type == DNS_TYPE_A) && (Dns4TokenEntry->Token->RspData.H2AData != NULL)) {
|
||||||
if (Dns4TokenEntry->Token->RspData.H2AData->IpList != NULL) {
|
if (Dns4TokenEntry->Token->RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Dns4TokenEntry->Token->RspData.H2AData->IpList);
|
FreePool (Dns4TokenEntry->Token->RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
@ -1726,7 +1749,7 @@ ON_EXIT:
|
|||||||
FreePool (Dns6TokenEntry->Token->RspData.GLookupData);
|
FreePool (Dns6TokenEntry->Token->RspData.GLookupData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (QuerySection->Type == DNS_TYPE_AAAA && Dns6TokenEntry->Token->RspData.H2AData != NULL) {
|
if ((QuerySection->Type == DNS_TYPE_AAAA) && (Dns6TokenEntry->Token->RspData.H2AData != NULL)) {
|
||||||
if (Dns6TokenEntry->Token->RspData.H2AData->IpList != NULL) {
|
if (Dns6TokenEntry->Token->RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Dns6TokenEntry->Token->RspData.H2AData->IpList);
|
FreePool (Dns6TokenEntry->Token->RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
@ -2084,7 +2107,6 @@ DnsOnTimerRetransmit (
|
|||||||
|
|
||||||
Service = (DNS_SERVICE *)Context;
|
Service = (DNS_SERVICE *)Context;
|
||||||
|
|
||||||
|
|
||||||
if (Service->IpVersion == IP_VERSION_4) {
|
if (Service->IpVersion == IP_VERSION_4) {
|
||||||
//
|
//
|
||||||
// Iterate through all the children of the DNS service instance. Time
|
// Iterate through all the children of the DNS service instance. Time
|
||||||
@ -2097,7 +2119,7 @@ DnsOnTimerRetransmit (
|
|||||||
while (EntryNetMap != &Instance->Dns4TxTokens.Used) {
|
while (EntryNetMap != &Instance->Dns4TxTokens.Used) {
|
||||||
ItemNetMap = NET_LIST_USER_STRUCT (EntryNetMap, NET_MAP_ITEM, Link);
|
ItemNetMap = NET_LIST_USER_STRUCT (EntryNetMap, NET_MAP_ITEM, Link);
|
||||||
Dns4TokenEntry = (DNS4_TOKEN_ENTRY *)(ItemNetMap->Key);
|
Dns4TokenEntry = (DNS4_TOKEN_ENTRY *)(ItemNetMap->Key);
|
||||||
if (Dns4TokenEntry->PacketToLive == 0 || (--Dns4TokenEntry->PacketToLive > 0)) {
|
if ((Dns4TokenEntry->PacketToLive == 0) || (--Dns4TokenEntry->PacketToLive > 0)) {
|
||||||
EntryNetMap = EntryNetMap->ForwardLink;
|
EntryNetMap = EntryNetMap->ForwardLink;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2141,7 +2163,7 @@ DnsOnTimerRetransmit (
|
|||||||
while (EntryNetMap != &Instance->Dns6TxTokens.Used) {
|
while (EntryNetMap != &Instance->Dns6TxTokens.Used) {
|
||||||
ItemNetMap = NET_LIST_USER_STRUCT (EntryNetMap, NET_MAP_ITEM, Link);
|
ItemNetMap = NET_LIST_USER_STRUCT (EntryNetMap, NET_MAP_ITEM, Link);
|
||||||
Dns6TokenEntry = (DNS6_TOKEN_ENTRY *)(ItemNetMap->Key);
|
Dns6TokenEntry = (DNS6_TOKEN_ENTRY *)(ItemNetMap->Key);
|
||||||
if (Dns6TokenEntry->PacketToLive == 0 || (--Dns6TokenEntry->PacketToLive > 0)) {
|
if ((Dns6TokenEntry->PacketToLive == 0) || (--Dns6TokenEntry->PacketToLive > 0)) {
|
||||||
EntryNetMap = EntryNetMap->ForwardLink;
|
EntryNetMap = EntryNetMap->ForwardLink;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2242,4 +2264,3 @@ DnsOnTimerUpdate (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,6 @@ typedef struct {
|
|||||||
#define DNS4_DOMAIN L"in-addr.arpa"
|
#define DNS4_DOMAIN L"in-addr.arpa"
|
||||||
#define DNS6_DOMAIN L"IP6.ARPA"
|
#define DNS6_DOMAIN L"IP6.ARPA"
|
||||||
|
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -710,7 +709,6 @@ DnsOnTimerUpdate (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve mode data of this DNS instance.
|
Retrieve mode data of this DNS instance.
|
||||||
|
|
||||||
@ -954,7 +952,6 @@ Dns4Cancel (
|
|||||||
IN EFI_DNS4_COMPLETION_TOKEN *Token
|
IN EFI_DNS4_COMPLETION_TOKEN *Token
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve mode data of this DNS instance.
|
Retrieve mode data of this DNS instance.
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ Dns4GetModeData (
|
|||||||
CacheList = NULL;
|
CacheList = NULL;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
|
||||||
if ((This == NULL) || (DnsModeData == NULL)) {
|
if ((This == NULL) || (DnsModeData == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -193,13 +192,14 @@ Dns4Configure (
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
ServerList = NULL;
|
ServerList = NULL;
|
||||||
|
|
||||||
if (This == NULL ||
|
if ((This == NULL) ||
|
||||||
(DnsConfigData != NULL && ((DnsConfigData->DnsServerListCount != 0 && DnsConfigData->DnsServerList == NULL) ||
|
((DnsConfigData != NULL) && (((DnsConfigData->DnsServerListCount != 0) && (DnsConfigData->DnsServerList == NULL)) ||
|
||||||
(DnsConfigData->DnsServerListCount == 0 && DnsConfigData->DnsServerList != NULL)))) {
|
((DnsConfigData->DnsServerListCount == 0) && (DnsConfigData->DnsServerList != NULL)))))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DnsConfigData != NULL && DnsConfigData->Protocol != DNS_PROTOCOL_UDP) {
|
if ((DnsConfigData != NULL) && (DnsConfigData->Protocol != DNS_PROTOCOL_UDP)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +224,7 @@ Dns4Configure (
|
|||||||
if (Instance->Dns4CfgData.DnsServerList != NULL) {
|
if (Instance->Dns4CfgData.DnsServerList != NULL) {
|
||||||
FreePool (Instance->Dns4CfgData.DnsServerList);
|
FreePool (Instance->Dns4CfgData.DnsServerList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (&Instance->Dns4CfgData, sizeof (EFI_DNS4_CONFIG_DATA));
|
ZeroMem (&Instance->Dns4CfgData, sizeof (EFI_DNS4_CONFIG_DATA));
|
||||||
|
|
||||||
Instance->State = DNS_STATE_UNCONFIGED;
|
Instance->State = DNS_STATE_UNCONFIGED;
|
||||||
@ -238,7 +239,8 @@ Dns4Configure (
|
|||||||
Netmask = NTOHL (Netmask);
|
Netmask = NTOHL (Netmask);
|
||||||
|
|
||||||
if (!DnsConfigData->UseDefaultSetting &&
|
if (!DnsConfigData->UseDefaultSetting &&
|
||||||
((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) {
|
((!IP4_IS_VALID_NETMASK (Netmask) || ((Netmask != 0) && !NetIp4IsUnicast (Ip, Netmask)))))
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -281,6 +283,7 @@ Dns4Configure (
|
|||||||
FreePool (Instance->Dns4CfgData.DnsServerList);
|
FreePool (Instance->Dns4CfgData.DnsServerList);
|
||||||
Instance->Dns4CfgData.DnsServerList = NULL;
|
Instance->Dns4CfgData.DnsServerList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,6 +296,7 @@ Dns4Configure (
|
|||||||
FreePool (Instance->Dns4CfgData.DnsServerList);
|
FreePool (Instance->Dns4CfgData.DnsServerList);
|
||||||
Instance->Dns4CfgData.DnsServerList = NULL;
|
Instance->Dns4CfgData.DnsServerList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +363,7 @@ Dns4HostNameToIp (
|
|||||||
//
|
//
|
||||||
// Validate the parameters
|
// Validate the parameters
|
||||||
//
|
//
|
||||||
if ((This == NULL) || (HostName == NULL) || Token == NULL) {
|
if ((This == NULL) || (HostName == NULL) || (Token == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +434,7 @@ Dns4HostNameToIp (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns4CacheList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns4CacheList) {
|
||||||
Item = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
|
Item = NET_LIST_USER_STRUCT (Entry, DNS4_CACHE, AllCacheLink);
|
||||||
if ((UINT32)Index < Token->RspData.H2AData->IpCount && StrCmp (HostName, Item->DnsCache.HostName) == 0) {
|
if (((UINT32)Index < Token->RspData.H2AData->IpCount) && (StrCmp (HostName, Item->DnsCache.HostName) == 0)) {
|
||||||
CopyMem ((Token->RspData.H2AData->IpList) + Index, Item->DnsCache.IpAddress, sizeof (EFI_IPv4_ADDRESS));
|
CopyMem ((Token->RspData.H2AData->IpList) + Index, Item->DnsCache.IpAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
@ -614,7 +618,7 @@ Dns4GeneralLookUp (
|
|||||||
//
|
//
|
||||||
// Validate the parameters
|
// Validate the parameters
|
||||||
//
|
//
|
||||||
if ((This == NULL) || (QName == NULL) || Token == NULL) {
|
if ((This == NULL) || (QName == NULL) || (Token == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +756,7 @@ Dns4UpdateDnsCache (
|
|||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
if (DnsCacheEntry.HostName == NULL || DnsCacheEntry.IpAddress == NULL || DnsCacheEntry.Timeout == 0) {
|
if ((DnsCacheEntry.HostName == NULL) || (DnsCacheEntry.IpAddress == NULL) || (DnsCacheEntry.Timeout == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1037,13 +1041,14 @@ Dns6Configure (
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
ServerList = NULL;
|
ServerList = NULL;
|
||||||
|
|
||||||
if (This == NULL ||
|
if ((This == NULL) ||
|
||||||
(DnsConfigData != NULL && ((DnsConfigData->DnsServerCount != 0 && DnsConfigData->DnsServerList == NULL) ||
|
((DnsConfigData != NULL) && (((DnsConfigData->DnsServerCount != 0) && (DnsConfigData->DnsServerList == NULL)) ||
|
||||||
(DnsConfigData->DnsServerCount == 0 && DnsConfigData->DnsServerList != NULL)))) {
|
((DnsConfigData->DnsServerCount == 0) && (DnsConfigData->DnsServerList != NULL)))))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DnsConfigData != NULL && DnsConfigData->Protocol != DNS_PROTOCOL_UDP) {
|
if ((DnsConfigData != NULL) && (DnsConfigData->Protocol != DNS_PROTOCOL_UDP)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1068,6 +1073,7 @@ Dns6Configure (
|
|||||||
if (Instance->Dns6CfgData.DnsServerList != NULL) {
|
if (Instance->Dns6CfgData.DnsServerList != NULL) {
|
||||||
FreePool (Instance->Dns6CfgData.DnsServerList);
|
FreePool (Instance->Dns6CfgData.DnsServerList);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (&Instance->Dns6CfgData, sizeof (EFI_DNS6_CONFIG_DATA));
|
ZeroMem (&Instance->Dns6CfgData, sizeof (EFI_DNS6_CONFIG_DATA));
|
||||||
|
|
||||||
Instance->State = DNS_STATE_UNCONFIGED;
|
Instance->State = DNS_STATE_UNCONFIGED;
|
||||||
@ -1121,6 +1127,7 @@ Dns6Configure (
|
|||||||
FreePool (Instance->Dns6CfgData.DnsServerList);
|
FreePool (Instance->Dns6CfgData.DnsServerList);
|
||||||
Instance->Dns6CfgData.DnsServerList = NULL;
|
Instance->Dns6CfgData.DnsServerList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1133,6 +1140,7 @@ Dns6Configure (
|
|||||||
FreePool (Instance->Dns6CfgData.DnsServerList);
|
FreePool (Instance->Dns6CfgData.DnsServerList);
|
||||||
Instance->Dns6CfgData.DnsServerList = NULL;
|
Instance->Dns6CfgData.DnsServerList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,7 +1209,7 @@ Dns6HostNameToIp (
|
|||||||
//
|
//
|
||||||
// Validate the parameters
|
// Validate the parameters
|
||||||
//
|
//
|
||||||
if ((This == NULL) || (HostName == NULL) || Token == NULL) {
|
if ((This == NULL) || (HostName == NULL) || (Token == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1272,7 +1280,7 @@ Dns6HostNameToIp (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns6CacheList) {
|
NET_LIST_FOR_EACH_SAFE (Entry, Next, &mDriverData->Dns6CacheList) {
|
||||||
Item = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
|
Item = NET_LIST_USER_STRUCT (Entry, DNS6_CACHE, AllCacheLink);
|
||||||
if ((UINT32)Index < Token->RspData.H2AData->IpCount && StrCmp (HostName, Item->DnsCache.HostName) == 0) {
|
if (((UINT32)Index < Token->RspData.H2AData->IpCount) && (StrCmp (HostName, Item->DnsCache.HostName) == 0)) {
|
||||||
CopyMem ((Token->RspData.H2AData->IpList) + Index, Item->DnsCache.IpAddress, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem ((Token->RspData.H2AData->IpList) + Index, Item->DnsCache.IpAddress, sizeof (EFI_IPv6_ADDRESS));
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
@ -1459,7 +1467,7 @@ Dns6GeneralLookUp (
|
|||||||
//
|
//
|
||||||
// Validate the parameters
|
// Validate the parameters
|
||||||
//
|
//
|
||||||
if ((This == NULL) || (QName == NULL) || Token == NULL) {
|
if ((This == NULL) || (QName == NULL) || (Token == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1598,7 +1606,7 @@ Dns6UpdateDnsCache (
|
|||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
if (DnsCacheEntry.HostName == NULL || DnsCacheEntry.IpAddress == NULL || DnsCacheEntry.Timeout == 0) {
|
if ((DnsCacheEntry.HostName == NULL) || (DnsCacheEntry.IpAddress == NULL) || (DnsCacheEntry.Timeout == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1726,4 +1734,3 @@ Dns6Cancel (
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ DpcQueueDpc (
|
|||||||
//
|
//
|
||||||
// Make sure DpcTpl is valid
|
// Make sure DpcTpl is valid
|
||||||
//
|
//
|
||||||
if (DpcTpl < TPL_APPLICATION || DpcTpl > TPL_HIGH_LEVEL) {
|
if ((DpcTpl < TPL_APPLICATION) || (DpcTpl > TPL_HIGH_LEVEL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,4 +77,3 @@ DpcDispatchDpc (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ HttpBootUpdateDevicePath (
|
|||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH;
|
Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->Ipv4.Header.SubType = MSG_IPv4_DP;
|
Node->Ipv4.Header.SubType = MSG_IPv4_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));
|
SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));
|
||||||
@ -56,6 +57,7 @@ HttpBootUpdateDevicePath (
|
|||||||
if (Node == NULL) {
|
if (Node == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH;
|
Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->Ipv6.Header.SubType = MSG_IPv6_DP;
|
Node->Ipv6.Header.SubType = MSG_IPv6_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));
|
SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));
|
||||||
@ -84,6 +86,7 @@ HttpBootUpdateDevicePath (
|
|||||||
FreePool (TmpIpDevicePath);
|
FreePool (TmpIpDevicePath);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->DevPath.SubType = MSG_DNS_DP;
|
Node->DevPath.SubType = MSG_DNS_DP;
|
||||||
SetDevicePathNodeLength (Node, Length);
|
SetDevicePathNodeLength (Node, Length);
|
||||||
@ -108,11 +111,14 @@ HttpBootUpdateDevicePath (
|
|||||||
if (TmpIpDevicePath != NULL) {
|
if (TmpIpDevicePath != NULL) {
|
||||||
FreePool (TmpIpDevicePath);
|
FreePool (TmpIpDevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TmpDnsDevicePath != NULL) {
|
if (TmpDnsDevicePath != NULL) {
|
||||||
FreePool (TmpDnsDevicePath);
|
FreePool (TmpDnsDevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->DevPath.SubType = MSG_URI_DP;
|
Node->DevPath.SubType = MSG_URI_DP;
|
||||||
SetDevicePathNodeLength (Node, Length);
|
SetDevicePathNodeLength (Node, Length);
|
||||||
@ -126,6 +132,7 @@ HttpBootUpdateDevicePath (
|
|||||||
NewDevicePath = AppendDevicePathNode (TmpIpDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node);
|
NewDevicePath = AppendDevicePathNode (TmpIpDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node);
|
||||||
FreePool (TmpIpDevicePath);
|
FreePool (TmpIpDevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Node);
|
FreePool (Node);
|
||||||
if (NewDevicePath == NULL) {
|
if (NewDevicePath == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
@ -160,6 +167,7 @@ HttpBootUpdateDevicePath (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Private->Ip6Nic->DevicePath);
|
FreePool (Private->Ip6Nic->DevicePath);
|
||||||
Private->Ip6Nic->DevicePath = NewDevicePath;
|
Private->Ip6Nic->DevicePath = NewDevicePath;
|
||||||
}
|
}
|
||||||
@ -209,13 +217,15 @@ HttpBootDhcp4ExtractUriInfo (
|
|||||||
//
|
//
|
||||||
if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||
|
if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||
|
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns)) {
|
(SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns))
|
||||||
|
{
|
||||||
HttpOffer = SelectOffer;
|
HttpOffer = SelectOffer;
|
||||||
} else {
|
} else {
|
||||||
ASSERT (Private->SelectProxyType != HttpOfferTypeMax);
|
ASSERT (Private->SelectProxyType != HttpOfferTypeMax);
|
||||||
ProxyIndex = Private->OfferIndex[Private->SelectProxyType][0];
|
ProxyIndex = Private->OfferIndex[Private->SelectProxyType][0];
|
||||||
HttpOffer = &Private->OfferBuffer[ProxyIndex].Dhcp4;
|
HttpOffer = &Private->OfferBuffer[ProxyIndex].Dhcp4;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->BootFileUriParser = HttpOffer->UriParser;
|
Private->BootFileUriParser = HttpOffer->UriParser;
|
||||||
Private->BootFileUri = (CHAR8 *)HttpOffer->OptList[HTTP_BOOT_DHCP4_TAG_INDEX_BOOTFILE]->Data;
|
Private->BootFileUri = (CHAR8 *)HttpOffer->OptList[HTTP_BOOT_DHCP4_TAG_INDEX_BOOTFILE]->Data;
|
||||||
} else {
|
} else {
|
||||||
@ -237,12 +247,14 @@ HttpBootDhcp4ExtractUriInfo (
|
|||||||
} else if (Status == EFI_ACCESS_DENIED) {
|
} else if (Status == EFI_ACCESS_DENIED) {
|
||||||
AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
|
AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||
|
if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||
|
(SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns)) {
|
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns))
|
||||||
|
{
|
||||||
Option = SelectOffer->OptList[HTTP_BOOT_DHCP4_TAG_INDEX_DNS_SERVER];
|
Option = SelectOffer->OptList[HTTP_BOOT_DHCP4_TAG_INDEX_DNS_SERVER];
|
||||||
ASSERT (Option != NULL);
|
ASSERT (Option != NULL);
|
||||||
|
|
||||||
@ -283,7 +295,7 @@ HttpBootDhcp4ExtractUriInfo (
|
|||||||
Private->BootFileUriParser,
|
Private->BootFileUriParser,
|
||||||
&Private->Port
|
&Private->Port
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || Private->Port == 0) {
|
if (EFI_ERROR (Status) || (Private->Port == 0)) {
|
||||||
Private->Port = 80;
|
Private->Port = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +307,7 @@ HttpBootDhcp4ExtractUriInfo (
|
|||||||
// Update the device path to include the boot resource information.
|
// Update the device path to include the boot resource information.
|
||||||
//
|
//
|
||||||
Status = HttpBootUpdateDevicePath (Private);
|
Status = HttpBootUpdateDevicePath (Private);
|
||||||
if (EFI_ERROR (Status) && Private->DnsServerIp != NULL) {
|
if (EFI_ERROR (Status) && (Private->DnsServerIp != NULL)) {
|
||||||
FreePool (Private->DnsServerIp);
|
FreePool (Private->DnsServerIp);
|
||||||
Private->DnsServerIp = NULL;
|
Private->DnsServerIp = NULL;
|
||||||
}
|
}
|
||||||
@ -349,13 +361,15 @@ HttpBootDhcp6ExtractUriInfo (
|
|||||||
//
|
//
|
||||||
if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||
|
if ((SelectOffer->OfferType == HttpOfferTypeDhcpIpUri) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||
|
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns)) {
|
(SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns))
|
||||||
|
{
|
||||||
HttpOffer = SelectOffer;
|
HttpOffer = SelectOffer;
|
||||||
} else {
|
} else {
|
||||||
ASSERT (Private->SelectProxyType != HttpOfferTypeMax);
|
ASSERT (Private->SelectProxyType != HttpOfferTypeMax);
|
||||||
ProxyIndex = Private->OfferIndex[Private->SelectProxyType][0];
|
ProxyIndex = Private->OfferIndex[Private->SelectProxyType][0];
|
||||||
HttpOffer = &Private->OfferBuffer[ProxyIndex].Dhcp6;
|
HttpOffer = &Private->OfferBuffer[ProxyIndex].Dhcp6;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->BootFileUriParser = HttpOffer->UriParser;
|
Private->BootFileUriParser = HttpOffer->UriParser;
|
||||||
Private->BootFileUri = (CHAR8 *)HttpOffer->OptList[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL]->Data;
|
Private->BootFileUri = (CHAR8 *)HttpOffer->OptList[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL]->Data;
|
||||||
} else {
|
} else {
|
||||||
@ -377,6 +391,7 @@ HttpBootDhcp6ExtractUriInfo (
|
|||||||
} else if (Status == EFI_ACCESS_DENIED) {
|
} else if (Status == EFI_ACCESS_DENIED) {
|
||||||
AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
|
AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is allowed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +413,8 @@ HttpBootDhcp6ExtractUriInfo (
|
|||||||
|
|
||||||
if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||
|
if ((SelectOffer->OfferType == HttpOfferTypeDhcpNameUriDns) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||
|
(SelectOffer->OfferType == HttpOfferTypeDhcpDns) ||
|
||||||
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns)) {
|
(SelectOffer->OfferType == HttpOfferTypeDhcpIpUriDns))
|
||||||
|
{
|
||||||
Option = SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER];
|
Option = SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER];
|
||||||
ASSERT (Option != NULL);
|
ASSERT (Option != NULL);
|
||||||
|
|
||||||
@ -483,7 +499,7 @@ HttpBootDhcp6ExtractUriInfo (
|
|||||||
Private->BootFileUriParser,
|
Private->BootFileUriParser,
|
||||||
&Private->Port
|
&Private->Port
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || Private->Port == 0) {
|
if (EFI_ERROR (Status) || (Private->Port == 0)) {
|
||||||
Private->Port = 80;
|
Private->Port = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +526,6 @@ Error:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Discover all the boot information for boot file.
|
Discover all the boot information for boot file.
|
||||||
|
|
||||||
@ -565,6 +580,7 @@ HttpBootHttpIoCallback (
|
|||||||
{
|
{
|
||||||
HTTP_BOOT_PRIVATE_DATA *Private;
|
HTTP_BOOT_PRIVATE_DATA *Private;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Private = (HTTP_BOOT_PRIVATE_DATA *)Context;
|
Private = (HTTP_BOOT_PRIVATE_DATA *)Context;
|
||||||
if (Private->HttpBootCallback != NULL) {
|
if (Private->HttpBootCallback != NULL) {
|
||||||
Status = Private->HttpBootCallback->Callback (
|
Status = Private->HttpBootCallback->Callback (
|
||||||
@ -576,6 +592,7 @@ HttpBootHttpIoCallback (
|
|||||||
);
|
);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,6 +677,7 @@ HttpBootFreeCache (
|
|||||||
if (Cache->RequestData->Url != NULL) {
|
if (Cache->RequestData->Url != NULL) {
|
||||||
FreePool (Cache->RequestData->Url);
|
FreePool (Cache->RequestData->Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Cache->RequestData);
|
FreePool (Cache->RequestData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,6 +690,7 @@ HttpBootFreeCache (
|
|||||||
FreePool (Cache->ResponseData->Headers[Index].FieldName);
|
FreePool (Cache->ResponseData->Headers[Index].FieldName);
|
||||||
FreePool (Cache->ResponseData->Headers[Index].FieldValue);
|
FreePool (Cache->ResponseData->Headers[Index].FieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Cache->ResponseData->Headers);
|
FreePool (Cache->ResponseData->Headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -684,6 +703,7 @@ HttpBootFreeCache (
|
|||||||
if (EntityData->Block != NULL) {
|
if (EntityData->Block != NULL) {
|
||||||
FreePool (EntityData->Block);
|
FreePool (EntityData->Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryList (&EntityData->Link);
|
RemoveEntryList (&EntityData->Link);
|
||||||
FreePool (EntityData);
|
FreePool (EntityData);
|
||||||
}
|
}
|
||||||
@ -747,7 +767,7 @@ HttpBootGetFileFromCache (
|
|||||||
HTTP_BOOT_ENTITY_DATA *EntityData;
|
HTTP_BOOT_ENTITY_DATA *EntityData;
|
||||||
UINTN CopyedSize;
|
UINTN CopyedSize;
|
||||||
|
|
||||||
if (Uri == NULL || BufferSize == NULL || Buffer == NULL || ImageType == NULL) {
|
if ((Uri == NULL) || (BufferSize == NULL) || (Buffer == NULL) || (ImageType == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +778,8 @@ HttpBootGetFileFromCache (
|
|||||||
//
|
//
|
||||||
if ((Cache->RequestData != NULL) &&
|
if ((Cache->RequestData != NULL) &&
|
||||||
(Cache->RequestData->Url != NULL) &&
|
(Cache->RequestData->Url != NULL) &&
|
||||||
(StrCmp (Uri, Cache->RequestData->Url) == 0)) {
|
(StrCmp (Uri, Cache->RequestData->Url) == 0))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Hit in cache, record image type.
|
// Hit in cache, record image type.
|
||||||
//
|
//
|
||||||
@ -845,6 +866,7 @@ HttpBootGetBootFileCallback (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy data if caller has provided a buffer.
|
// Copy data if caller has provided a buffer.
|
||||||
//
|
//
|
||||||
@ -865,14 +887,17 @@ HttpBootGetBootFileCallback (
|
|||||||
if (NewEntityData == NULL) {
|
if (NewEntityData == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CallbackData->NewBlock) {
|
if (CallbackData->NewBlock) {
|
||||||
NewEntityData->Block = CallbackData->Block;
|
NewEntityData->Block = CallbackData->Block;
|
||||||
CallbackData->Block = NULL;
|
CallbackData->Block = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewEntityData->DataLength = Length;
|
NewEntityData->DataLength = Length;
|
||||||
NewEntityData->DataStart = (UINT8 *)Data;
|
NewEntityData->DataStart = (UINT8 *)Data;
|
||||||
InsertTailList (&CallbackData->Cache->EntityDataList, &NewEntityData->Link);
|
InsertTailList (&CallbackData->Cache->EntityDataList, &NewEntityData->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,11 +955,11 @@ HttpBootGetBootFile (
|
|||||||
ASSERT (Private != NULL);
|
ASSERT (Private != NULL);
|
||||||
ASSERT (Private->HttpCreated);
|
ASSERT (Private->HttpCreated);
|
||||||
|
|
||||||
if (BufferSize == NULL || ImageType == NULL) {
|
if ((BufferSize == NULL) || (ImageType == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*BufferSize != 0 && Buffer == NULL) {
|
if ((*BufferSize != 0) && (Buffer == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -946,8 +971,9 @@ HttpBootGetBootFile (
|
|||||||
if (Url == NULL) {
|
if (Url == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);
|
AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);
|
||||||
if (!HeaderOnly && Buffer != NULL) {
|
if (!HeaderOnly && (Buffer != NULL)) {
|
||||||
Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);
|
Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, ImageType);
|
||||||
if (Status != EFI_NOT_FOUND) {
|
if (Status != EFI_NOT_FOUND) {
|
||||||
FreePool (Url);
|
FreePool (Url);
|
||||||
@ -969,6 +995,7 @@ HttpBootGetBootFile (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ERROR_1;
|
goto ERROR_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache->ImageType = ImageTypeMax;
|
Cache->ImageType = ImageTypeMax;
|
||||||
InitializeListHead (&Cache->EntityDataList);
|
InitializeListHead (&Cache->EntityDataList);
|
||||||
}
|
}
|
||||||
@ -1001,6 +1028,7 @@ HttpBootGetBootFile (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ERROR_3;
|
goto ERROR_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HttpIoSetHeader (
|
Status = HttpIoSetHeader (
|
||||||
HttpIoHeader,
|
HttpIoHeader,
|
||||||
HTTP_HEADER_HOST,
|
HTTP_HEADER_HOST,
|
||||||
@ -1043,6 +1071,7 @@ HttpBootGetBootFile (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ERROR_3;
|
goto ERROR_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestData->Method = HeaderOnly ? HttpMethodHead : HttpMethodGet;
|
RequestData->Method = HeaderOnly ? HttpMethodHead : HttpMethodGet;
|
||||||
RequestData->Url = Url;
|
RequestData->Url = Url;
|
||||||
|
|
||||||
@ -1081,6 +1110,7 @@ HttpBootGetBootFile (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ERROR_4;
|
goto ERROR_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HttpIoRecvResponse (
|
Status = HttpIoRecvResponse (
|
||||||
&Private->HttpIo,
|
&Private->HttpIo,
|
||||||
TRUE,
|
TRUE,
|
||||||
@ -1092,6 +1122,7 @@ HttpBootGetBootFile (
|
|||||||
HttpBootPrintErrorMessage (StatusCode);
|
HttpBootPrintErrorMessage (StatusCode);
|
||||||
Status = ResponseData->Status;
|
Status = ResponseData->Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ERROR_5;
|
goto ERROR_5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,8 +1211,10 @@ HttpBootGetBootFile (
|
|||||||
if (EFI_ERROR (ResponseBody.Status)) {
|
if (EFI_ERROR (ResponseBody.Status)) {
|
||||||
Status = ResponseBody.Status;
|
Status = ResponseBody.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ERROR_6;
|
goto ERROR_6;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReceivedSize += ResponseBody.BodyLength;
|
ReceivedSize += ResponseBody.BodyLength;
|
||||||
if (Private->HttpBootCallback != NULL) {
|
if (Private->HttpBootCallback != NULL) {
|
||||||
Status = Private->HttpBootCallback->Callback (
|
Status = Private->HttpBootCallback->Callback (
|
||||||
@ -1209,12 +1242,13 @@ HttpBootGetBootFile (
|
|||||||
// Otherwise a buffer, the buffer in Block will be cached and we should allocate a new before
|
// Otherwise a buffer, the buffer in Block will be cached and we should allocate a new before
|
||||||
// every HttpIoRecvResponse().
|
// every HttpIoRecvResponse().
|
||||||
//
|
//
|
||||||
if (Block == NULL || Context.BufferSize == 0) {
|
if ((Block == NULL) || (Context.BufferSize == 0)) {
|
||||||
Block = AllocatePool (HTTP_BOOT_BLOCK_SIZE);
|
Block = AllocatePool (HTTP_BOOT_BLOCK_SIZE);
|
||||||
if (Block == NULL) {
|
if (Block == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ERROR_6;
|
goto ERROR_6;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context.NewBlock = TRUE;
|
Context.NewBlock = TRUE;
|
||||||
Context.Block = Block;
|
Context.Block = Block;
|
||||||
} else {
|
} else {
|
||||||
@ -1232,6 +1266,7 @@ HttpBootGetBootFile (
|
|||||||
if (EFI_ERROR (ResponseBody.Status)) {
|
if (EFI_ERROR (ResponseBody.Status)) {
|
||||||
Status = ResponseBody.Status;
|
Status = ResponseBody.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ERROR_6;
|
goto ERROR_6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1263,6 +1298,7 @@ HttpBootGetBootFile (
|
|||||||
} else {
|
} else {
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
*BufferSize = ContentLength;
|
*BufferSize = ContentLength;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1283,25 +1319,30 @@ ERROR_6:
|
|||||||
if (Parser != NULL) {
|
if (Parser != NULL) {
|
||||||
HttpFreeMsgParser (Parser);
|
HttpFreeMsgParser (Parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Context.Block != NULL) {
|
if (Context.Block != NULL) {
|
||||||
FreePool (Context.Block);
|
FreePool (Context.Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpBootFreeCache (Cache);
|
HttpBootFreeCache (Cache);
|
||||||
|
|
||||||
ERROR_5:
|
ERROR_5:
|
||||||
if (ResponseData != NULL) {
|
if (ResponseData != NULL) {
|
||||||
FreePool (ResponseData);
|
FreePool (ResponseData);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_4:
|
ERROR_4:
|
||||||
if (RequestData != NULL) {
|
if (RequestData != NULL) {
|
||||||
FreePool (RequestData);
|
FreePool (RequestData);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_3:
|
ERROR_3:
|
||||||
HttpIoFreeHeader (HttpIoHeader);
|
HttpIoFreeHeader (HttpIoHeader);
|
||||||
ERROR_2:
|
ERROR_2:
|
||||||
if (Cache != NULL) {
|
if (Cache != NULL) {
|
||||||
FreePool (Cache);
|
FreePool (Cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_1:
|
ERROR_1:
|
||||||
if (Url != NULL) {
|
if (Url != NULL) {
|
||||||
FreePool (Url);
|
FreePool (Url);
|
||||||
|
@ -139,7 +139,7 @@ HttpBootDxeComponentNameGetControllerName (
|
|||||||
EFI_HANDLE NicHandle;
|
EFI_HANDLE NicHandle;
|
||||||
UINT32 *Id;
|
UINT32 *Id;
|
||||||
|
|
||||||
if (ControllerHandle == NULL || ChildHandle != NULL) {
|
if ((ControllerHandle == NULL) || (ChildHandle != NULL)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,5 +173,4 @@ HttpBootDxeComponentNameGetControllerName (
|
|||||||
ControllerName,
|
ControllerName,
|
||||||
(BOOLEAN)(This != &gHttpBootDxeComponentName2)
|
(BOOLEAN)(This != &gHttpBootDxeComponentName2)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ HttpBootAddBootOption (
|
|||||||
if (Uri[Index] == L':') {
|
if (Uri[Index] == L':') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Uri[Index] >= L'A' && Uri[Index] <= L'Z') {
|
|
||||||
|
if ((Uri[Index] >= L'A') && (Uri[Index] <= L'Z')) {
|
||||||
Uri[Index] -= (CHAR16)(L'A' - L'a');
|
Uri[Index] -= (CHAR16)(L'A' - L'a');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,6 +78,7 @@ HttpBootAddBootOption (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH;
|
Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->Ipv4.Header.SubType = MSG_IPv4_DP;
|
Node->Ipv4.Header.SubType = MSG_IPv4_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));
|
SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));
|
||||||
@ -86,15 +88,18 @@ HttpBootAddBootOption (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH;
|
Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->Ipv6.Header.SubType = MSG_IPv6_DP;
|
Node->Ipv6.Header.SubType = MSG_IPv6_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));
|
SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
TmpDevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node);
|
TmpDevicePath = AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)Node);
|
||||||
FreePool (Node);
|
FreePool (Node);
|
||||||
if (TmpDevicePath == NULL) {
|
if (TmpDevicePath == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the URI node with the input boot file URI.
|
// Update the URI node with the input boot file URI.
|
||||||
//
|
//
|
||||||
@ -106,6 +111,7 @@ HttpBootAddBootOption (
|
|||||||
FreePool (TmpDevicePath);
|
FreePool (TmpDevicePath);
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->DevPath.SubType = MSG_URI_DP;
|
Node->DevPath.SubType = MSG_URI_DP;
|
||||||
SetDevicePathNodeLength (Node, Length);
|
SetDevicePathNodeLength (Node, Length);
|
||||||
@ -235,7 +241,7 @@ HttpBootFormExtractConfig (
|
|||||||
BOOLEAN AllocatedRequest;
|
BOOLEAN AllocatedRequest;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
if (Progress == NULL || Results == NULL) {
|
if ((Progress == NULL) || (Results == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,6 +276,7 @@ HttpBootFormExtractConfig (
|
|||||||
if (ConfigRequest == NULL) {
|
if (ConfigRequest == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocatedRequest = TRUE;
|
AllocatedRequest = TRUE;
|
||||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||||
FreePool (ConfigRequestHdr);
|
FreePool (ConfigRequestHdr);
|
||||||
@ -291,6 +298,7 @@ HttpBootFormExtractConfig (
|
|||||||
FreePool (ConfigRequest);
|
FreePool (ConfigRequest);
|
||||||
ConfigRequest = NULL;
|
ConfigRequest = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Progress string to the original request string.
|
// Set Progress string to the original request string.
|
||||||
//
|
//
|
||||||
@ -359,6 +367,7 @@ HttpBootFormRouteConfig (
|
|||||||
if (Progress == NULL) {
|
if (Progress == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Progress = Configuration;
|
*Progress = Configuration;
|
||||||
|
|
||||||
if (Configuration == NULL) {
|
if (Configuration == NULL) {
|
||||||
@ -451,7 +460,7 @@ HttpBootFormCallback (
|
|||||||
AsciiUri = NULL;
|
AsciiUri = NULL;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
if (This == NULL || Value == NULL) {
|
if ((This == NULL) || (Value == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +497,6 @@ HttpBootFormCallback (
|
|||||||
Status = HttpBootCheckUriScheme (AsciiUri);
|
Status = HttpBootCheckUriScheme (AsciiUri);
|
||||||
|
|
||||||
if (Status == EFI_INVALID_PARAMETER) {
|
if (Status == EFI_INVALID_PARAMETER) {
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "HttpBootFormCallback: %r.\n", Status));
|
DEBUG ((DEBUG_ERROR, "HttpBootFormCallback: %r.\n", Status));
|
||||||
|
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -499,7 +507,6 @@ HttpBootFormCallback (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
} else if (Status == EFI_ACCESS_DENIED) {
|
} else if (Status == EFI_ACCESS_DENIED) {
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "HttpBootFormCallback: %r.\n", Status));
|
DEBUG ((DEBUG_ERROR, "HttpBootFormCallback: %r.\n", Status));
|
||||||
|
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -660,7 +667,7 @@ HttpBootConfigFormUnload (
|
|||||||
{
|
{
|
||||||
HTTP_BOOT_FORM_CALLBACK_INFO *CallbackInfo;
|
HTTP_BOOT_FORM_CALLBACK_INFO *CallbackInfo;
|
||||||
|
|
||||||
if (Private->Ip4Nic != NULL || Private->Ip6Nic != NULL) {
|
if ((Private->Ip4Nic != NULL) || (Private->Ip6Nic != NULL)) {
|
||||||
//
|
//
|
||||||
// Only unload the configuration form when both IP4 and IP6 stack are stopped.
|
// Only unload the configuration form when both IP4 and IP6 stack are stopped.
|
||||||
//
|
//
|
||||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef _HTTP_BOOT_CONFIG_H_
|
#ifndef _HTTP_BOOT_CONFIG_H_
|
||||||
#define _HTTP_BOOT_CONFIG_H_
|
#define _HTTP_BOOT_CONFIG_H_
|
||||||
|
|
||||||
|
|
||||||
#include "HttpBootConfigNVDataStruc.h"
|
#include "HttpBootConfigNVDataStruc.h"
|
||||||
|
|
||||||
typedef struct _HTTP_BOOT_FORM_CALLBACK_INFO HTTP_BOOT_FORM_CALLBACK_INFO;
|
typedef struct _HTTP_BOOT_FORM_CALLBACK_INFO HTTP_BOOT_FORM_CALLBACK_INFO;
|
||||||
|
@ -40,5 +40,4 @@ typedef struct _HTTP_BOOT_CONFIG_IFR_NVDATA {
|
|||||||
} HTTP_BOOT_CONFIG_IFR_NVDATA;
|
} HTTP_BOOT_CONFIG_IFR_NVDATA;
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,6 +98,7 @@ HttpBootBuildDhcp4Options (
|
|||||||
//
|
//
|
||||||
ZeroMem (OptEnt.Uuid->Guid, sizeof (EFI_GUID));
|
ZeroMem (OptEnt.Uuid->Guid, sizeof (EFI_GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]);
|
OptList[Index] = GET_NEXT_DHCP_OPTION (OptList[Index - 1]);
|
||||||
|
|
||||||
@ -185,7 +186,6 @@ HttpBootParseDhcp4Options (
|
|||||||
Offset = 0;
|
Offset = 0;
|
||||||
|
|
||||||
while (Offset < Length && Option->OpCode != DHCP4_TAG_EOP) {
|
while (Offset < Length && Option->OpCode != DHCP4_TAG_EOP) {
|
||||||
|
|
||||||
if (Option->OpCode == OptTag) {
|
if (Option->OpCode == OptTag) {
|
||||||
//
|
//
|
||||||
// Found the required option.
|
// Found the required option.
|
||||||
@ -284,6 +284,7 @@ HttpBootParseDhcp4Packet (
|
|||||||
mInterestedDhcp4Tags[Index]
|
mInterestedDhcp4Tags[Index]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132.
|
// Second, Check if bootfilename and serverhostname is overloaded to carry DHCP options refers to rfc-2132.
|
||||||
// If yes, try to parse options from the BootFileName field, then ServerName field.
|
// If yes, try to parse options from the BootFileName field, then ServerName field.
|
||||||
@ -302,6 +303,7 @@ HttpBootParseDhcp4Packet (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Option->Data[0] & HTTP_BOOT_DHCP4_OVERLOAD_SERVER_NAME) != 0) {
|
if ((Option->Data[0] & HTTP_BOOT_DHCP4_OVERLOAD_SERVER_NAME) != 0) {
|
||||||
for (Index = 0; Index < HTTP_BOOT_DHCP4_TAG_INDEX_MAX; Index++) {
|
for (Index = 0; Index < HTTP_BOOT_DHCP4_TAG_INDEX_MAX; Index++) {
|
||||||
if (Options[Index] == NULL) {
|
if (Options[Index] == NULL) {
|
||||||
@ -327,7 +329,8 @@ HttpBootParseDhcp4Packet (
|
|||||||
//
|
//
|
||||||
Option = Options[HTTP_BOOT_DHCP4_TAG_INDEX_CLASS_ID];
|
Option = Options[HTTP_BOOT_DHCP4_TAG_INDEX_CLASS_ID];
|
||||||
if ((Option != NULL) && (Option->Length >= 10) &&
|
if ((Option != NULL) && (Option->Length >= 10) &&
|
||||||
(CompareMem (Option->Data, DEFAULT_CLASS_ID_DATA, 10) == 0)) {
|
(CompareMem (Option->Data, DEFAULT_CLASS_ID_DATA, 10) == 0))
|
||||||
|
{
|
||||||
IsHttpOffer = TRUE;
|
IsHttpOffer = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +358,7 @@ HttpBootParseDhcp4Packet (
|
|||||||
if (*(Ptr8 - 1) != '\0') {
|
if (*(Ptr8 - 1) != '\0') {
|
||||||
*Ptr8 = '\0';
|
*Ptr8 = '\0';
|
||||||
}
|
}
|
||||||
} else if (!FileFieldOverloaded && Offer->Dhcp4.Header.BootFileName[0] != 0) {
|
} else if (!FileFieldOverloaded && (Offer->Dhcp4.Header.BootFileName[0] != 0)) {
|
||||||
//
|
//
|
||||||
// If the bootfile is not present and bootfilename is present in DHCPv4 packet, just parse it.
|
// If the bootfile is not present and bootfilename is present in DHCPv4 packet, just parse it.
|
||||||
// Do not count dhcp option header here, or else will destroy the serverhostname.
|
// Do not count dhcp option header here, or else will destroy the serverhostname.
|
||||||
@ -368,7 +371,7 @@ HttpBootParseDhcp4Packet (
|
|||||||
//
|
//
|
||||||
// Http offer must have a boot URI.
|
// Http offer must have a boot URI.
|
||||||
//
|
//
|
||||||
if (IsHttpOffer && Options[HTTP_BOOT_DHCP4_TAG_INDEX_BOOTFILE] == NULL) {
|
if (IsHttpOffer && (Options[HTTP_BOOT_DHCP4_TAG_INDEX_BOOTFILE] == NULL)) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,7 +414,6 @@ HttpBootParseDhcp4Packet (
|
|||||||
OfferType = HttpOfferTypeProxyNameUri;
|
OfferType = HttpOfferTypeProxyNameUri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!IsProxyOffer) {
|
if (!IsProxyOffer) {
|
||||||
OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
|
OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
|
||||||
@ -419,6 +421,7 @@ HttpBootParseDhcp4Packet (
|
|||||||
if (Cache4->UriParser != NULL) {
|
if (Cache4->UriParser != NULL) {
|
||||||
FreePool (Cache4->UriParser);
|
FreePool (Cache4->UriParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -500,26 +503,16 @@ HttpBootSelectDhcpOffer (
|
|||||||
// The offer with DNS server address takes priority here.
|
// The offer with DNS server address takes priority here.
|
||||||
//
|
//
|
||||||
if (Private->OfferCount[HttpOfferTypeDhcpDns] > 0) {
|
if (Private->OfferCount[HttpOfferTypeDhcpDns] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
||||||
|
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpIpUriDns] > 0) {
|
} else if (Private->OfferCount[HttpOfferTypeDhcpIpUriDns] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUriDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUriDns][0] + 1;
|
||||||
|
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpNameUriDns] > 0) {
|
} else if (Private->OfferCount[HttpOfferTypeDhcpNameUriDns] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpNameUriDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpNameUriDns][0] + 1;
|
||||||
|
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpOnly] > 0) {
|
} else if (Private->OfferCount[HttpOfferTypeDhcpOnly] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpOnly][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpOnly][0] + 1;
|
||||||
|
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpIpUri] > 0) {
|
} else if (Private->OfferCount[HttpOfferTypeDhcpIpUri] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUri][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUri][0] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// We are in corporate environment.
|
// We are in corporate environment.
|
||||||
@ -532,45 +525,35 @@ HttpBootSelectDhcpOffer (
|
|||||||
// Priority6: HttpOfferTypeDhcpDns + HttpOfferTypeDhcpNameUri
|
// Priority6: HttpOfferTypeDhcpDns + HttpOfferTypeDhcpNameUri
|
||||||
//
|
//
|
||||||
if (Private->OfferCount[HttpOfferTypeDhcpIpUri] > 0) {
|
if (Private->OfferCount[HttpOfferTypeDhcpIpUri] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUri][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUri][0] + 1;
|
||||||
|
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpIpUriDns] > 0) {
|
} else if (Private->OfferCount[HttpOfferTypeDhcpIpUriDns] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUriDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpIpUriDns][0] + 1;
|
||||||
|
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpNameUriDns] > 0) {
|
} else if (Private->OfferCount[HttpOfferTypeDhcpNameUriDns] > 0) {
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpNameUriDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpNameUriDns][0] + 1;
|
||||||
|
} else if ((Private->OfferCount[HttpOfferTypeDhcpOnly] > 0) &&
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpOnly] > 0 &&
|
(Private->OfferCount[HttpOfferTypeProxyIpUri] > 0))
|
||||||
Private->OfferCount[HttpOfferTypeProxyIpUri] > 0) {
|
{
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpOnly][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpOnly][0] + 1;
|
||||||
Private->SelectProxyType = HttpOfferTypeProxyIpUri;
|
Private->SelectProxyType = HttpOfferTypeProxyIpUri;
|
||||||
|
} else if ((Private->OfferCount[HttpOfferTypeDhcpDns] > 0) &&
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpDns] > 0 &&
|
(Private->OfferCount[HttpOfferTypeProxyIpUri] > 0))
|
||||||
Private->OfferCount[HttpOfferTypeProxyIpUri] > 0) {
|
{
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
||||||
Private->SelectProxyType = HttpOfferTypeProxyIpUri;
|
Private->SelectProxyType = HttpOfferTypeProxyIpUri;
|
||||||
|
} else if ((Private->OfferCount[HttpOfferTypeDhcpDns] > 0) &&
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpDns] > 0 &&
|
(Private->OfferCount[HttpOfferTypeProxyNameUri] > 0))
|
||||||
Private->OfferCount[HttpOfferTypeProxyNameUri] > 0) {
|
{
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
||||||
Private->SelectProxyType = HttpOfferTypeProxyNameUri;
|
Private->SelectProxyType = HttpOfferTypeProxyNameUri;
|
||||||
|
} else if ((Private->OfferCount[HttpOfferTypeDhcpDns] > 0) &&
|
||||||
} else if (Private->OfferCount[HttpOfferTypeDhcpDns] > 0 &&
|
(Private->OfferCount[HttpOfferTypeDhcpNameUri] > 0))
|
||||||
Private->OfferCount[HttpOfferTypeDhcpNameUri] > 0) {
|
{
|
||||||
|
|
||||||
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
Private->SelectIndex = Private->OfferIndex[HttpOfferTypeDhcpDns][0] + 1;
|
||||||
Private->SelectProxyType = HttpOfferTypeDhcpNameUri;
|
Private->SelectProxyType = HttpOfferTypeDhcpNameUri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
|
EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
|
||||||
to intercept events that occurred in the configuration process.
|
to intercept events that occurred in the configuration process.
|
||||||
@ -612,7 +595,8 @@ HttpBootDhcp4CallBack (
|
|||||||
(Dhcp4Event != Dhcp4RcvdOffer) &&
|
(Dhcp4Event != Dhcp4RcvdOffer) &&
|
||||||
(Dhcp4Event != Dhcp4SendRequest) &&
|
(Dhcp4Event != Dhcp4SendRequest) &&
|
||||||
(Dhcp4Event != Dhcp4RcvdAck) &&
|
(Dhcp4Event != Dhcp4RcvdAck) &&
|
||||||
(Dhcp4Event != Dhcp4SelectOffer)) {
|
(Dhcp4Event != Dhcp4SelectOffer))
|
||||||
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +618,7 @@ HttpBootDhcp4CallBack (
|
|||||||
//
|
//
|
||||||
// Callback to user if any packets sent or received.
|
// Callback to user if any packets sent or received.
|
||||||
//
|
//
|
||||||
if (Private->HttpBootCallback != NULL && Dhcp4Event != Dhcp4SelectOffer) {
|
if ((Private->HttpBootCallback != NULL) && (Dhcp4Event != Dhcp4SelectOffer)) {
|
||||||
Received = (BOOLEAN)(Dhcp4Event == Dhcp4RcvdOffer || Dhcp4Event == Dhcp4RcvdAck);
|
Received = (BOOLEAN)(Dhcp4Event == Dhcp4RcvdOffer || Dhcp4Event == Dhcp4RcvdAck);
|
||||||
Status = Private->HttpBootCallback->Callback (
|
Status = Private->HttpBootCallback->Callback (
|
||||||
Private->HttpBootCallback,
|
Private->HttpBootCallback,
|
||||||
@ -658,6 +642,7 @@ HttpBootDhcp4CallBack (
|
|||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM) {
|
if (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM) {
|
||||||
//
|
//
|
||||||
// Cache the DHCPv4 offers to OfferBuffer[] for select later, and record
|
// Cache the DHCPv4 offers to OfferBuffer[] for select later, and record
|
||||||
@ -666,6 +651,7 @@ HttpBootDhcp4CallBack (
|
|||||||
//
|
//
|
||||||
HttpBootCacheDhcp4Offer (Private, Packet);
|
HttpBootCacheDhcp4Offer (Private, Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Dhcp4SelectOffer:
|
case Dhcp4SelectOffer:
|
||||||
@ -680,6 +666,7 @@ HttpBootDhcp4CallBack (
|
|||||||
} else {
|
} else {
|
||||||
*NewPacket = &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp4.Packet.Offer;
|
*NewPacket = &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp4.Packet.Offer;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -761,7 +748,6 @@ HttpBootRegisterIp4Dns (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function will switch the IP4 configuration policy to Static.
|
This function will switch the IP4 configuration policy to Static.
|
||||||
|
|
||||||
|
@ -146,9 +146,7 @@ HttpBootParseDhcp6Options (
|
|||||||
// OpLen and OpCode here are both stored in network order.
|
// OpLen and OpCode here are both stored in network order.
|
||||||
//
|
//
|
||||||
while (Offset < Length) {
|
while (Offset < Length) {
|
||||||
|
|
||||||
if (NTOHS (Option->OpCode) == OptTag) {
|
if (NTOHS (Option->OpCode) == OptTag) {
|
||||||
|
|
||||||
return Option;
|
return Option;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +155,6 @@ HttpBootParseDhcp6Options (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +201,6 @@ HttpBootParseDhcp6Packet (
|
|||||||
// OpLen and OpCode here are both stored in network order, since they are from original packet.
|
// OpLen and OpCode here are both stored in network order, since they are from original packet.
|
||||||
//
|
//
|
||||||
while (Offset < Length) {
|
while (Offset < Length) {
|
||||||
|
|
||||||
if (NTOHS (Option->OpCode) == DHCP6_OPT_IA_NA) {
|
if (NTOHS (Option->OpCode) == DHCP6_OPT_IA_NA) {
|
||||||
Options[HTTP_BOOT_DHCP6_IDX_IA_NA] = Option;
|
Options[HTTP_BOOT_DHCP6_IDX_IA_NA] = Option;
|
||||||
} else if (NTOHS (Option->OpCode) == DHCP6_OPT_BOOT_FILE_URL) {
|
} else if (NTOHS (Option->OpCode) == DHCP6_OPT_BOOT_FILE_URL) {
|
||||||
@ -223,6 +219,7 @@ HttpBootParseDhcp6Packet (
|
|||||||
Offset += (NTOHS (Option->OpLen) + 4);
|
Offset += (NTOHS (Option->OpLen) + 4);
|
||||||
Option = (EFI_DHCP6_PACKET_OPTION *)(Offer->Dhcp6.Option + Offset);
|
Option = (EFI_DHCP6_PACKET_OPTION *)(Offer->Dhcp6.Option + Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The offer with assigned client address is NOT a proxy offer.
|
// The offer with assigned client address is NOT a proxy offer.
|
||||||
// An ia_na option, embedded with valid ia_addr option and a status_code of success.
|
// An ia_na option, embedded with valid ia_addr option and a status_code of success.
|
||||||
@ -234,7 +231,7 @@ HttpBootParseDhcp6Packet (
|
|||||||
NTOHS (Option->OpLen),
|
NTOHS (Option->OpLen),
|
||||||
DHCP6_OPT_STATUS_CODE
|
DHCP6_OPT_STATUS_CODE
|
||||||
);
|
);
|
||||||
if ((Option != NULL && Option->Data[0] == 0) || (Option == NULL)) {
|
if (((Option != NULL) && (Option->Data[0] == 0)) || (Option == NULL)) {
|
||||||
IsProxyOffer = FALSE;
|
IsProxyOffer = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,9 +241,10 @@ HttpBootParseDhcp6Packet (
|
|||||||
//
|
//
|
||||||
Option = Options[HTTP_BOOT_DHCP6_IDX_VENDOR_CLASS];
|
Option = Options[HTTP_BOOT_DHCP6_IDX_VENDOR_CLASS];
|
||||||
|
|
||||||
if (Option != NULL &&
|
if ((Option != NULL) &&
|
||||||
NTOHS(Option->OpLen) >= 16 &&
|
(NTOHS (Option->OpLen) >= 16) &&
|
||||||
CompareMem ((Option->Data + 6), DEFAULT_CLASS_ID_DATA, 10) == 0) {
|
(CompareMem ((Option->Data + 6), DEFAULT_CLASS_ID_DATA, 10) == 0))
|
||||||
|
{
|
||||||
IsHttpOffer = TRUE;
|
IsHttpOffer = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +259,7 @@ HttpBootParseDhcp6Packet (
|
|||||||
//
|
//
|
||||||
// Http offer must have a boot URI.
|
// Http offer must have a boot URI.
|
||||||
//
|
//
|
||||||
if (IsHttpOffer && Options[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL] == NULL) {
|
if (IsHttpOffer && (Options[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL] == NULL)) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +302,6 @@ HttpBootParseDhcp6Packet (
|
|||||||
OfferType = HttpOfferTypeProxyNameUri;
|
OfferType = HttpOfferTypeProxyNameUri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!IsProxyOffer) {
|
if (!IsProxyOffer) {
|
||||||
OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
|
OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
|
||||||
@ -434,7 +431,8 @@ HttpBootDhcp6CallBack (
|
|||||||
(Dhcp6Event != Dhcp6RcvdAdvertise) &&
|
(Dhcp6Event != Dhcp6RcvdAdvertise) &&
|
||||||
(Dhcp6Event != Dhcp6SendRequest) &&
|
(Dhcp6Event != Dhcp6SendRequest) &&
|
||||||
(Dhcp6Event != Dhcp6RcvdReply) &&
|
(Dhcp6Event != Dhcp6RcvdReply) &&
|
||||||
(Dhcp6Event != Dhcp6SelectAdvertise)) {
|
(Dhcp6Event != Dhcp6SelectAdvertise))
|
||||||
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +440,7 @@ HttpBootDhcp6CallBack (
|
|||||||
|
|
||||||
Private = (HTTP_BOOT_PRIVATE_DATA *)Context;
|
Private = (HTTP_BOOT_PRIVATE_DATA *)Context;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
if (Private->HttpBootCallback != NULL && Dhcp6Event != Dhcp6SelectAdvertise) {
|
if ((Private->HttpBootCallback != NULL) && (Dhcp6Event != Dhcp6SelectAdvertise)) {
|
||||||
Received = (BOOLEAN)(Dhcp6Event == Dhcp6RcvdAdvertise || Dhcp6Event == Dhcp6RcvdReply);
|
Received = (BOOLEAN)(Dhcp6Event == Dhcp6RcvdAdvertise || Dhcp6Event == Dhcp6RcvdReply);
|
||||||
Status = Private->HttpBootCallback->Callback (
|
Status = Private->HttpBootCallback->Callback (
|
||||||
Private->HttpBootCallback,
|
Private->HttpBootCallback,
|
||||||
@ -455,8 +453,8 @@ HttpBootDhcp6CallBack (
|
|||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (Dhcp6Event) {
|
|
||||||
|
|
||||||
|
switch (Dhcp6Event) {
|
||||||
case Dhcp6RcvdAdvertise:
|
case Dhcp6RcvdAdvertise:
|
||||||
Status = EFI_NOT_READY;
|
Status = EFI_NOT_READY;
|
||||||
if (Packet->Length > HTTP_BOOT_DHCP6_PACKET_MAX_SIZE) {
|
if (Packet->Length > HTTP_BOOT_DHCP6_PACKET_MAX_SIZE) {
|
||||||
@ -465,6 +463,7 @@ HttpBootDhcp6CallBack (
|
|||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM) {
|
if (Private->OfferNum < HTTP_BOOT_OFFER_MAX_NUM) {
|
||||||
//
|
//
|
||||||
// Cache the dhcp offers to OfferBuffer[] for select later, and record
|
// Cache the dhcp offers to OfferBuffer[] for select later, and record
|
||||||
@ -473,6 +472,7 @@ HttpBootDhcp6CallBack (
|
|||||||
//
|
//
|
||||||
HttpBootCacheDhcp6Offer (Private, Packet);
|
HttpBootCacheDhcp6Offer (Private, Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Dhcp6SelectAdvertise:
|
case Dhcp6SelectAdvertise:
|
||||||
@ -491,8 +491,10 @@ HttpBootDhcp6CallBack (
|
|||||||
if (*NewPacket == NULL) {
|
if (*NewPacket == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (*NewPacket, SelectAd, SelectAd->Size);
|
CopyMem (*NewPacket, SelectAd, SelectAd->Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -562,23 +564,28 @@ HttpBootCheckRouteTable (
|
|||||||
if (Ip6ModeData.AddressList != NULL) {
|
if (Ip6ModeData.AddressList != NULL) {
|
||||||
FreePool (Ip6ModeData.AddressList);
|
FreePool (Ip6ModeData.AddressList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.GroupTable != NULL) {
|
if (Ip6ModeData.GroupTable != NULL) {
|
||||||
FreePool (Ip6ModeData.GroupTable);
|
FreePool (Ip6ModeData.GroupTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.RouteTable != NULL) {
|
if (Ip6ModeData.RouteTable != NULL) {
|
||||||
FreePool (Ip6ModeData.RouteTable);
|
FreePool (Ip6ModeData.RouteTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.NeighborCache != NULL) {
|
if (Ip6ModeData.NeighborCache != NULL) {
|
||||||
FreePool (Ip6ModeData.NeighborCache);
|
FreePool (Ip6ModeData.NeighborCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.PrefixTable != NULL) {
|
if (Ip6ModeData.PrefixTable != NULL) {
|
||||||
FreePool (Ip6ModeData.PrefixTable);
|
FreePool (Ip6ModeData.PrefixTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.IcmpTypeList != NULL) {
|
if (Ip6ModeData.IcmpTypeList != NULL) {
|
||||||
FreePool (Ip6ModeData.IcmpTypeList);
|
FreePool (Ip6ModeData.IcmpTypeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GatewayIsFound || RetryCount == TimeOutInSecond) {
|
if (GatewayIsFound || (RetryCount == TimeOutInSecond)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,6 +611,7 @@ HttpBootCheckRouteTable (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) {
|
while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) {
|
||||||
Ip6->Poll (Ip6);
|
Ip6->Poll (Ip6);
|
||||||
}
|
}
|
||||||
@ -670,6 +678,7 @@ HttpBootSetIp6Policy (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,7 +859,7 @@ HttpBootSetIp6Address (
|
|||||||
sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS),
|
sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS),
|
||||||
&CfgAddr
|
&CfgAddr
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_NOT_READY) {
|
if (EFI_ERROR (Status) && (Status != EFI_NOT_READY)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
} else if (Status == EFI_NOT_READY) {
|
} else if (Status == EFI_NOT_READY) {
|
||||||
//
|
//
|
||||||
@ -859,6 +868,7 @@ HttpBootSetIp6Address (
|
|||||||
while (!IsAddressOk) {
|
while (!IsAddressOk) {
|
||||||
Ip6->Poll (Ip6);
|
Ip6->Poll (Ip6);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check whether the Ip6 Address setting is successed.
|
// Check whether the Ip6 Address setting is successed.
|
||||||
//
|
//
|
||||||
@ -869,7 +879,7 @@ HttpBootSetIp6Address (
|
|||||||
&DataSize,
|
&DataSize,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (Status != EFI_BUFFER_TOO_SMALL || DataSize == 0) {
|
if ((Status != EFI_BUFFER_TOO_SMALL) || (DataSize == 0)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -878,6 +888,7 @@ HttpBootSetIp6Address (
|
|||||||
if (Ip6Addr == NULL) {
|
if (Ip6Addr == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Ip6Cfg->GetData (
|
Status = Ip6Cfg->GetData (
|
||||||
Ip6Cfg,
|
Ip6Cfg,
|
||||||
Ip6ConfigDataTypeManualAddress,
|
Ip6ConfigDataTypeManualAddress,
|
||||||
@ -894,6 +905,7 @@ HttpBootSetIp6Address (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index == DataSize / sizeof (EFI_IPv6_ADDRESS)) {
|
if (Index == DataSize / sizeof (EFI_IPv6_ADDRESS)) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
@ -980,6 +992,7 @@ HttpBootDhcp6Sarr (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the record fields for DHCPv6 offer in private data.
|
// Initialize the record fields for DHCPv6 offer in private data.
|
||||||
//
|
//
|
||||||
@ -1021,12 +1034,11 @@ ON_EXIT:
|
|||||||
if (Mode.ClientId != NULL) {
|
if (Mode.ClientId != NULL) {
|
||||||
FreePool (Mode.ClientId);
|
FreePool (Mode.ClientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode.Ia != NULL) {
|
if (Mode.Ia != NULL) {
|
||||||
FreePool (Mode.Ia);
|
FreePool (Mode.Ia);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __EFI_HTTP_BOOT_DHCP6_H__
|
#ifndef __EFI_HTTP_BOOT_DHCP6_H__
|
||||||
#define __EFI_HTTP_BOOT_DHCP6_H__
|
#define __EFI_HTTP_BOOT_DHCP6_H__
|
||||||
|
|
||||||
|
@ -29,8 +29,6 @@ EFI_DRIVER_BINDING_PROTOCOL gHttpBootIp6DxeDriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether UNDI protocol supports IPv6.
|
Check whether UNDI protocol supports IPv6.
|
||||||
|
|
||||||
@ -81,14 +79,14 @@ HttpBootCheckIpv6Support (
|
|||||||
&gEfiAdapterInformationProtocolGuid,
|
&gEfiAdapterInformationProtocolGuid,
|
||||||
(VOID *)&Aip
|
(VOID *)&Aip
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || Aip == NULL) {
|
if (EFI_ERROR (Status) || (Aip == NULL)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoTypesBuffer = NULL;
|
InfoTypesBuffer = NULL;
|
||||||
InfoTypeBufferCount = 0;
|
InfoTypeBufferCount = 0;
|
||||||
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
|
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
|
||||||
if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {
|
if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) {
|
||||||
FreePool (InfoTypesBuffer);
|
FreePool (InfoTypesBuffer);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -112,7 +110,7 @@ HttpBootCheckIpv6Support (
|
|||||||
InfoBlock = NULL;
|
InfoBlock = NULL;
|
||||||
InfoBlockSize = 0;
|
InfoBlockSize = 0;
|
||||||
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
|
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
|
||||||
if (EFI_ERROR (Status) || InfoBlock == NULL) {
|
if (EFI_ERROR (Status) || (InfoBlock == NULL)) {
|
||||||
FreePool (InfoBlock);
|
FreePool (InfoBlock);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -155,13 +153,12 @@ HttpBootDestroyIp4Children (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->Ip6Nic == NULL && Private->HttpCreated) {
|
if ((Private->Ip6Nic == NULL) && Private->HttpCreated) {
|
||||||
HttpIoDestroyIo (&Private->HttpIo);
|
HttpIoDestroyIo (&Private->HttpIo);
|
||||||
Private->HttpCreated = FALSE;
|
Private->HttpCreated = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->Ip4Nic != NULL) {
|
if (Private->Ip4Nic != NULL) {
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
Private->Controller,
|
Private->Controller,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
@ -180,7 +177,6 @@ HttpBootDestroyIp4Children (
|
|||||||
FreePool (Private->Ip4Nic);
|
FreePool (Private->Ip4Nic);
|
||||||
Private->Ip4Nic = NULL;
|
Private->Ip4Nic = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,13 +227,12 @@ HttpBootDestroyIp6Children (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->Ip4Nic == NULL && Private->HttpCreated) {
|
if ((Private->Ip4Nic == NULL) && Private->HttpCreated) {
|
||||||
HttpIoDestroyIo (&Private->HttpIo);
|
HttpIoDestroyIo (&Private->HttpIo);
|
||||||
Private->HttpCreated = FALSE;
|
Private->HttpCreated = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->Ip6Nic != NULL) {
|
if (Private->Ip6Nic != NULL) {
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
Private->Controller,
|
Private->Controller,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
@ -349,7 +344,6 @@ HttpBootIp4DxeDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Starts a device controller or a bus controller.
|
Starts a device controller or a bus controller.
|
||||||
|
|
||||||
@ -423,6 +417,7 @@ HttpBootIp4DxeDriverBindingStart (
|
|||||||
if (Private == NULL) {
|
if (Private == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;
|
Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;
|
||||||
Private->Controller = ControllerHandle;
|
Private->Controller = ControllerHandle;
|
||||||
InitializeListHead (&Private->CacheList);
|
InitializeListHead (&Private->CacheList);
|
||||||
@ -477,7 +472,6 @@ HttpBootIp4DxeDriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->Ip4Nic != NULL) {
|
if (Private->Ip4Nic != NULL) {
|
||||||
@ -492,6 +486,7 @@ HttpBootIp4DxeDriverBindingStart (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->Ip4Nic->Private = Private;
|
Private->Ip4Nic->Private = Private;
|
||||||
Private->Ip4Nic->ImageHandle = This->DriverBindingHandle;
|
Private->Ip4Nic->ImageHandle = This->DriverBindingHandle;
|
||||||
Private->Ip4Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
|
Private->Ip4Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
|
||||||
@ -544,6 +539,7 @@ HttpBootIp4DxeDriverBindingStart (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH;
|
Node->Ipv4.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->Ipv4.Header.SubType = MSG_IPv4_DP;
|
Node->Ipv4.Header.SubType = MSG_IPv4_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));
|
SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));
|
||||||
@ -563,6 +559,7 @@ HttpBootIp4DxeDriverBindingStart (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->DevPath.SubType = MSG_URI_DP;
|
Node->DevPath.SubType = MSG_URI_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
SetDevicePathNodeLength (Node, sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
||||||
@ -629,7 +626,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stops a device controller or a bus controller.
|
Stops a device controller or a bus controller.
|
||||||
|
|
||||||
@ -705,6 +701,7 @@ HttpBootIp4DxeDriverBindingStop (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id);
|
Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id);
|
||||||
} else {
|
} else {
|
||||||
Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile);
|
Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile);
|
||||||
@ -715,7 +712,7 @@ HttpBootIp4DxeDriverBindingStop (
|
|||||||
// Disable the HTTP boot function.
|
// Disable the HTTP boot function.
|
||||||
//
|
//
|
||||||
Status = HttpBootStop (Private);
|
Status = HttpBootStop (Private);
|
||||||
if (Status != EFI_SUCCESS && Status != EFI_NOT_STARTED) {
|
if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_STARTED)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +721,7 @@ HttpBootIp4DxeDriverBindingStop (
|
|||||||
//
|
//
|
||||||
HttpBootDestroyIp4Children (This, Private);
|
HttpBootDestroyIp4Children (This, Private);
|
||||||
|
|
||||||
if (Private->Ip4Nic == NULL && Private->Ip6Nic == NULL) {
|
if ((Private->Ip4Nic == NULL) && (Private->Ip6Nic == NULL)) {
|
||||||
//
|
//
|
||||||
// Release the cached data.
|
// Release the cached data.
|
||||||
//
|
//
|
||||||
@ -741,7 +738,6 @@ HttpBootIp4DxeDriverBindingStop (
|
|||||||
&Private->Id
|
&Private->Id
|
||||||
);
|
);
|
||||||
FreePool (Private);
|
FreePool (Private);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -836,7 +832,6 @@ HttpBootIp6DxeDriverBindingSupported (
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -913,6 +908,7 @@ HttpBootIp6DxeDriverBindingStart (
|
|||||||
if (Private == NULL) {
|
if (Private == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;
|
Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;
|
||||||
Private->Controller = ControllerHandle;
|
Private->Controller = ControllerHandle;
|
||||||
InitializeListHead (&Private->CacheList);
|
InitializeListHead (&Private->CacheList);
|
||||||
@ -967,7 +963,6 @@ HttpBootIp6DxeDriverBindingStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -999,6 +994,7 @@ HttpBootIp6DxeDriverBindingStart (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->Ip6Nic->Private = Private;
|
Private->Ip6Nic->Private = Private;
|
||||||
Private->Ip6Nic->ImageHandle = This->DriverBindingHandle;
|
Private->Ip6Nic->ImageHandle = This->DriverBindingHandle;
|
||||||
Private->Ip6Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
|
Private->Ip6Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
|
||||||
@ -1075,6 +1071,7 @@ HttpBootIp6DxeDriverBindingStart (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH;
|
Node->Ipv6.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->Ipv6.Header.SubType = MSG_IPv6_DP;
|
Node->Ipv6.Header.SubType = MSG_IPv6_DP;
|
||||||
Node->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;
|
Node->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;
|
||||||
@ -1094,6 +1091,7 @@ HttpBootIp6DxeDriverBindingStart (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
Node->DevPath.Type = MESSAGING_DEVICE_PATH;
|
||||||
Node->DevPath.SubType = MSG_URI_DP;
|
Node->DevPath.SubType = MSG_URI_DP;
|
||||||
SetDevicePathNodeLength (Node, sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
SetDevicePathNodeLength (Node, sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
||||||
@ -1235,6 +1233,7 @@ HttpBootIp6DxeDriverBindingStop (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id);
|
Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID (Id);
|
||||||
} else {
|
} else {
|
||||||
Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile);
|
Private = HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE (LoadFile);
|
||||||
@ -1245,7 +1244,7 @@ HttpBootIp6DxeDriverBindingStop (
|
|||||||
// Disable the HTTP boot function.
|
// Disable the HTTP boot function.
|
||||||
//
|
//
|
||||||
Status = HttpBootStop (Private);
|
Status = HttpBootStop (Private);
|
||||||
if (Status != EFI_SUCCESS && Status != EFI_NOT_STARTED) {
|
if ((Status != EFI_SUCCESS) && (Status != EFI_NOT_STARTED)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1254,7 +1253,7 @@ HttpBootIp6DxeDriverBindingStop (
|
|||||||
//
|
//
|
||||||
HttpBootDestroyIp6Children (This, Private);
|
HttpBootDestroyIp6Children (This, Private);
|
||||||
|
|
||||||
if (Private->Ip4Nic == NULL && Private->Ip6Nic == NULL) {
|
if ((Private->Ip4Nic == NULL) && (Private->Ip6Nic == NULL)) {
|
||||||
//
|
//
|
||||||
// Release the cached data.
|
// Release the cached data.
|
||||||
//
|
//
|
||||||
@ -1271,11 +1270,11 @@ HttpBootIp6DxeDriverBindingStop (
|
|||||||
&Private->Id
|
&Private->Id
|
||||||
);
|
);
|
||||||
FreePool (Private);
|
FreePool (Private);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the declaration of an EFI image entry point. This entry point is
|
This is the declaration of an EFI image entry point. This entry point is
|
||||||
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
||||||
@ -1327,6 +1326,6 @@ HttpBootDxeDriverEntryPoint (
|
|||||||
&gHttpBootDxeComponentName2
|
&gHttpBootDxeComponentName2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,6 @@ struct _HTTP_BOOT_PRIVATE_DATA {
|
|||||||
EFI_DHCP6_PROTOCOL *Dhcp6;
|
EFI_DHCP6_PROTOCOL *Dhcp6;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Produced protocol
|
// Produced protocol
|
||||||
//
|
//
|
||||||
@ -522,4 +521,5 @@ HttpBootIp6DxeDriverBindingStop (
|
|||||||
IN UINTN NumberOfChildren,
|
IN UINTN NumberOfChildren,
|
||||||
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
|
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,7 +41,6 @@ HttpBootInstallCallback (
|
|||||||
(VOID **)&Private->HttpBootCallback
|
(VOID **)&Private->HttpBootCallback
|
||||||
);
|
);
|
||||||
if (Status == EFI_UNSUPPORTED) {
|
if (Status == EFI_UNSUPPORTED) {
|
||||||
|
|
||||||
CopyMem (
|
CopyMem (
|
||||||
&Private->LoadFileCallback,
|
&Private->LoadFileCallback,
|
||||||
&gHttpBootDxeHttpBootCallback,
|
&gHttpBootDxeHttpBootCallback,
|
||||||
@ -60,6 +59,7 @@ HttpBootInstallCallback (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->HttpBootCallback = &Private->LoadFileCallback;
|
Private->HttpBootCallback = &Private->LoadFileCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ HttpBootStart (
|
|||||||
|
|
||||||
Uri = NULL;
|
Uri = NULL;
|
||||||
|
|
||||||
if (Private == NULL || FilePath == NULL) {
|
if ((Private == NULL) || (FilePath == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +143,8 @@ HttpBootStart (
|
|||||||
// recorded before.
|
// recorded before.
|
||||||
//
|
//
|
||||||
if ((UsingIpv6 != Private->UsingIpv6) ||
|
if ((UsingIpv6 != Private->UsingIpv6) ||
|
||||||
((Uri != NULL) && (AsciiStrCmp (Private->BootFileUri, Uri) != 0))) {
|
((Uri != NULL) && (AsciiStrCmp (Private->BootFileUri, Uri) != 0)))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Restart is required, first stop then continue this start function.
|
// Restart is required, first stop then continue this start function.
|
||||||
//
|
//
|
||||||
@ -152,6 +153,7 @@ HttpBootStart (
|
|||||||
if (Uri != NULL) {
|
if (Uri != NULL) {
|
||||||
FreePool (Uri);
|
FreePool (Uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -161,6 +163,7 @@ HttpBootStart (
|
|||||||
if (Uri != NULL) {
|
if (Uri != NULL) {
|
||||||
FreePool (Uri);
|
FreePool (Uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,14 +171,15 @@ HttpBootStart (
|
|||||||
//
|
//
|
||||||
// Detect whether using ipv6 or not, and set it to the private data.
|
// Detect whether using ipv6 or not, and set it to the private data.
|
||||||
//
|
//
|
||||||
if (UsingIpv6 && Private->Ip6Nic != NULL) {
|
if (UsingIpv6 && (Private->Ip6Nic != NULL)) {
|
||||||
Private->UsingIpv6 = TRUE;
|
Private->UsingIpv6 = TRUE;
|
||||||
} else if (!UsingIpv6 && Private->Ip4Nic != NULL) {
|
} else if (!UsingIpv6 && (Private->Ip4Nic != NULL)) {
|
||||||
Private->UsingIpv6 = FALSE;
|
Private->UsingIpv6 = FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (Uri != NULL) {
|
if (Uri != NULL) {
|
||||||
FreePool (Uri);
|
FreePool (Uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,6 +223,7 @@ HttpBootStart (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->Started = TRUE;
|
Private->Started = TRUE;
|
||||||
Print (L"\n>>Start HTTP Boot over IPv%d", Private->UsingIpv6 ? 6 : 4);
|
Print (L"\n>>Start HTTP Boot over IPv%d", Private->UsingIpv6 ? 6 : 4);
|
||||||
|
|
||||||
@ -302,11 +307,11 @@ HttpBootLoadFile (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (Private == NULL || ImageType == NULL || BufferSize == NULL ) {
|
if ((Private == NULL) || (ImageType == NULL) || (BufferSize == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*BufferSize != 0 && Buffer == NULL) {
|
if ((*BufferSize != 0) && (Buffer == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +360,7 @@ HttpBootLoadFile (
|
|||||||
NULL,
|
NULL,
|
||||||
&Private->ImageType
|
&Private->ImageType
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
//
|
//
|
||||||
// Failed to get file size by HEAD method, may be trunked encoding, try HTTP GET method.
|
// Failed to get file size by HEAD method, may be trunked encoding, try HTTP GET method.
|
||||||
//
|
//
|
||||||
@ -367,7 +372,7 @@ HttpBootLoadFile (
|
|||||||
NULL,
|
NULL,
|
||||||
&Private->ImageType
|
&Private->ImageType
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
AsciiPrint ("\n Error: Could not retrieve NBP file size from HTTP server.\n");
|
AsciiPrint ("\n Error: Could not retrieve NBP file size from HTTP server.\n");
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -398,7 +403,7 @@ ON_EXIT:
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_ACCESS_DENIED) {
|
if (Status == EFI_ACCESS_DENIED) {
|
||||||
AsciiPrint ("\n Error: Could not establish connection with HTTP server.\n");
|
AsciiPrint ("\n Error: Could not establish connection with HTTP server.\n");
|
||||||
} else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
|
} else if ((Status == EFI_BUFFER_TOO_SMALL) && (Buffer != NULL)) {
|
||||||
AsciiPrint ("\n Error: Buffer size is smaller than the requested file.\n");
|
AsciiPrint ("\n Error: Buffer size is smaller than the requested file.\n");
|
||||||
} else if (Status == EFI_OUT_OF_RESOURCES) {
|
} else if (Status == EFI_OUT_OF_RESOURCES) {
|
||||||
AsciiPrint ("\n Error: Could not allocate I/O buffers.\n");
|
AsciiPrint ("\n Error: Could not allocate I/O buffers.\n");
|
||||||
@ -554,7 +559,7 @@ HttpBootDxeLoadFile (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
HTTP_BOOT_IMAGE_TYPE ImageType;
|
HTTP_BOOT_IMAGE_TYPE ImageType;
|
||||||
|
|
||||||
if (This == NULL || BufferSize == NULL || FilePath == NULL) {
|
if ((This == NULL) || (BufferSize == NULL) || (FilePath == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,7 +595,7 @@ HttpBootDxeLoadFile (
|
|||||||
// Initialize HTTP boot.
|
// Initialize HTTP boot.
|
||||||
//
|
//
|
||||||
Status = HttpBootStart (Private, UsingIpv6, FilePath);
|
Status = HttpBootStart (Private, UsingIpv6, FilePath);
|
||||||
if (Status != EFI_SUCCESS && Status != EFI_ALREADY_STARTED) {
|
if ((Status != EFI_SUCCESS) && (Status != EFI_ALREADY_STARTED)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,18 +605,19 @@ HttpBootDxeLoadFile (
|
|||||||
ImageType = ImageTypeMax;
|
ImageType = ImageTypeMax;
|
||||||
Status = HttpBootLoadFile (Private, BufferSize, Buffer, &ImageType);
|
Status = HttpBootLoadFile (Private, BufferSize, Buffer, &ImageType);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_BUFFER_TOO_SMALL && (ImageType == ImageTypeVirtualCd || ImageType == ImageTypeVirtualDisk)) {
|
if ((Status == EFI_BUFFER_TOO_SMALL) && ((ImageType == ImageTypeVirtualCd) || (ImageType == ImageTypeVirtualDisk))) {
|
||||||
Status = EFI_WARN_FILE_SYSTEM;
|
Status = EFI_WARN_FILE_SYSTEM;
|
||||||
} else if (Status != EFI_BUFFER_TOO_SMALL) {
|
} else if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||||
HttpBootStop (Private);
|
HttpBootStop (Private);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register the RAM Disk to the system if needed.
|
// Register the RAM Disk to the system if needed.
|
||||||
//
|
//
|
||||||
if (ImageType == ImageTypeVirtualCd || ImageType == ImageTypeVirtualDisk) {
|
if ((ImageType == ImageTypeVirtualCd) || (ImageType == ImageTypeVirtualDisk)) {
|
||||||
Status = HttpBootRegisterRamDisk (Private, *BufferSize, Buffer, ImageType);
|
Status = HttpBootRegisterRamDisk (Private, *BufferSize, Buffer, ImageType);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = EFI_WARN_FILE_SYSTEM;
|
Status = EFI_WARN_FILE_SYSTEM;
|
||||||
@ -682,11 +688,13 @@ HttpBootCallback (
|
|||||||
case HttpBootHttpRequest:
|
case HttpBootHttpRequest:
|
||||||
if (Data != NULL) {
|
if (Data != NULL) {
|
||||||
HttpMessage = (EFI_HTTP_MESSAGE *)Data;
|
HttpMessage = (EFI_HTTP_MESSAGE *)Data;
|
||||||
if (HttpMessage->Data.Request->Method == HttpMethodGet &&
|
if ((HttpMessage->Data.Request->Method == HttpMethodGet) &&
|
||||||
HttpMessage->Data.Request->Url != NULL) {
|
(HttpMessage->Data.Request->Url != NULL))
|
||||||
|
{
|
||||||
Print (L"\n URI: %s\n", HttpMessage->Data.Request->Url);
|
Print (L"\n URI: %s\n", HttpMessage->Data.Request->Url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpBootHttpResponse:
|
case HttpBootHttpResponse:
|
||||||
@ -708,6 +716,7 @@ HttpBootCallback (
|
|||||||
if (HttpHeader != NULL) {
|
if (HttpHeader != NULL) {
|
||||||
Print (L"\n HTTP ERROR: Resource Redirected.\n New Location: %a\n", HttpHeader->FieldValue);
|
Print (L"\n HTTP ERROR: Resource Redirected.\n New Location: %a\n", HttpHeader->FieldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -723,6 +732,7 @@ HttpBootCallback (
|
|||||||
Private->Percentage = 0;
|
Private->Percentage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpBootHttpEntityBody:
|
case HttpBootHttpEntityBody:
|
||||||
@ -734,6 +744,7 @@ HttpBootCallback (
|
|||||||
if (Private->ReceivedSize == 0) {
|
if (Private->ReceivedSize == 0) {
|
||||||
Print (L" File Size: %lu Bytes\n", Private->FileSize);
|
Print (L" File Size: %lu Bytes\n", Private->FileSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
Private->ReceivedSize += DataLength;
|
Private->ReceivedSize += DataLength;
|
||||||
Percentage = (UINT32)DivU64x64Remainder (MultU64x32 (Private->ReceivedSize, 100), Private->FileSize, NULL);
|
Percentage = (UINT32)DivU64x64Remainder (MultU64x32 (Private->ReceivedSize, 100), Private->FileSize, NULL);
|
||||||
if (Private->Percentage != Percentage) {
|
if (Private->Percentage != Percentage) {
|
||||||
@ -749,11 +760,12 @@ HttpBootCallback (
|
|||||||
Print (L"\r Downloading...%lu Bytes", Private->ReceivedSize);
|
Print (L"\r Downloading...%lu Bytes", Private->ReceivedSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
|||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __EFI_HTTP_BOOT_IMPL_H__
|
#ifndef __EFI_HTTP_BOOT_IMPL_H__
|
||||||
#define __EFI_HTTP_BOOT_IMPL_H__
|
#define __EFI_HTTP_BOOT_IMPL_H__
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "HttpBootDxe.h"
|
#include "HttpBootDxe.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the Nic handle using any child handle in the IPv4 stack.
|
Get the Nic handle using any child handle in the IPv4 stack.
|
||||||
|
|
||||||
@ -52,6 +51,7 @@ HttpBootGetNicByIp6Children (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_HANDLE NicHandle;
|
EFI_HANDLE NicHandle;
|
||||||
|
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiHttpProtocolGuid);
|
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiHttpProtocolGuid);
|
||||||
if (NicHandle == NULL) {
|
if (NicHandle == NULL) {
|
||||||
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);
|
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp6ProtocolGuid);
|
||||||
@ -122,17 +122,19 @@ HttpBootShowIp6Addr (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
for (Index = 0; Index < 16; Index++) {
|
for (Index = 0; Index < 16; Index++) {
|
||||||
|
|
||||||
if (Ip->Addr[Index] != 0) {
|
if (Ip->Addr[Index] != 0) {
|
||||||
AsciiPrint ("%x", Ip->Addr[Index]);
|
AsciiPrint ("%x", Ip->Addr[Index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
if (Index > 15) {
|
if (Index > 15) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) {
|
if (((Ip->Addr[Index] & 0xf0) == 0) && (Ip->Addr[Index - 1] != 0)) {
|
||||||
AsciiPrint ("0");
|
AsciiPrint ("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiPrint ("%x", Ip->Addr[Index]);
|
AsciiPrint ("%x", Ip->Addr[Index]);
|
||||||
if (Index < 15) {
|
if (Index < 15) {
|
||||||
AsciiPrint (":");
|
AsciiPrint (":");
|
||||||
@ -283,7 +285,6 @@ HttpBootPrintErrorMessage (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:;
|
default:;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,6 +365,7 @@ HttpBootDns (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create a DNSv6 child instance and get the protocol.
|
// Create a DNSv6 child instance and get the protocol.
|
||||||
//
|
//
|
||||||
@ -443,25 +445,30 @@ HttpBootDns (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
|
|
||||||
|
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We just return the first IPv6 address from DNS protocol.
|
// We just return the first IPv6 address from DNS protocol.
|
||||||
//
|
//
|
||||||
IP6_COPY_ADDRESS (IpAddress, Token.RspData.H2AData->IpList);
|
IP6_COPY_ADDRESS (IpAddress, Token.RspData.H2AData->IpList);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
|
|
||||||
if (Token.Event != NULL) {
|
if (Token.Event != NULL) {
|
||||||
gBS->CloseEvent (Token.Event);
|
gBS->CloseEvent (Token.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token.RspData.H2AData != NULL) {
|
if (Token.RspData.H2AData != NULL) {
|
||||||
if (Token.RspData.H2AData->IpList != NULL) {
|
if (Token.RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Token.RspData.H2AData->IpList);
|
FreePool (Token.RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Token.RspData.H2AData);
|
FreePool (Token.RspData.H2AData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +526,8 @@ HttpBootCheckUriScheme (
|
|||||||
if (Uri[Index] == ':') {
|
if (Uri[Index] == ':') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Uri[Index] >= 'A' && Uri[Index] <= 'Z') {
|
|
||||||
|
if ((Uri[Index] >= 'A') && (Uri[Index] <= 'Z')) {
|
||||||
Uri[Index] -= (CHAR8)('A' - 'a');
|
Uri[Index] -= (CHAR8)('A' - 'a');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -578,7 +586,8 @@ HttpBootParseFilePath (
|
|||||||
TempDevicePath = FilePath;
|
TempDevicePath = FilePath;
|
||||||
while (!IsDevicePathEnd (TempDevicePath)) {
|
while (!IsDevicePathEnd (TempDevicePath)) {
|
||||||
if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) &&
|
if ((DevicePathType (TempDevicePath) == MESSAGING_DEVICE_PATH) &&
|
||||||
(DevicePathSubType (TempDevicePath) == MSG_URI_DP)) {
|
(DevicePathSubType (TempDevicePath) == MSG_URI_DP))
|
||||||
|
{
|
||||||
UriDevicePath = (URI_DEVICE_PATH *)TempDevicePath;
|
UriDevicePath = (URI_DEVICE_PATH *)TempDevicePath;
|
||||||
//
|
//
|
||||||
// UEFI Spec doesn't require the URI to be a NULL-terminated string
|
// UEFI Spec doesn't require the URI to be a NULL-terminated string
|
||||||
@ -591,15 +600,18 @@ HttpBootParseFilePath (
|
|||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri = AllocatePool (UriStrLength + 1);
|
Uri = AllocatePool (UriStrLength + 1);
|
||||||
if (Uri == NULL) {
|
if (Uri == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Uri, UriDevicePath->Uri, DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
CopyMem (Uri, UriDevicePath->Uri, DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL));
|
||||||
Uri[DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL)] = '\0';
|
Uri[DevicePathNodeLength (UriDevicePath) - sizeof (EFI_DEVICE_PATH_PROTOCOL)] = '\0';
|
||||||
|
|
||||||
*UriAddress = Uri;
|
*UriAddress = Uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
TempDevicePath = NextDevicePathNode (TempDevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,11 +649,11 @@ HttpBootCheckImageType (
|
|||||||
CHAR8 *FilePath;
|
CHAR8 *FilePath;
|
||||||
CHAR8 *FilePost;
|
CHAR8 *FilePost;
|
||||||
|
|
||||||
if (Uri == NULL || UriParser == NULL || ImageType == NULL) {
|
if ((Uri == NULL) || (UriParser == NULL) || (ImageType == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HeaderCount != 0 && Headers == NULL) {
|
if ((HeaderCount != 0) && (Headers == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,10 +780,11 @@ HttpBootIsHttpRedirectStatusCode (
|
|||||||
IN EFI_HTTP_STATUS_CODE StatusCode
|
IN EFI_HTTP_STATUS_CODE StatusCode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (StatusCode == HTTP_STATUS_301_MOVED_PERMANENTLY ||
|
if ((StatusCode == HTTP_STATUS_301_MOVED_PERMANENTLY) ||
|
||||||
StatusCode == HTTP_STATUS_302_FOUND ||
|
(StatusCode == HTTP_STATUS_302_FOUND) ||
|
||||||
StatusCode == HTTP_STATUS_307_TEMPORARY_REDIRECT ||
|
(StatusCode == HTTP_STATUS_307_TEMPORARY_REDIRECT) ||
|
||||||
StatusCode == HTTP_STATUS_308_PERMANENT_REDIRECT) {
|
(StatusCode == HTTP_STATUS_308_PERMANENT_REDIRECT))
|
||||||
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ HttpBootUintnToAscDecWithFormat (
|
|||||||
IN INTN Length
|
IN INTN Length
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function is to display the IPv4 address.
|
This function is to display the IPv4 address.
|
||||||
|
|
||||||
@ -212,4 +211,5 @@ BOOLEAN
|
|||||||
HttpBootIsHttpRedirectStatusCode (
|
HttpBootIsHttpRedirectStatusCode (
|
||||||
IN EFI_HTTP_STATUS_CODE StatusCode
|
IN EFI_HTTP_STATUS_CODE StatusCode
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,7 +40,6 @@ HttpDns4 (
|
|||||||
EFI_IPv4_ADDRESS *DnsServerList;
|
EFI_IPv4_ADDRESS *DnsServerList;
|
||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
|
|
||||||
|
|
||||||
Service = HttpInstance->Service;
|
Service = HttpInstance->Service;
|
||||||
ASSERT (Service != NULL);
|
ASSERT (Service != NULL);
|
||||||
|
|
||||||
@ -113,6 +112,7 @@ HttpDns4 (
|
|||||||
IP4_COPY_ADDRESS (&Dns4CfgData.StationIp, &HttpInstance->IPv4Node.LocalAddress);
|
IP4_COPY_ADDRESS (&Dns4CfgData.StationIp, &HttpInstance->IPv4Node.LocalAddress);
|
||||||
IP4_COPY_ADDRESS (&Dns4CfgData.SubnetMask, &HttpInstance->IPv4Node.LocalSubnet);
|
IP4_COPY_ADDRESS (&Dns4CfgData.SubnetMask, &HttpInstance->IPv4Node.LocalSubnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dns4CfgData.EnableDnsCache = TRUE;
|
Dns4CfgData.EnableDnsCache = TRUE;
|
||||||
Dns4CfgData.Protocol = EFI_IP_PROTO_UDP;
|
Dns4CfgData.Protocol = EFI_IP_PROTO_UDP;
|
||||||
Status = Dns4->Configure (
|
Status = Dns4->Configure (
|
||||||
@ -161,10 +161,12 @@ HttpDns4 (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
|
|
||||||
|
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We just return the first IP address from DNS protocol.
|
// We just return the first IP address from DNS protocol.
|
||||||
//
|
//
|
||||||
@ -177,10 +179,12 @@ Exit:
|
|||||||
if (Token.Event != NULL) {
|
if (Token.Event != NULL) {
|
||||||
gBS->CloseEvent (Token.Event);
|
gBS->CloseEvent (Token.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token.RspData.H2AData != NULL) {
|
if (Token.RspData.H2AData != NULL) {
|
||||||
if (Token.RspData.H2AData->IpList != NULL) {
|
if (Token.RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Token.RspData.H2AData->IpList);
|
FreePool (Token.RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Token.RspData.H2AData);
|
FreePool (Token.RspData.H2AData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +247,6 @@ HttpDns6 (
|
|||||||
UINTN DataSize;
|
UINTN DataSize;
|
||||||
BOOLEAN IsDone;
|
BOOLEAN IsDone;
|
||||||
|
|
||||||
|
|
||||||
Service = HttpInstance->Service;
|
Service = HttpInstance->Service;
|
||||||
ASSERT (Service != NULL);
|
ASSERT (Service != NULL);
|
||||||
|
|
||||||
@ -358,10 +361,12 @@ HttpDns6 (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
|
|
||||||
|
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We just return the first IPv6 address from DNS protocol.
|
// We just return the first IPv6 address from DNS protocol.
|
||||||
//
|
//
|
||||||
@ -374,10 +379,12 @@ Exit:
|
|||||||
if (Token.Event != NULL) {
|
if (Token.Event != NULL) {
|
||||||
gBS->CloseEvent (Token.Event);
|
gBS->CloseEvent (Token.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token.RspData.H2AData != NULL) {
|
if (Token.RspData.H2AData != NULL) {
|
||||||
if (Token.RspData.H2AData->IpList != NULL) {
|
if (Token.RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Token.RspData.H2AData->IpList);
|
FreePool (Token.RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Token.RspData.H2AData);
|
FreePool (Token.RspData.H2AData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp6DriverBinding = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a HTTP driver service binding private instance.
|
Create a HTTP driver service binding private instance.
|
||||||
|
|
||||||
@ -86,10 +85,10 @@ HttpCleanService (
|
|||||||
IN BOOLEAN UsingIpv6
|
IN BOOLEAN UsingIpv6
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (HttpService == NULL) {
|
if (HttpService == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UsingIpv6) {
|
if (!UsingIpv6) {
|
||||||
if (HttpService->Tcp4ChildHandle != NULL) {
|
if (HttpService->Tcp4ChildHandle != NULL) {
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
@ -127,7 +126,6 @@ HttpCleanService (
|
|||||||
HttpService->Tcp6ChildHandle = NULL;
|
HttpService->Tcp6ChildHandle = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,7 +152,7 @@ HttpUtilitiesInstalledCallback (
|
|||||||
//
|
//
|
||||||
// Close the event if Http utilities protocol is located.
|
// Close the event if Http utilities protocol is located.
|
||||||
//
|
//
|
||||||
if (mHttpUtilities != NULL && Event != NULL) {
|
if ((mHttpUtilities != NULL) && (Event != NULL)) {
|
||||||
gBS->CloseEvent (Event);
|
gBS->CloseEvent (Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,6 +228,7 @@ HttpDxeDriverEntryPoint (
|
|||||||
&gHttpDxeComponentName2
|
&gHttpDxeComponentName2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +255,7 @@ HttpDestroyChildEntryInHandleBuffer (
|
|||||||
UINTN NumberOfChildren;
|
UINTN NumberOfChildren;
|
||||||
EFI_HANDLE *ChildHandleBuffer;
|
EFI_HANDLE *ChildHandleBuffer;
|
||||||
|
|
||||||
if (Entry == NULL || Context == NULL) {
|
if ((Entry == NULL) || (Context == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,11 +419,9 @@ HttpDxeStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UsingIpv6 = TRUE;
|
UsingIpv6 = TRUE;
|
||||||
HttpService->Ip6DriverBindingHandle = This->DriverBindingHandle;
|
HttpService->Ip6DriverBindingHandle = This->DriverBindingHandle;
|
||||||
@ -456,11 +453,9 @@ HttpDxeStart (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -469,14 +464,12 @@ ON_ERROR:
|
|||||||
|
|
||||||
if (HttpService != NULL) {
|
if (HttpService != NULL) {
|
||||||
HttpCleanService (HttpService, UsingIpv6);
|
HttpCleanService (HttpService, UsingIpv6);
|
||||||
if (HttpService->Tcp4ChildHandle == NULL && HttpService->Tcp6ChildHandle == NULL) {
|
if ((HttpService->Tcp4ChildHandle == NULL) && (HttpService->Tcp6ChildHandle == NULL)) {
|
||||||
FreePool (HttpService);
|
FreePool (HttpService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -540,7 +533,6 @@ HttpDxeStop (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
HttpService = HTTP_SERVICE_FROM_PROTOCOL (ServiceBinding);
|
HttpService = HTTP_SERVICE_FROM_PROTOCOL (ServiceBinding);
|
||||||
|
|
||||||
if (NumberOfChildren != 0) {
|
if (NumberOfChildren != 0) {
|
||||||
@ -558,10 +550,9 @@ HttpDxeStop (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
HttpCleanService (HttpService, UsingIpv6);
|
HttpCleanService (HttpService, UsingIpv6);
|
||||||
|
|
||||||
if (HttpService->Tcp4ChildHandle == NULL && HttpService->Tcp6ChildHandle == NULL) {
|
if ((HttpService->Tcp4ChildHandle == NULL) && (HttpService->Tcp6ChildHandle == NULL)) {
|
||||||
gBS->UninstallProtocolInterface (
|
gBS->UninstallProtocolInterface (
|
||||||
NicHandle,
|
NicHandle,
|
||||||
&gEfiHttpServiceBindingProtocolGuid,
|
&gEfiHttpServiceBindingProtocolGuid,
|
||||||
@ -569,12 +560,12 @@ HttpDxeStop (
|
|||||||
);
|
);
|
||||||
FreePool (HttpService);
|
FreePool (HttpService);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -787,7 +778,6 @@ HttpDxeIp6DriverBindingSupported (
|
|||||||
RemainingDevicePath,
|
RemainingDevicePath,
|
||||||
IP_VERSION_6
|
IP_VERSION_6
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -885,6 +875,7 @@ HttpDxeIp6DriverBindingStop (
|
|||||||
IP_VERSION_6
|
IP_VERSION_6
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a child handle and installs a protocol.
|
Creates a child handle and installs a protocol.
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ EfiHttpGetModeData (
|
|||||||
HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
|
HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
|
||||||
|
|
||||||
if ((HttpConfigData->AccessPoint.IPv6Node == NULL) ||
|
if ((HttpConfigData->AccessPoint.IPv6Node == NULL) ||
|
||||||
(HttpConfigData->AccessPoint.IPv4Node == NULL)) {
|
(HttpConfigData->AccessPoint.IPv4Node == NULL))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,10 +135,11 @@ EfiHttpConfigure (
|
|||||||
//
|
//
|
||||||
// Check input parameters.
|
// Check input parameters.
|
||||||
//
|
//
|
||||||
if (This == NULL ||
|
if ((This == NULL) ||
|
||||||
(HttpConfigData != NULL &&
|
((HttpConfigData != NULL) &&
|
||||||
((HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv6Node == NULL) ||
|
((HttpConfigData->LocalAddressIsIPv6 && (HttpConfigData->AccessPoint.IPv6Node == NULL)) ||
|
||||||
(!HttpConfigData->LocalAddressIsIPv6 && HttpConfigData->AccessPoint.IPv4Node == NULL)))) {
|
(!HttpConfigData->LocalAddressIsIPv6 && (HttpConfigData->AccessPoint.IPv4Node == NULL)))))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +147,6 @@ EfiHttpConfigure (
|
|||||||
ASSERT (HttpInstance->Service != NULL);
|
ASSERT (HttpInstance->Service != NULL);
|
||||||
|
|
||||||
if (HttpConfigData != NULL) {
|
if (HttpConfigData != NULL) {
|
||||||
|
|
||||||
if (HttpConfigData->HttpVersion >= HttpVersionUnsupported) {
|
if (HttpConfigData->HttpVersion >= HttpVersionUnsupported) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
@ -185,7 +186,6 @@ EfiHttpConfigure (
|
|||||||
|
|
||||||
HttpInstance->State = HTTP_STATE_HTTP_CONFIGED;
|
HttpInstance->State = HTTP_STATE_HTTP_CONFIGED;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Reset all the resources related to HttpInstance.
|
// Reset all the resources related to HttpInstance.
|
||||||
@ -196,7 +196,6 @@ EfiHttpConfigure (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The Request() function queues an HTTP request to this HTTP instance.
|
The Request() function queues an HTTP request to this HTTP instance.
|
||||||
|
|
||||||
@ -280,7 +279,8 @@ EfiHttpRequest (
|
|||||||
if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
|
if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
|
||||||
(Request->Method != HttpMethodHead) && (Request->Method != HttpMethodDelete) &&
|
(Request->Method != HttpMethodHead) && (Request->Method != HttpMethodDelete) &&
|
||||||
(Request->Method != HttpMethodPut) && (Request->Method != HttpMethodPost) &&
|
(Request->Method != HttpMethodPut) && (Request->Method != HttpMethodPost) &&
|
||||||
(Request->Method != HttpMethodPatch)) {
|
(Request->Method != HttpMethodPatch))
|
||||||
|
{
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,8 @@ EfiHttpRequest (
|
|||||||
//
|
//
|
||||||
if ((HttpInstance->Method != HttpMethodPut) &&
|
if ((HttpInstance->Method != HttpMethodPut) &&
|
||||||
(HttpInstance->Method != HttpMethodPost) &&
|
(HttpInstance->Method != HttpMethodPost) &&
|
||||||
(HttpInstance->Method != HttpMethodPatch)) {
|
(HttpInstance->Method != HttpMethodPatch))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +318,7 @@ EfiHttpRequest (
|
|||||||
//
|
//
|
||||||
// We need to have the Message Body for sending the HTTP message across in these cases.
|
// We need to have the Message Body for sending the HTTP message across in these cases.
|
||||||
//
|
//
|
||||||
if (HttpMsg->Body == NULL || HttpMsg->BodyLength == 0) {
|
if ((HttpMsg->Body == NULL) || (HttpMsg->BodyLength == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,11 +345,11 @@ EfiHttpRequest (
|
|||||||
if (Url == NULL) {
|
if (Url == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (HttpInstance->Url);
|
FreePool (HttpInstance->Url);
|
||||||
HttpInstance->Url = Url;
|
HttpInstance->Url = Url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
|
UnicodeStrToAsciiStrS (Request->Url, Url, UrlLen);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -361,7 +362,6 @@ EfiHttpRequest (
|
|||||||
// HTTP is disabled, return directly if the URI is not HTTPS.
|
// HTTP is disabled, return directly if the URI is not HTTPS.
|
||||||
//
|
//
|
||||||
if (!PcdGetBool (PcdAllowHttpConnections) && !(HttpInstance->UseHttps)) {
|
if (!PcdGetBool (PcdAllowHttpConnections) && !(HttpInstance->UseHttps)) {
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "EfiHttpRequest: HTTP is disabled.\n"));
|
DEBUG ((DEBUG_ERROR, "EfiHttpRequest: HTTP is disabled.\n"));
|
||||||
|
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
@ -370,7 +370,7 @@ EfiHttpRequest (
|
|||||||
//
|
//
|
||||||
// Check whether we need to create Tls child and open the TLS protocol.
|
// Check whether we need to create Tls child and open the TLS protocol.
|
||||||
//
|
//
|
||||||
if (HttpInstance->UseHttps && HttpInstance->TlsChildHandle == NULL) {
|
if (HttpInstance->UseHttps && (HttpInstance->TlsChildHandle == NULL)) {
|
||||||
//
|
//
|
||||||
// Use TlsSb to create Tls child and open the TLS protocol.
|
// Use TlsSb to create Tls child and open the TLS protocol.
|
||||||
//
|
//
|
||||||
@ -407,7 +407,7 @@ EfiHttpRequest (
|
|||||||
if (HttpInstance->LocalAddressIsIPv6) {
|
if (HttpInstance->LocalAddressIsIPv6) {
|
||||||
HostNameSize = AsciiStrSize (HostName);
|
HostNameSize = AsciiStrSize (HostName);
|
||||||
|
|
||||||
if (HostNameSize > 2 && HostName[0] == '[' && HostName[HostNameSize - 2] == ']') {
|
if ((HostNameSize > 2) && (HostName[0] == '[') && (HostName[HostNameSize - 2] == ']')) {
|
||||||
//
|
//
|
||||||
// HostName format is expressed as IPv6, so, remove '[' and ']'.
|
// HostName format is expressed as IPv6, so, remove '[' and ']'.
|
||||||
//
|
//
|
||||||
@ -425,6 +425,7 @@ EfiHttpRequest (
|
|||||||
RemotePort = HTTP_DEFAULT_PORT;
|
RemotePort = HTTP_DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If Configure is TRUE, it indicates the first time to call Request();
|
// If Configure is TRUE, it indicates the first time to call Request();
|
||||||
// If ReConfigure is TRUE, it indicates the request URL is not same
|
// If ReConfigure is TRUE, it indicates the request URL is not same
|
||||||
@ -443,7 +444,8 @@ EfiHttpRequest (
|
|||||||
(AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) &&
|
(AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) &&
|
||||||
(!HttpInstance->UseHttps || (HttpInstance->UseHttps &&
|
(!HttpInstance->UseHttps || (HttpInstance->UseHttps &&
|
||||||
!TlsConfigure &&
|
!TlsConfigure &&
|
||||||
HttpInstance->TlsSessionState == EfiTlsSessionDataTransferring))) {
|
(HttpInstance->TlsSessionState == EfiTlsSessionDataTransferring))))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Host Name and port number of the request URL are the same with previous call to Request().
|
// Host Name and port number of the request URL are the same with previous call to Request().
|
||||||
// If Https protocol used, the corresponding SessionState is EfiTlsSessionDataTransferring.
|
// If Https protocol used, the corresponding SessionState is EfiTlsSessionDataTransferring.
|
||||||
@ -527,6 +529,7 @@ EfiHttpRequest (
|
|||||||
} else {
|
} else {
|
||||||
Status = HttpDns6 (HttpInstance, HostNameStr, &HttpInstance->RemoteIpv6Addr);
|
Status = HttpDns6 (HttpInstance, HostNameStr, &HttpInstance->RemoteIpv6Addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpNotify (HttpEventDns, Status);
|
HttpNotify (HttpEventDns, Status);
|
||||||
|
|
||||||
FreePool (HostNameStr);
|
FreePool (HostNameStr);
|
||||||
@ -608,13 +611,14 @@ EfiHttpRequest (
|
|||||||
// Create request message.
|
// Create request message.
|
||||||
//
|
//
|
||||||
FileUrl = Url;
|
FileUrl = Url;
|
||||||
if (Url != NULL && *FileUrl != '/') {
|
if ((Url != NULL) && (*FileUrl != '/')) {
|
||||||
//
|
//
|
||||||
// Convert the absolute-URI to the absolute-path
|
// Convert the absolute-URI to the absolute-path
|
||||||
//
|
//
|
||||||
while (*FileUrl != ':') {
|
while (*FileUrl != ':') {
|
||||||
FileUrl++;
|
FileUrl++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
|
if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
|
||||||
FileUrl += 3;
|
FileUrl += 3;
|
||||||
while (*FileUrl != '/') {
|
while (*FileUrl != '/') {
|
||||||
@ -628,7 +632,7 @@ EfiHttpRequest (
|
|||||||
|
|
||||||
Status = HttpGenRequestMessage (HttpMsg, FileUrl, &RequestMsg, &RequestMsgSize);
|
Status = HttpGenRequestMessage (HttpMsg, FileUrl, &RequestMsg, &RequestMsgSize);
|
||||||
|
|
||||||
if (EFI_ERROR (Status) || NULL == RequestMsg) {
|
if (EFI_ERROR (Status) || (NULL == RequestMsg)) {
|
||||||
goto Error3;
|
goto Error3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,6 +702,7 @@ Error2:
|
|||||||
gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
|
gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
|
||||||
Wrap->TcpWrap.Tx4Token.CompletionToken.Event = NULL;
|
Wrap->TcpWrap.Tx4Token.CompletionToken.Event = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != Wrap->TcpWrap.Tx6Token.CompletionToken.Event) {
|
if (NULL != Wrap->TcpWrap.Tx6Token.CompletionToken.Event) {
|
||||||
gBS->CloseEvent (Wrap->TcpWrap.Tx6Token.CompletionToken.Event);
|
gBS->CloseEvent (Wrap->TcpWrap.Tx6Token.CompletionToken.Event);
|
||||||
Wrap->TcpWrap.Tx6Token.CompletionToken.Event = NULL;
|
Wrap->TcpWrap.Tx6Token.CompletionToken.Event = NULL;
|
||||||
@ -707,15 +712,16 @@ Error1:
|
|||||||
if (HostName != NULL) {
|
if (HostName != NULL) {
|
||||||
FreePool (HostName);
|
FreePool (HostName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Wrap != NULL) {
|
if (Wrap != NULL) {
|
||||||
FreePool (Wrap);
|
FreePool (Wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UrlParser != NULL) {
|
if (UrlParser != NULL) {
|
||||||
HttpUrlFreeParser (UrlParser);
|
HttpUrlFreeParser (UrlParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -855,7 +861,6 @@ HttpCancel (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Abort an asynchronous HTTP request or response token.
|
Abort an asynchronous HTTP request or response token.
|
||||||
|
|
||||||
@ -898,7 +903,6 @@ EfiHttpCancel (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return HttpCancel (HttpInstance, Token);
|
return HttpCancel (HttpInstance, Token);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -933,7 +937,7 @@ HttpBodyParserCallback (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Data == NULL || Length != 0 || Context == NULL) {
|
if ((Data == NULL) || (Length != 0) || (Context == NULL)) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,7 +991,7 @@ HttpResponseWorker (
|
|||||||
NET_FRAGMENT Fragment;
|
NET_FRAGMENT Fragment;
|
||||||
UINT32 TimeoutValue;
|
UINT32 TimeoutValue;
|
||||||
|
|
||||||
if (Wrap == NULL || Wrap->HttpInstance == NULL) {
|
if ((Wrap == NULL) || (Wrap->HttpInstance == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1038,7 +1042,6 @@ HttpResponseWorker (
|
|||||||
HttpInstance->EndofHeader = &EndofHeader;
|
HttpInstance->EndofHeader = &EndofHeader;
|
||||||
HttpInstance->HttpHeaders = &HttpHeaders;
|
HttpInstance->HttpHeaders = &HttpHeaders;
|
||||||
|
|
||||||
|
|
||||||
if (HttpInstance->TimeoutEvent == NULL) {
|
if (HttpInstance->TimeoutEvent == NULL) {
|
||||||
//
|
//
|
||||||
// Create TimeoutEvent for response
|
// Create TimeoutEvent for response
|
||||||
@ -1193,7 +1196,6 @@ HttpResponseWorker (
|
|||||||
FreePool (HttpHeaders);
|
FreePool (HttpHeaders);
|
||||||
HttpHeaders = NULL;
|
HttpHeaders = NULL;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init message-body parser by header information.
|
// Init message-body parser by header information.
|
||||||
//
|
//
|
||||||
@ -1291,6 +1293,7 @@ HttpResponseWorker (
|
|||||||
HttpInstance->CacheOffset = 0;
|
HttpInstance->CacheOffset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return since we already received required data.
|
// Return since we already received required data.
|
||||||
//
|
//
|
||||||
@ -1298,7 +1301,7 @@ HttpResponseWorker (
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BodyLen == 0 && HttpInstance->MsgParser == NULL) {
|
if ((BodyLen == 0) && (HttpInstance->MsgParser == NULL)) {
|
||||||
//
|
//
|
||||||
// We received a complete HTTP message, and we don't have more data to return to caller.
|
// We received a complete HTTP message, and we don't have more data to return to caller.
|
||||||
//
|
//
|
||||||
@ -1319,7 +1322,6 @@ HttpResponseWorker (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error2;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (HttpInstance->TimeoutEvent == NULL) {
|
if (HttpInstance->TimeoutEvent == NULL) {
|
||||||
//
|
//
|
||||||
@ -1491,10 +1493,8 @@ Error:
|
|||||||
gBS->SignalEvent (Token->Event);
|
gBS->SignalEvent (Token->Event);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The Response() function queues an HTTP response to this HTTP instance, similar to
|
The Response() function queues an HTTP response to this HTTP instance, similar to
|
||||||
Receive() function in the EFI TCP driver. When the HTTP response is received successfully,
|
Receive() function in the EFI TCP driver. When the HTTP response is received successfully,
|
||||||
@ -1619,6 +1619,7 @@ Error:
|
|||||||
if (Wrap->TcpWrap.Rx6Token.CompletionToken.Event != NULL) {
|
if (Wrap->TcpWrap.Rx6Token.CompletionToken.Event != NULL) {
|
||||||
gBS->CloseEvent (Wrap->TcpWrap.Rx6Token.CompletionToken.Event);
|
gBS->CloseEvent (Wrap->TcpWrap.Rx6Token.CompletionToken.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Wrap);
|
FreePool (Wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1668,11 +1669,13 @@ EfiHttpPoll (
|
|||||||
if (HttpInstance->Tcp6 == NULL) {
|
if (HttpInstance->Tcp6 == NULL) {
|
||||||
return EFI_NOT_STARTED;
|
return EFI_NOT_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HttpInstance->Tcp6->Poll (HttpInstance->Tcp6);
|
Status = HttpInstance->Tcp6->Poll (HttpInstance->Tcp6);
|
||||||
} else {
|
} else {
|
||||||
if (HttpInstance->Tcp4 == NULL) {
|
if (HttpInstance->Tcp4 == NULL) {
|
||||||
return EFI_NOT_STARTED;
|
return EFI_NOT_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
|
Status = HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#define HTTP_VERSION_CRLF_STR " HTTP/1.1\r\n"
|
#define HTTP_VERSION_CRLF_STR " HTTP/1.1\r\n"
|
||||||
#define HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE 300
|
#define HTTP_ERROR_OR_NOT_SUPPORT_STATUS_CODE 300
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the operational parameters for the current HTTP child instance.
|
Returns the operational parameters for the current HTTP child instance.
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ HttpTcpTransmitNotifyDpc (
|
|||||||
if (Wrap->TcpWrap.Tx4Token.CompletionToken.Event != NULL) {
|
if (Wrap->TcpWrap.Tx4Token.CompletionToken.Event != NULL) {
|
||||||
gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
|
gBS->CloseEvent (Wrap->TcpWrap.Tx4Token.CompletionToken.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Wrap->HttpToken->Status = Wrap->TcpWrap.Tx6Token.CompletionToken.Status;
|
Wrap->HttpToken->Status = Wrap->TcpWrap.Tx6Token.CompletionToken.Status;
|
||||||
gBS->SignalEvent (Wrap->HttpToken->Event);
|
gBS->SignalEvent (Wrap->HttpToken->Event);
|
||||||
@ -83,14 +82,12 @@ HttpTcpTransmitNotifyDpc (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Wrap->TcpWrap.IsTxDone = TRUE;
|
Wrap->TcpWrap.IsTxDone = TRUE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check pending TxTokens and sent out.
|
// Check pending TxTokens and sent out.
|
||||||
//
|
//
|
||||||
NetMapIterate (&Wrap->HttpInstance->TxTokens, HttpTcpTransmit, NULL);
|
NetMapIterate (&Wrap->HttpInstance->TxTokens, HttpTcpTransmit, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +156,6 @@ HttpTcpReceiveNotifyDpc (
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gBS->CloseEvent (Wrap->TcpWrap.Rx4Token.CompletionToken.Event);
|
gBS->CloseEvent (Wrap->TcpWrap.Rx4Token.CompletionToken.Event);
|
||||||
Wrap->TcpWrap.Rx4Token.CompletionToken.Event = NULL;
|
Wrap->TcpWrap.Rx4Token.CompletionToken.Event = NULL;
|
||||||
@ -232,6 +228,7 @@ HttpTcpReceiveNotifyDpc (
|
|||||||
if (HttpInstance->CacheBody == NULL) {
|
if (HttpInstance->CacheBody == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (HttpInstance->CacheBody, HttpInstance->NextMsg, HttpInstance->CacheLen);
|
CopyMem (HttpInstance->CacheBody, HttpInstance->NextMsg, HttpInstance->CacheLen);
|
||||||
HttpInstance->NextMsg = HttpInstance->CacheBody;
|
HttpInstance->NextMsg = HttpInstance->CacheBody;
|
||||||
HttpInstance->CacheOffset = 0;
|
HttpInstance->CacheOffset = 0;
|
||||||
@ -243,7 +240,6 @@ HttpTcpReceiveNotifyDpc (
|
|||||||
NetMapRemoveItem (&Wrap->HttpInstance->RxTokens, Item, NULL);
|
NetMapRemoveItem (&Wrap->HttpInstance->RxTokens, Item, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Wrap->TcpWrap.IsRxDone = TRUE;
|
Wrap->TcpWrap.IsRxDone = TRUE;
|
||||||
if (UsingIpv6) {
|
if (UsingIpv6) {
|
||||||
Wrap->HttpToken->Status = Wrap->TcpWrap.Rx6Token.CompletionToken.Status;
|
Wrap->HttpToken->Status = Wrap->TcpWrap.Rx6Token.CompletionToken.Status;
|
||||||
@ -251,7 +247,6 @@ HttpTcpReceiveNotifyDpc (
|
|||||||
Wrap->HttpToken->Status = Wrap->TcpWrap.Rx4Token.CompletionToken.Status;
|
Wrap->HttpToken->Status = Wrap->TcpWrap.Rx4Token.CompletionToken.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gBS->SignalEvent (Wrap->HttpToken->Event);
|
gBS->SignalEvent (Wrap->HttpToken->Event);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -327,7 +322,6 @@ HttpCreateTcpConnCloseEvent (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Create events for various asynchronous operations.
|
// Create events for various asynchronous operations.
|
||||||
@ -369,7 +363,6 @@ ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Close events in the TCP connection token and TCP close token.
|
Close events in the TCP connection token and TCP close token.
|
||||||
|
|
||||||
@ -393,7 +386,6 @@ HttpCloseTcpConnCloseEvent (
|
|||||||
gBS->CloseEvent (HttpInstance->Tcp6CloseToken.CompletionToken.Event);
|
gBS->CloseEvent (HttpInstance->Tcp6CloseToken.CompletionToken.Event);
|
||||||
HttpInstance->Tcp6CloseToken.CompletionToken.Event = NULL;
|
HttpInstance->Tcp6CloseToken.CompletionToken.Event = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (NULL != HttpInstance->Tcp4ConnToken.CompletionToken.Event) {
|
if (NULL != HttpInstance->Tcp4ConnToken.CompletionToken.Event) {
|
||||||
gBS->CloseEvent (HttpInstance->Tcp4ConnToken.CompletionToken.Event);
|
gBS->CloseEvent (HttpInstance->Tcp4ConnToken.CompletionToken.Event);
|
||||||
@ -405,7 +397,6 @@ HttpCloseTcpConnCloseEvent (
|
|||||||
HttpInstance->Tcp4CloseToken.CompletionToken.Event = NULL;
|
HttpInstance->Tcp4CloseToken.CompletionToken.Event = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -446,7 +437,6 @@ HttpCreateTcpTxEvent (
|
|||||||
TcpWrap->Tx4Data.FragmentCount = 1;
|
TcpWrap->Tx4Data.FragmentCount = 1;
|
||||||
TcpWrap->Tx4Token.Packet.TxData = &Wrap->TcpWrap.Tx4Data;
|
TcpWrap->Tx4Token.Packet.TxData = &Wrap->TcpWrap.Tx4Data;
|
||||||
TcpWrap->Tx4Token.CompletionToken.Status = EFI_NOT_READY;
|
TcpWrap->Tx4Token.CompletionToken.Status = EFI_NOT_READY;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
@ -464,7 +454,6 @@ HttpCreateTcpTxEvent (
|
|||||||
TcpWrap->Tx6Data.FragmentCount = 1;
|
TcpWrap->Tx6Data.FragmentCount = 1;
|
||||||
TcpWrap->Tx6Token.Packet.TxData = &Wrap->TcpWrap.Tx6Data;
|
TcpWrap->Tx6Token.Packet.TxData = &Wrap->TcpWrap.Tx6Data;
|
||||||
TcpWrap->Tx6Token.CompletionToken.Status = EFI_NOT_READY;
|
TcpWrap->Tx6Token.CompletionToken.Status = EFI_NOT_READY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -501,7 +490,6 @@ HttpCreateTcpRxEventForHeader (
|
|||||||
HttpInstance->Rx4Data.FragmentCount = 1;
|
HttpInstance->Rx4Data.FragmentCount = 1;
|
||||||
HttpInstance->Rx4Token.Packet.RxData = &HttpInstance->Rx4Data;
|
HttpInstance->Rx4Token.Packet.RxData = &HttpInstance->Rx4Data;
|
||||||
HttpInstance->Rx4Token.CompletionToken.Status = EFI_NOT_READY;
|
HttpInstance->Rx4Token.CompletionToken.Status = EFI_NOT_READY;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
@ -517,10 +505,8 @@ HttpCreateTcpRxEventForHeader (
|
|||||||
HttpInstance->Rx6Data.FragmentCount = 1;
|
HttpInstance->Rx6Data.FragmentCount = 1;
|
||||||
HttpInstance->Rx6Token.Packet.RxData = &HttpInstance->Rx6Data;
|
HttpInstance->Rx6Token.Packet.RxData = &HttpInstance->Rx6Data;
|
||||||
HttpInstance->Rx6Token.CompletionToken.Status = EFI_NOT_READY;
|
HttpInstance->Rx6Token.CompletionToken.Status = EFI_NOT_READY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +545,6 @@ HttpCreateTcpRxEvent (
|
|||||||
TcpWrap->Rx4Data.FragmentCount = 1;
|
TcpWrap->Rx4Data.FragmentCount = 1;
|
||||||
TcpWrap->Rx4Token.Packet.RxData = &Wrap->TcpWrap.Rx4Data;
|
TcpWrap->Rx4Token.Packet.RxData = &Wrap->TcpWrap.Rx4Data;
|
||||||
TcpWrap->Rx4Token.CompletionToken.Status = EFI_NOT_READY;
|
TcpWrap->Rx4Token.CompletionToken.Status = EFI_NOT_READY;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
@ -821,7 +806,6 @@ ON_ERROR:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -868,7 +852,7 @@ HttpCleanProtocol (
|
|||||||
NetMapClean (&HttpInstance->TxTokens);
|
NetMapClean (&HttpInstance->TxTokens);
|
||||||
NetMapClean (&HttpInstance->RxTokens);
|
NetMapClean (&HttpInstance->RxTokens);
|
||||||
|
|
||||||
if (HttpInstance->TlsSb != NULL && HttpInstance->TlsChildHandle != NULL) {
|
if ((HttpInstance->TlsSb != NULL) && (HttpInstance->TlsChildHandle != NULL)) {
|
||||||
//
|
//
|
||||||
// Destroy the TLS instance.
|
// Destroy the TLS instance.
|
||||||
//
|
//
|
||||||
@ -977,7 +961,6 @@ HttpCreateConnection (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status = HttpInstance->Tcp4ConnToken.CompletionToken.Status;
|
Status = HttpInstance->Tcp4ConnToken.CompletionToken.Status;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
HttpInstance->IsTcp6ConnDone = FALSE;
|
HttpInstance->IsTcp6ConnDone = FALSE;
|
||||||
HttpInstance->Tcp6ConnToken.CompletionToken.Status = EFI_NOT_READY;
|
HttpInstance->Tcp6ConnToken.CompletionToken.Status = EFI_NOT_READY;
|
||||||
@ -1019,7 +1002,6 @@ HttpCloseConnection (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (HttpInstance->State == HTTP_STATE_TCP_CONNECTED) {
|
if (HttpInstance->State == HTTP_STATE_TCP_CONNECTED) {
|
||||||
|
|
||||||
if (HttpInstance->LocalAddressIsIPv6) {
|
if (HttpInstance->LocalAddressIsIPv6) {
|
||||||
HttpInstance->Tcp6CloseToken.AbortOnClose = TRUE;
|
HttpInstance->Tcp6CloseToken.AbortOnClose = TRUE;
|
||||||
HttpInstance->IsTcp6CloseDone = FALSE;
|
HttpInstance->IsTcp6CloseDone = FALSE;
|
||||||
@ -1031,7 +1013,6 @@ HttpCloseConnection (
|
|||||||
while (!HttpInstance->IsTcp6CloseDone) {
|
while (!HttpInstance->IsTcp6CloseDone) {
|
||||||
HttpInstance->Tcp6->Poll (HttpInstance->Tcp6);
|
HttpInstance->Tcp6->Poll (HttpInstance->Tcp6);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
HttpInstance->Tcp4CloseToken.AbortOnClose = TRUE;
|
HttpInstance->Tcp4CloseToken.AbortOnClose = TRUE;
|
||||||
HttpInstance->IsTcp4CloseDone = FALSE;
|
HttpInstance->IsTcp4CloseDone = FALSE;
|
||||||
@ -1044,7 +1025,6 @@ HttpCloseConnection (
|
|||||||
HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
|
HttpInstance->Tcp4->Poll (HttpInstance->Tcp4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpInstance->State = HTTP_STATE_TCP_CLOSED;
|
HttpInstance->State = HTTP_STATE_TCP_CLOSED;
|
||||||
@ -1074,7 +1054,6 @@ HttpConfigureTcp4 (
|
|||||||
|
|
||||||
ASSERT (HttpInstance != NULL);
|
ASSERT (HttpInstance != NULL);
|
||||||
|
|
||||||
|
|
||||||
Tcp4CfgData = &HttpInstance->Tcp4CfgData;
|
Tcp4CfgData = &HttpInstance->Tcp4CfgData;
|
||||||
ZeroMem (Tcp4CfgData, sizeof (EFI_TCP4_CONFIG_DATA));
|
ZeroMem (Tcp4CfgData, sizeof (EFI_TCP4_CONFIG_DATA));
|
||||||
|
|
||||||
@ -1196,7 +1175,6 @@ HttpConfigureTcp6 (
|
|||||||
HttpInstance->State = HTTP_STATE_TCP_CONFIGED;
|
HttpInstance->State = HTTP_STATE_TCP_CONFIGED;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1218,8 +1196,7 @@ HttpConnectTcp4 (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_TCP4_CONNECTION_STATE Tcp4State;
|
EFI_TCP4_CONNECTION_STATE Tcp4State;
|
||||||
|
|
||||||
|
if ((HttpInstance->State < HTTP_STATE_TCP_CONFIGED) || (HttpInstance->Tcp4 == NULL)) {
|
||||||
if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp4 == NULL) {
|
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1311,7 +1288,7 @@ HttpConnectTcp6 (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_TCP6_CONNECTION_STATE Tcp6State;
|
EFI_TCP6_CONNECTION_STATE Tcp6State;
|
||||||
|
|
||||||
if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp6 == NULL) {
|
if ((HttpInstance->State < HTTP_STATE_TCP_CONFIGED) || (HttpInstance->Tcp6 == NULL)) {
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1406,6 +1383,7 @@ HttpInitSession (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
ASSERT (HttpInstance != NULL);
|
ASSERT (HttpInstance != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1457,7 +1435,6 @@ HttpInitSession (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1590,7 +1567,6 @@ HttpTransmitTcp (
|
|||||||
DEBUG ((DEBUG_ERROR, "Transmit failed: %r\n", Status));
|
DEBUG ((DEBUG_ERROR, "Transmit failed: %r\n", Status));
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Tcp6 = HttpInstance->Tcp6;
|
Tcp6 = HttpInstance->Tcp6;
|
||||||
Tx6Token = &Wrap->TcpWrap.Tx6Token;
|
Tx6Token = &Wrap->TcpWrap.Tx6Token;
|
||||||
@ -1662,7 +1638,7 @@ HttpTokenExist (
|
|||||||
Token = (EFI_HTTP_TOKEN *)Context;
|
Token = (EFI_HTTP_TOKEN *)Context;
|
||||||
TokenInItem = (EFI_HTTP_TOKEN *)Item->Key;
|
TokenInItem = (EFI_HTTP_TOKEN *)Item->Key;
|
||||||
|
|
||||||
if (Token == TokenInItem || Token->Event == TokenInItem->Event) {
|
if ((Token == TokenInItem) || (Token->Event == TokenInItem->Event)) {
|
||||||
return EFI_ACCESS_DENIED;
|
return EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1755,7 +1731,7 @@ HttpTcpTransmit (
|
|||||||
);
|
);
|
||||||
FreePool (Url);
|
FreePool (Url);
|
||||||
|
|
||||||
if (EFI_ERROR (Status) || NULL == RequestMsg){
|
if (EFI_ERROR (Status) || (NULL == RequestMsg)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1940,12 +1916,12 @@ HttpTcpReceiveHeader (
|
|||||||
// Check whether we received end of HTTP headers.
|
// Check whether we received end of HTTP headers.
|
||||||
//
|
//
|
||||||
*EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
|
*EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
|
||||||
};
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free the buffer.
|
// Free the buffer.
|
||||||
//
|
//
|
||||||
if (Rx4Token != NULL && Rx4Token->Packet.RxData != NULL && Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
|
if ((Rx4Token != NULL) && (Rx4Token->Packet.RxData != NULL) && (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL)) {
|
||||||
FreePool (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
FreePool (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
||||||
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
||||||
Fragment.Bulk = NULL;
|
Fragment.Bulk = NULL;
|
||||||
@ -2040,12 +2016,12 @@ HttpTcpReceiveHeader (
|
|||||||
// Check whether we received end of HTTP headers.
|
// Check whether we received end of HTTP headers.
|
||||||
//
|
//
|
||||||
*EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
|
*EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
|
||||||
};
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free the buffer.
|
// Free the buffer.
|
||||||
//
|
//
|
||||||
if (Rx6Token != NULL && Rx6Token->Packet.RxData != NULL && Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
|
if ((Rx6Token != NULL) && (Rx6Token->Packet.RxData != NULL) && (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL)) {
|
||||||
FreePool (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
FreePool (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
||||||
Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
||||||
Fragment.Bulk = NULL;
|
Fragment.Bulk = NULL;
|
||||||
@ -2129,7 +2105,6 @@ HttpTcpReceiveBody (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2173,7 +2148,6 @@ HttpTcpTokenCleanup (
|
|||||||
FreePool (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
FreePool (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
||||||
Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Rx4Token = &Wrap->TcpWrap.Rx4Token;
|
Rx4Token = &Wrap->TcpWrap.Rx4Token;
|
||||||
|
|
||||||
@ -2191,13 +2165,11 @@ HttpTcpTokenCleanup (
|
|||||||
Rx4Token->CompletionToken.Event = NULL;
|
Rx4Token->CompletionToken.Event = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
|
if (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
|
||||||
FreePool (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
FreePool (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
|
||||||
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2248,6 +2220,7 @@ HttpNotify (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Handles);
|
FreePool (Handles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
HTTP_SERVICE_SIGNATURE \
|
HTTP_SERVICE_SIGNATURE \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The state of HTTP protocol. It starts from UNCONFIGED.
|
// The state of HTTP protocol. It starts from UNCONFIGED.
|
||||||
//
|
//
|
||||||
@ -203,7 +202,6 @@ typedef struct {
|
|||||||
HTTP_TCP_TOKEN_WRAP TcpWrap;
|
HTTP_TCP_TOKEN_WRAP TcpWrap;
|
||||||
} HTTP_TOKEN_WRAP;
|
} HTTP_TOKEN_WRAP;
|
||||||
|
|
||||||
|
|
||||||
#define HTTP_PROTOCOL_SIGNATURE SIGNATURE_32('H', 't', 't', 'P')
|
#define HTTP_PROTOCOL_SIGNATURE SIGNATURE_32('H', 't', 't', 'P')
|
||||||
|
|
||||||
#define HTTP_INSTANCE_FROM_PROTOCOL(a) \
|
#define HTTP_INSTANCE_FROM_PROTOCOL(a) \
|
||||||
|
@ -56,7 +56,8 @@ AsciiStrCaseStr (
|
|||||||
FirstMatch = String;
|
FirstMatch = String;
|
||||||
|
|
||||||
while ( (*SearchStringTmp != '\0')
|
while ( (*SearchStringTmp != '\0')
|
||||||
&& (*String != '\0')) {
|
&& (*String != '\0'))
|
||||||
|
{
|
||||||
Src = *String;
|
Src = *String;
|
||||||
Dst = *SearchStringTmp;
|
Dst = *SearchStringTmp;
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ IsHttpsUrl (
|
|||||||
Tmp = NULL;
|
Tmp = NULL;
|
||||||
|
|
||||||
Tmp = AsciiStrCaseStr (Url, HTTPS_FLAG);
|
Tmp = AsciiStrCaseStr (Url, HTTPS_FLAG);
|
||||||
if (Tmp != NULL && Tmp == Url) {
|
if ((Tmp != NULL) && (Tmp == Url)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +397,7 @@ TlsConfigCertificate (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,57 +433,77 @@ TlsConfigCertificate (
|
|||||||
ItemDataSize = (UINT32)CACertSize;
|
ItemDataSize = (UINT32)CACertSize;
|
||||||
while (ItemDataSize > 0) {
|
while (ItemDataSize > 0) {
|
||||||
if (ItemDataSize < sizeof (EFI_SIGNATURE_LIST)) {
|
if (ItemDataSize < sizeof (EFI_SIGNATURE_LIST)) {
|
||||||
DEBUG ((DEBUG_ERROR, "%a: truncated EFI_SIGNATURE_LIST header\n",
|
DEBUG ((
|
||||||
__FUNCTION__));
|
DEBUG_ERROR,
|
||||||
|
"%a: truncated EFI_SIGNATURE_LIST header\n",
|
||||||
|
__FUNCTION__
|
||||||
|
));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
CertList = (EFI_SIGNATURE_LIST *)(CACert + (CACertSize - ItemDataSize));
|
CertList = (EFI_SIGNATURE_LIST *)(CACert + (CACertSize - ItemDataSize));
|
||||||
|
|
||||||
if (CertList->SignatureListSize < sizeof (EFI_SIGNATURE_LIST)) {
|
if (CertList->SignatureListSize < sizeof (EFI_SIGNATURE_LIST)) {
|
||||||
DEBUG ((DEBUG_ERROR,
|
DEBUG ((
|
||||||
|
DEBUG_ERROR,
|
||||||
"%a: SignatureListSize too small for EFI_SIGNATURE_LIST\n",
|
"%a: SignatureListSize too small for EFI_SIGNATURE_LIST\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__
|
||||||
|
));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CertList->SignatureListSize > ItemDataSize) {
|
if (CertList->SignatureListSize > ItemDataSize) {
|
||||||
DEBUG ((DEBUG_ERROR, "%a: truncated EFI_SIGNATURE_LIST body\n",
|
DEBUG ((
|
||||||
__FUNCTION__));
|
DEBUG_ERROR,
|
||||||
|
"%a: truncated EFI_SIGNATURE_LIST body\n",
|
||||||
|
__FUNCTION__
|
||||||
|
));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
|
if (!CompareGuid (&CertList->SignatureType, &gEfiCertX509Guid)) {
|
||||||
DEBUG ((DEBUG_ERROR, "%a: only X509 certificates are supported\n",
|
DEBUG ((
|
||||||
__FUNCTION__));
|
DEBUG_ERROR,
|
||||||
|
"%a: only X509 certificates are supported\n",
|
||||||
|
__FUNCTION__
|
||||||
|
));
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CertList->SignatureHeaderSize != 0) {
|
if (CertList->SignatureHeaderSize != 0) {
|
||||||
DEBUG ((DEBUG_ERROR, "%a: SignatureHeaderSize must be 0 for X509\n",
|
DEBUG ((
|
||||||
__FUNCTION__));
|
DEBUG_ERROR,
|
||||||
|
"%a: SignatureHeaderSize must be 0 for X509\n",
|
||||||
|
__FUNCTION__
|
||||||
|
));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CertList->SignatureSize < sizeof (EFI_SIGNATURE_DATA)) {
|
if (CertList->SignatureSize < sizeof (EFI_SIGNATURE_DATA)) {
|
||||||
DEBUG ((DEBUG_ERROR,
|
DEBUG ((
|
||||||
"%a: SignatureSize too small for EFI_SIGNATURE_DATA\n", __FUNCTION__));
|
DEBUG_ERROR,
|
||||||
|
"%a: SignatureSize too small for EFI_SIGNATURE_DATA\n",
|
||||||
|
__FUNCTION__
|
||||||
|
));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
CertArraySizeInBytes = (CertList->SignatureListSize -
|
CertArraySizeInBytes = (CertList->SignatureListSize -
|
||||||
sizeof (EFI_SIGNATURE_LIST));
|
sizeof (EFI_SIGNATURE_LIST));
|
||||||
if (CertArraySizeInBytes % CertList->SignatureSize != 0) {
|
if (CertArraySizeInBytes % CertList->SignatureSize != 0) {
|
||||||
DEBUG ((DEBUG_ERROR,
|
DEBUG ((
|
||||||
|
DEBUG_ERROR,
|
||||||
"%a: EFI_SIGNATURE_DATA array not a multiple of SignatureSize\n",
|
"%a: EFI_SIGNATURE_DATA array not a multiple of SignatureSize\n",
|
||||||
__FUNCTION__));
|
__FUNCTION__
|
||||||
|
));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
}
|
}
|
||||||
|
|
||||||
CertCount += CertArraySizeInBytes / CertList->SignatureSize;
|
CertCount += CertArraySizeInBytes / CertList->SignatureSize;
|
||||||
ItemDataSize -= CertList->SignatureListSize;
|
ItemDataSize -= CertList->SignatureListSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CertCount == 0) {
|
if (CertCount == 0) {
|
||||||
DEBUG ((DEBUG_ERROR, "%a: no X509 certificates provided\n", __FUNCTION__));
|
DEBUG ((DEBUG_ERROR, "%a: no X509 certificates provided\n", __FUNCTION__));
|
||||||
goto FreeCACert;
|
goto FreeCACert;
|
||||||
@ -679,7 +700,7 @@ TlsConfigureSession (
|
|||||||
// Tls Cipher List
|
// Tls Cipher List
|
||||||
//
|
//
|
||||||
Status = TlsConfigCipherList (HttpInstance);
|
Status = TlsConfigCipherList (HttpInstance);
|
||||||
if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
|
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
||||||
DEBUG ((DEBUG_ERROR, "TlsConfigCipherList: return %r error.\n", Status));
|
DEBUG ((DEBUG_ERROR, "TlsConfigCipherList: return %r error.\n", Status));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -879,12 +900,14 @@ TlsCommonReceive (
|
|||||||
if (Tcp4RxData == NULL) {
|
if (Tcp4RxData == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tcp4RxData->FragmentCount = 1;
|
Tcp4RxData->FragmentCount = 1;
|
||||||
} else {
|
} else {
|
||||||
Tcp6RxData = HttpInstance->Tcp6TlsRxToken.Packet.RxData;
|
Tcp6RxData = HttpInstance->Tcp6TlsRxToken.Packet.RxData;
|
||||||
if (Tcp6RxData == NULL) {
|
if (Tcp6RxData == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tcp6RxData->FragmentCount = 1;
|
Tcp6RxData->FragmentCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,6 +926,7 @@ TlsCommonReceive (
|
|||||||
Tcp6RxData->FragmentTable[0].FragmentBuffer = Fragment[CurrentFragment].Bulk;
|
Tcp6RxData->FragmentTable[0].FragmentBuffer = Fragment[CurrentFragment].Bulk;
|
||||||
Status = HttpInstance->Tcp6->Receive (HttpInstance->Tcp6, &HttpInstance->Tcp6TlsRxToken);
|
Status = HttpInstance->Tcp6->Receive (HttpInstance->Tcp6, &HttpInstance->Tcp6TlsRxToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -1042,15 +1066,16 @@ TlsReceiveOnePdu (
|
|||||||
}
|
}
|
||||||
|
|
||||||
RecordHeader = *(TLS_RECORD_HEADER *)Header;
|
RecordHeader = *(TLS_RECORD_HEADER *)Header;
|
||||||
if ((RecordHeader.ContentType == TlsContentTypeHandshake ||
|
if (((RecordHeader.ContentType == TlsContentTypeHandshake) ||
|
||||||
RecordHeader.ContentType == TlsContentTypeAlert ||
|
(RecordHeader.ContentType == TlsContentTypeAlert) ||
|
||||||
RecordHeader.ContentType == TlsContentTypeChangeCipherSpec ||
|
(RecordHeader.ContentType == TlsContentTypeChangeCipherSpec) ||
|
||||||
RecordHeader.ContentType == TlsContentTypeApplicationData) &&
|
(RecordHeader.ContentType == TlsContentTypeApplicationData)) &&
|
||||||
(RecordHeader.Version.Major == 0x03) && /// Major versions are same.
|
(RecordHeader.Version.Major == 0x03) && /// Major versions are same.
|
||||||
(RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR ||
|
((RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR) ||
|
||||||
RecordHeader.Version.Minor ==TLS11_PROTOCOL_VERSION_MINOR ||
|
(RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR) ||
|
||||||
RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR)
|
(RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
InsertTailList (NbufList, &PduHdr->List);
|
InsertTailList (NbufList, &PduHdr->List);
|
||||||
} else {
|
} else {
|
||||||
Status = EFI_PROTOCOL_ERROR;
|
Status = EFI_PROTOCOL_ERROR;
|
||||||
@ -1190,6 +1215,7 @@ TlsConnectSession (
|
|||||||
&BufferOutSize
|
&BufferOutSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (BufferOut);
|
FreePool (BufferOut);
|
||||||
return Status;
|
return Status;
|
||||||
@ -1216,7 +1242,8 @@ TlsConnectSession (
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (HttpInstance->TlsSessionState != EfiTlsSessionDataTransferring && \
|
while (HttpInstance->TlsSessionState != EfiTlsSessionDataTransferring && \
|
||||||
((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) {
|
((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout))))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Receive one TLS record.
|
// Receive one TLS record.
|
||||||
//
|
//
|
||||||
@ -1335,6 +1362,7 @@ TlsConnectSession (
|
|||||||
&GetSessionDataBufferSize
|
&GetSessionDataBufferSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (GetSessionDataBuffer);
|
FreePool (GetSessionDataBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
@ -1578,6 +1606,7 @@ ON_EXIT:
|
|||||||
if ( FragmentTable == OriginalFragmentTable) {
|
if ( FragmentTable == OriginalFragmentTable) {
|
||||||
FragmentTable = NULL;
|
FragmentTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (OriginalFragmentTable);
|
FreePool (OriginalFragmentTable);
|
||||||
OriginalFragmentTable = NULL;
|
OriginalFragmentTable = NULL;
|
||||||
}
|
}
|
||||||
@ -1665,10 +1694,11 @@ HttpsReceive (
|
|||||||
|
|
||||||
if ((RecordHeader.ContentType == TlsContentTypeApplicationData) &&
|
if ((RecordHeader.ContentType == TlsContentTypeApplicationData) &&
|
||||||
(RecordHeader.Version.Major == 0x03) &&
|
(RecordHeader.Version.Major == 0x03) &&
|
||||||
(RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR ||
|
((RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR) ||
|
||||||
RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR ||
|
(RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR) ||
|
||||||
RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR)
|
(RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Decrypt Packet.
|
// Decrypt Packet.
|
||||||
//
|
//
|
||||||
@ -1718,6 +1748,7 @@ HttpsReceive (
|
|||||||
&BufferOutSize
|
&BufferOutSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (BufferOut);
|
FreePool (BufferOut);
|
||||||
return Status;
|
return Status;
|
||||||
@ -1768,13 +1799,13 @@ HttpsReceive (
|
|||||||
// Free the buffer in TempFragment.
|
// Free the buffer in TempFragment.
|
||||||
//
|
//
|
||||||
FreePool (TempFragment.Bulk);
|
FreePool (TempFragment.Bulk);
|
||||||
|
|
||||||
} else if ((RecordHeader.ContentType == TlsContentTypeAlert) &&
|
} else if ((RecordHeader.ContentType == TlsContentTypeAlert) &&
|
||||||
(RecordHeader.Version.Major == 0x03) &&
|
(RecordHeader.Version.Major == 0x03) &&
|
||||||
(RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR ||
|
((RecordHeader.Version.Minor == TLS10_PROTOCOL_VERSION_MINOR) ||
|
||||||
RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR ||
|
(RecordHeader.Version.Minor == TLS11_PROTOCOL_VERSION_MINOR) ||
|
||||||
RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR)
|
(RecordHeader.Version.Minor == TLS12_PROTOCOL_VERSION_MINOR))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
BufferOutSize = DEF_BUF_LEN;
|
BufferOutSize = DEF_BUF_LEN;
|
||||||
BufferOut = AllocateZeroPool (BufferOutSize);
|
BufferOut = AllocateZeroPool (BufferOutSize);
|
||||||
if (BufferOut == NULL) {
|
if (BufferOut == NULL) {
|
||||||
@ -1863,6 +1894,7 @@ HttpsReceive (
|
|||||||
&GetSessionDataBufferSize
|
&GetSessionDataBufferSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (GetSessionDataBuffer);
|
FreePool (GetSessionDataBuffer);
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -262,4 +262,3 @@ HttpsReceive (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "HttpUtilitiesDxe.h"
|
#include "HttpUtilitiesDxe.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Unloads an image.
|
Unloads an image.
|
||||||
|
|
||||||
@ -31,7 +30,6 @@ HttpUtilitiesDxeUnload (
|
|||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;
|
EFI_HTTP_UTILITIES_PROTOCOL *HttpUtilitiesProtocol;
|
||||||
|
|
||||||
|
|
||||||
HandleBuffer = NULL;
|
HandleBuffer = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -69,7 +67,8 @@ HttpUtilitiesDxeUnload (
|
|||||||
//
|
//
|
||||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
HandleBuffer[Index],
|
HandleBuffer[Index],
|
||||||
&gEfiHttpUtilitiesProtocolGuid, HttpUtilitiesProtocol,
|
&gEfiHttpUtilitiesProtocolGuid,
|
||||||
|
HttpUtilitiesProtocol,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -80,7 +79,6 @@ HttpUtilitiesDxeUnload (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the declaration of an EFI image entry point. This entry point is
|
This is the declaration of an EFI image entry point. This entry point is
|
||||||
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
||||||
@ -117,4 +115,3 @@ HttpUtilitiesDxeDriverEntryPoint (
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ HttpUtilitiesBuild (
|
|||||||
OUT VOID **NewMessage
|
OUT VOID **NewMessage
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parses HTTP header and produces an array of key/value pairs.
|
Parses HTTP header and produces an array of key/value pairs.
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ EFI_HTTP_UTILITIES_PROTOCOL mHttpUtilitiesProtocol = {
|
|||||||
HttpUtilitiesParse
|
HttpUtilitiesParse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create HTTP header based on a combination of seed header, fields
|
Create HTTP header based on a combination of seed header, fields
|
||||||
to delete, and fields to append.
|
to delete, and fields to append.
|
||||||
@ -106,7 +105,7 @@ HttpUtilitiesBuild (
|
|||||||
//
|
//
|
||||||
// Handle DeleteList
|
// Handle DeleteList
|
||||||
//
|
//
|
||||||
if (SeedFieldCount != 0 && DeleteCount != 0) {
|
if ((SeedFieldCount != 0) && (DeleteCount != 0)) {
|
||||||
TempHeaderFields = AllocateZeroPool (SeedFieldCount * sizeof (EFI_HTTP_HEADER));
|
TempHeaderFields = AllocateZeroPool (SeedFieldCount * sizeof (EFI_HTTP_HEADER));
|
||||||
if (TempHeaderFields == NULL) {
|
if (TempHeaderFields == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
@ -126,6 +125,7 @@ HttpUtilitiesBuild (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
TempFieldCount++;
|
TempFieldCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,6 +176,7 @@ HttpUtilitiesBuild (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewFieldCount++;
|
NewFieldCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,6 +199,7 @@ HttpUtilitiesBuild (
|
|||||||
StrLength = sizeof ("\r\n") - 1;
|
StrLength = sizeof ("\r\n") - 1;
|
||||||
*NewMessageSize += StrLength;
|
*NewMessageSize += StrLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrLength = sizeof ("\r\n") - 1;
|
StrLength = sizeof ("\r\n") - 1;
|
||||||
*NewMessageSize += StrLength;
|
*NewMessageSize += StrLength;
|
||||||
|
|
||||||
@ -228,6 +230,7 @@ HttpUtilitiesBuild (
|
|||||||
CopyMem (NewMessagePtr, "\r\n", StrLength);
|
CopyMem (NewMessagePtr, "\r\n", StrLength);
|
||||||
NewMessagePtr += StrLength;
|
NewMessagePtr += StrLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrLength = sizeof ("\r\n") - 1;
|
StrLength = sizeof ("\r\n") - 1;
|
||||||
CopyMem (NewMessagePtr, "\r\n", StrLength);
|
CopyMem (NewMessagePtr, "\r\n", StrLength);
|
||||||
NewMessagePtr += StrLength;
|
NewMessagePtr += StrLength;
|
||||||
@ -253,7 +256,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parses HTTP header and produces an array of key/value pairs.
|
Parses HTTP header and produces an array of key/value pairs.
|
||||||
|
|
||||||
@ -302,7 +304,7 @@ HttpUtilitiesParse (
|
|||||||
FieldValue = NULL;
|
FieldValue = NULL;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
if (This == NULL || HttpMessage == NULL || HeaderFields == NULL || FieldCount == NULL) {
|
if ((This == NULL) || (HttpMessage == NULL) || (HeaderFields == NULL) || (FieldCount == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +330,7 @@ HttpUtilitiesParse (
|
|||||||
FieldValue = NULL;
|
FieldValue = NULL;
|
||||||
NextToken = HttpGetFieldNameAndValue (Token, &FieldName, &FieldValue);
|
NextToken = HttpGetFieldNameAndValue (Token, &FieldName, &FieldValue);
|
||||||
Token = NextToken;
|
Token = NextToken;
|
||||||
if (FieldName == NULL || FieldValue == NULL) {
|
if ((FieldName == NULL) || (FieldValue == NULL)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +363,7 @@ HttpUtilitiesParse (
|
|||||||
FieldValue = NULL;
|
FieldValue = NULL;
|
||||||
NextToken = HttpGetFieldNameAndValue (Token, &FieldName, &FieldValue);
|
NextToken = HttpGetFieldNameAndValue (Token, &FieldName, &FieldValue);
|
||||||
Token = NextToken;
|
Token = NextToken;
|
||||||
if (FieldName == NULL || FieldValue == NULL) {
|
if ((FieldName == NULL) || (FieldValue == NULL)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,6 @@ IScsiCHAPAuthTarget (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function checks the received iSCSI Login Response during the security
|
This function checks the received iSCSI Login Response during the security
|
||||||
negotiation stage.
|
negotiation stage.
|
||||||
@ -243,6 +242,7 @@ IScsiCHAPOnRspReceived (
|
|||||||
if (Data == NULL) {
|
if (Data == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy the data in case the data spans over multiple PDUs.
|
// Copy the data in case the data spans over multiple PDUs.
|
||||||
//
|
//
|
||||||
@ -286,6 +286,7 @@ IScsiCHAPOnRspReceived (
|
|||||||
if (Value == NULL) {
|
if (Value == NULL) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initiator mandates CHAP authentication but target replies without
|
// Initiator mandates CHAP authentication but target replies without
|
||||||
// "CHAP", or initiator suggets "None" but target replies with some kind of
|
// "CHAP", or initiator suggets "None" but target replies with some kind of
|
||||||
@ -328,12 +329,14 @@ IScsiCHAPOnRspReceived (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HashIndex == ARRAY_SIZE (mChapHash)) {
|
if (HashIndex == ARRAY_SIZE (mChapHash)) {
|
||||||
//
|
//
|
||||||
// Unsupported algorithm is chosen by target.
|
// Unsupported algorithm is chosen by target.
|
||||||
//
|
//
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remember the target's chosen hash algorithm.
|
// Remember the target's chosen hash algorithm.
|
||||||
//
|
//
|
||||||
@ -355,6 +358,7 @@ IScsiCHAPOnRspReceived (
|
|||||||
if (Challenge == NULL) {
|
if (Challenge == NULL) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process the CHAP identifier and CHAP Challenge from Target.
|
// Process the CHAP identifier and CHAP Challenge from Target.
|
||||||
// Calculate Response value.
|
// Calculate Response value.
|
||||||
@ -375,6 +379,7 @@ IScsiCHAPOnRspReceived (
|
|||||||
Status = EFI_PROTOCOL_ERROR;
|
Status = EFI_PROTOCOL_ERROR;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IScsiCHAPCalculateResponse (
|
Status = IScsiCHAPCalculateResponse (
|
||||||
AuthData->InIdentifier,
|
AuthData->InIdentifier,
|
||||||
AuthData->AuthConfig->CHAPSecret,
|
AuthData->AuthConfig->CHAPSecret,
|
||||||
@ -420,7 +425,7 @@ IScsiCHAPOnRspReceived (
|
|||||||
ASSERT (AuthData->Hash != NULL);
|
ASSERT (AuthData->Hash != NULL);
|
||||||
RspLen = AuthData->Hash->DigestSize;
|
RspLen = AuthData->Hash->DigestSize;
|
||||||
Status = IScsiHexToBin (TargetRsp, &RspLen, Response);
|
Status = IScsiHexToBin (TargetRsp, &RspLen, Response);
|
||||||
if (EFI_ERROR (Status) || RspLen != AuthData->Hash->DigestSize) {
|
if (EFI_ERROR (Status) || (RspLen != AuthData->Hash->DigestSize)) {
|
||||||
Status = EFI_PROTOCOL_ERROR;
|
Status = EFI_PROTOCOL_ERROR;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -446,7 +451,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function fills the CHAP authentication information into the login PDU
|
This function fills the CHAP authentication information into the login PDU
|
||||||
during the security negotiation stage in the iSCSI connection login.
|
during the security negotiation stage in the iSCSI connection login.
|
||||||
@ -487,6 +491,7 @@ IScsiCHAPToSendReq (
|
|||||||
if (LoginReq == NULL) {
|
if (LoginReq == NULL) {
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
RspLen = 2 * ISCSI_CHAP_MAX_DIGEST_SIZE + 3;
|
RspLen = 2 * ISCSI_CHAP_MAX_DIGEST_SIZE + 3;
|
||||||
@ -592,6 +597,7 @@ IScsiCHAPToSendReq (
|
|||||||
|
|
||||||
Conn->AuthStep = ISCSI_CHAP_STEP_FOUR;
|
Conn->AuthStep = ISCSI_CHAP_STEP_FOUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the stage transition flag.
|
// Set the stage transition flag.
|
||||||
//
|
//
|
||||||
|
@ -35,7 +35,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define ISCSI_CHAP_STEP_THREE 3
|
#define ISCSI_CHAP_STEP_THREE 3
|
||||||
#define ISCSI_CHAP_STEP_FOUR 4
|
#define ISCSI_CHAP_STEP_FOUR 4
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
|
typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
|
||||||
@ -133,6 +132,7 @@ EFI_STATUS
|
|||||||
IScsiCHAPOnRspReceived (
|
IScsiCHAPOnRspReceived (
|
||||||
IN ISCSI_CONNECTION *Conn
|
IN ISCSI_CONNECTION *Conn
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function fills the CHAP authentication information into the login PDU
|
This function fills the CHAP authentication information into the login PDU
|
||||||
during the security negotiation stage in the iSCSI connection login.
|
during the security negotiation stage in the iSCSI connection login.
|
||||||
@ -164,4 +164,5 @@ VOID
|
|||||||
IScsiCHAPInitHashList (
|
IScsiCHAPInitHashList (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,7 +33,6 @@ HII_VENDOR_DEVICE_PATH mIScsiHiiVendorDevicePath = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the IP address into a dotted string.
|
Convert the IP address into a dotted string.
|
||||||
|
|
||||||
@ -77,10 +76,11 @@ IScsiIpToStr (
|
|||||||
|
|
||||||
for (Index = 0; Index < 15; Index = Index + 2) {
|
for (Index = 0; Index < 15; Index = Index + 2) {
|
||||||
if (!Short &&
|
if (!Short &&
|
||||||
Index % 2 == 0 &&
|
(Index % 2 == 0) &&
|
||||||
Ip6->Addr[Index] == 0 &&
|
(Ip6->Addr[Index] == 0) &&
|
||||||
Ip6->Addr[Index + 1] == 0
|
(Ip6->Addr[Index + 1] == 0)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Deal with the case of ::.
|
// Deal with the case of ::.
|
||||||
//
|
//
|
||||||
@ -159,6 +159,7 @@ IpIsUnicast (
|
|||||||
if (IP4_IS_UNSPECIFIED (NTOHL (Ip->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip->Addr[0]))) {
|
if (IP4_IS_UNSPECIFIED (NTOHL (Ip->Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip->Addr[0]))) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (IpMode == IP_MODE_IP6) {
|
} else if (IpMode == IP_MODE_IP6) {
|
||||||
return NetIp6IsValidUnicast (&Ip->v6);
|
return NetIp6IsValidUnicast (&Ip->v6);
|
||||||
@ -197,7 +198,7 @@ IScsiParseIsIdFromString (
|
|||||||
|
|
||||||
IsIdStr = (CHAR16 *)String;
|
IsIdStr = (CHAR16 *)String;
|
||||||
|
|
||||||
if (StrLen (IsIdStr) != 6 && StrLen (IsIdStr) != 12) {
|
if ((StrLen (IsIdStr) != 6) && (StrLen (IsIdStr) != 12)) {
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
PortString,
|
PortString,
|
||||||
(UINTN)ISCSI_NAME_IFR_MAX_SIZE,
|
(UINTN)ISCSI_NAME_IFR_MAX_SIZE,
|
||||||
@ -274,7 +275,6 @@ IScsiConvertIsIdToString (
|
|||||||
L"%X",
|
L"%X",
|
||||||
(UINTN)IsId[Index]
|
(UINTN)IsId[Index]
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String = String + Number;
|
String = String + Number;
|
||||||
@ -329,6 +329,7 @@ IScsiGetValue (
|
|||||||
while (*StringPtr != L'\0' && *StringPtr != L'&') {
|
while (*StringPtr != L'\0' && *StringPtr != L'&') {
|
||||||
StringPtr++;
|
StringPtr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = StringPtr - TmpPtr;
|
Length = StringPtr - TmpPtr;
|
||||||
Len = Length + 1;
|
Len = Length + 1;
|
||||||
|
|
||||||
@ -404,7 +405,6 @@ IScsiConfigGetAttemptByConfigIndex (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the existing attempt config data from global structure by the NicIndex.
|
Get the existing attempt config data from global structure by the NicIndex.
|
||||||
|
|
||||||
@ -428,8 +428,9 @@ IScsiConfigGetAttemptByNic (
|
|||||||
|
|
||||||
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
|
NET_LIST_FOR_EACH (Entry, &mPrivate->AttemptConfigs) {
|
||||||
Attempt = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
|
Attempt = NET_LIST_USER_STRUCT (Entry, ISCSI_ATTEMPT_CONFIG_NVDATA, Link);
|
||||||
if (Attempt != NewAttempt && Attempt->NicIndex == NewAttempt->NicIndex &&
|
if ((Attempt != NewAttempt) && (Attempt->NicIndex == NewAttempt->NicIndex) &&
|
||||||
Attempt->SessionConfigData.Enabled == IScsiMode) {
|
(Attempt->SessionConfigData.Enabled == IScsiMode))
|
||||||
|
{
|
||||||
return Attempt;
|
return Attempt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -476,6 +477,7 @@ IScsiGetAttemptIndexList (
|
|||||||
if (AttemptStr == NULL) {
|
if (AttemptStr == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttemptStr += Len;
|
AttemptStr += Len;
|
||||||
AttemptIndex = (UINT8)(*AttemptStr - L'0');
|
AttemptIndex = (UINT8)(*AttemptStr - L'0');
|
||||||
AttemptConfigData = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
AttemptConfigData = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
@ -493,6 +495,7 @@ IScsiGetAttemptIndexList (
|
|||||||
Index++;
|
Index++;
|
||||||
AttemptStr += 2;
|
AttemptStr += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +541,6 @@ IScsiConvertAttemptConfigDataToIfrNvData (
|
|||||||
CopyMem (&Ip.v4, &SessionConfigData->TargetIp, sizeof (EFI_IPv4_ADDRESS));
|
CopyMem (&Ip.v4, &SessionConfigData->TargetIp, sizeof (EFI_IPv4_ADDRESS));
|
||||||
IScsiIpToStr (&Ip, FALSE, IfrNvData->TargetIp);
|
IScsiIpToStr (&Ip, FALSE, IfrNvData->TargetIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (IfrNvData->IpMode == IP_MODE_IP6) {
|
} else if (IfrNvData->IpMode == IP_MODE_IP6) {
|
||||||
ZeroMem (IfrNvData->TargetIp, sizeof (IfrNvData->TargetIp));
|
ZeroMem (IfrNvData->TargetIp, sizeof (IfrNvData->TargetIp));
|
||||||
if (SessionConfigData->TargetIp.v6.Addr[0] != '\0') {
|
if (SessionConfigData->TargetIp.v6.Addr[0] != '\0') {
|
||||||
@ -804,7 +806,7 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
UINTN TotalNumber;
|
UINTN TotalNumber;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (IfrNvData == NULL || Attempt == NULL) {
|
if ((IfrNvData == NULL) || (Attempt == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,10 +880,11 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate target configuration if DHCP isn't deployed.
|
// Validate target configuration if DHCP isn't deployed.
|
||||||
//
|
//
|
||||||
if (!Attempt->SessionConfigData.TargetInfoFromDhcp && Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) {
|
if (!Attempt->SessionConfigData.TargetInfoFromDhcp && (Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG)) {
|
||||||
if (!Attempt->SessionConfigData.DnsMode) {
|
if (!Attempt->SessionConfigData.DnsMode) {
|
||||||
if (!IpIsUnicast (&Attempt->SessionConfigData.TargetIp, IfrNvData->IpMode)) {
|
if (!IpIsUnicast (&Attempt->SessionConfigData.TargetIp, IfrNvData->IpMode)) {
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -937,7 +940,8 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
|
|
||||||
if ((IfrNvData->CHAPType == ISCSI_CHAP_MUTUAL) &&
|
if ((IfrNvData->CHAPType == ISCSI_CHAP_MUTUAL) &&
|
||||||
((IfrNvData->ReverseCHAPName[0] == '\0') || (IfrNvData->ReverseCHAPSecret[0] == '\0'))
|
((IfrNvData->ReverseCHAPName[0] == '\0') || (IfrNvData->ReverseCHAPSecret[0] == '\0'))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
||||||
&Key,
|
&Key,
|
||||||
@ -1048,9 +1052,9 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
if (ExistAttempt != NULL) {
|
if (ExistAttempt != NULL) {
|
||||||
ASSERT (ExistAttempt == Attempt);
|
ASSERT (ExistAttempt == Attempt);
|
||||||
|
|
||||||
if (IfrNvData->Enabled == ISCSI_DISABLED &&
|
if ((IfrNvData->Enabled == ISCSI_DISABLED) &&
|
||||||
Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
|
(Attempt->SessionConfigData.Enabled != ISCSI_DISABLED))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Enabled"/"Enabled for MPIO" to "Disabled".
|
// User updates the Attempt from "Enabled"/"Enabled for MPIO" to "Disabled".
|
||||||
//
|
//
|
||||||
@ -1066,11 +1070,12 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
if (mPrivate->SinglePathCount < 1) {
|
if (mPrivate->SinglePathCount < 1) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPrivate->SinglePathCount--;
|
mPrivate->SinglePathCount--;
|
||||||
}
|
}
|
||||||
|
} else if ((IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO) &&
|
||||||
} else if (IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO &&
|
(Attempt->SessionConfigData.Enabled == ISCSI_ENABLED))
|
||||||
Attempt->SessionConfigData.Enabled == ISCSI_ENABLED) {
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Enabled" to "Enabled for MPIO".
|
// User updates the Attempt from "Enabled" to "Enabled for MPIO".
|
||||||
//
|
//
|
||||||
@ -1081,9 +1086,9 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
mPrivate->EnableMpio = TRUE;
|
mPrivate->EnableMpio = TRUE;
|
||||||
mPrivate->MpioCount++;
|
mPrivate->MpioCount++;
|
||||||
mPrivate->SinglePathCount--;
|
mPrivate->SinglePathCount--;
|
||||||
|
} else if ((IfrNvData->Enabled == ISCSI_ENABLED) &&
|
||||||
} else if (IfrNvData->Enabled == ISCSI_ENABLED &&
|
(Attempt->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO))
|
||||||
Attempt->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) {
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Enabled for MPIO" to "Enabled".
|
// User updates the Attempt from "Enabled for MPIO" to "Enabled".
|
||||||
//
|
//
|
||||||
@ -1094,22 +1099,21 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
if (--mPrivate->MpioCount == 0) {
|
if (--mPrivate->MpioCount == 0) {
|
||||||
mPrivate->EnableMpio = FALSE;
|
mPrivate->EnableMpio = FALSE;
|
||||||
}
|
}
|
||||||
mPrivate->SinglePathCount++;
|
|
||||||
|
|
||||||
} else if (IfrNvData->Enabled != ISCSI_DISABLED &&
|
mPrivate->SinglePathCount++;
|
||||||
Attempt->SessionConfigData.Enabled == ISCSI_DISABLED) {
|
} else if ((IfrNvData->Enabled != ISCSI_DISABLED) &&
|
||||||
|
(Attempt->SessionConfigData.Enabled == ISCSI_DISABLED))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Disabled" to "Enabled"/"Enabled for MPIO".
|
// User updates the Attempt from "Disabled" to "Enabled"/"Enabled for MPIO".
|
||||||
//
|
//
|
||||||
if (IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO) {
|
if (IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO) {
|
||||||
mPrivate->EnableMpio = TRUE;
|
mPrivate->EnableMpio = TRUE;
|
||||||
mPrivate->MpioCount++;
|
mPrivate->MpioCount++;
|
||||||
|
|
||||||
} else if (IfrNvData->Enabled == ISCSI_ENABLED) {
|
} else if (IfrNvData->Enabled == ISCSI_ENABLED) {
|
||||||
mPrivate->SinglePathCount++;
|
mPrivate->SinglePathCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ExistAttempt == NULL) {
|
} else if (ExistAttempt == NULL) {
|
||||||
//
|
//
|
||||||
// When a new attempt is created, pointer of the attempt is saved to
|
// When a new attempt is created, pointer of the attempt is saved to
|
||||||
@ -1138,6 +1142,7 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
if (AttemptConfigOrder != NULL) {
|
if (AttemptConfigOrder != NULL) {
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,6 +1185,7 @@ IScsiConvertIfrNvDataToAttemptConfigData (
|
|||||||
|
|
||||||
IScsiConfigUpdateAttempt ();
|
IScsiConfigUpdateAttempt ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Attempt->SessionConfigData.Enabled = IfrNvData->Enabled;
|
Attempt->SessionConfigData.Enabled = IfrNvData->Enabled;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1237,13 +1243,13 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
|
|
||||||
if (OffSet < ATTEMPT_BOOTENABLE_VAR_OFFSET) {
|
if (OffSet < ATTEMPT_BOOTENABLE_VAR_OFFSET) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_BOOTENABLE_VAR_OFFSET) && (OffSet < ATTEMPT_ADDRESS_TYPE_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_BOOTENABLE_VAR_OFFSET) && (OffSet < ATTEMPT_ADDRESS_TYPE_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_BOOTENABLE_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_BOOTENABLE_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
if (Attempt == NULL) {
|
if (Attempt == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfrNvData->Enabled = IfrNvData->ISCSIBootEnableList[AttemptIndex - 1];
|
IfrNvData->Enabled = IfrNvData->ISCSIBootEnableList[AttemptIndex - 1];
|
||||||
//
|
//
|
||||||
// Validate the configuration of attempt.
|
// Validate the configuration of attempt.
|
||||||
@ -1288,9 +1294,9 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IfrNvData->Enabled == ISCSI_DISABLED &&
|
if ((IfrNvData->Enabled == ISCSI_DISABLED) &&
|
||||||
Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
|
(Attempt->SessionConfigData.Enabled != ISCSI_DISABLED))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Enabled"/"Enabled for MPIO" to "Disabled".
|
// User updates the Attempt from "Enabled"/"Enabled for MPIO" to "Disabled".
|
||||||
//
|
//
|
||||||
@ -1306,11 +1312,12 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
if (mPrivate->SinglePathCount < 1) {
|
if (mPrivate->SinglePathCount < 1) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPrivate->SinglePathCount--;
|
mPrivate->SinglePathCount--;
|
||||||
}
|
}
|
||||||
|
} else if ((IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO) &&
|
||||||
} else if (IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO &&
|
(Attempt->SessionConfigData.Enabled == ISCSI_ENABLED))
|
||||||
Attempt->SessionConfigData.Enabled == ISCSI_ENABLED) {
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Enabled" to "Enabled for MPIO".
|
// User updates the Attempt from "Enabled" to "Enabled for MPIO".
|
||||||
//
|
//
|
||||||
@ -1321,9 +1328,9 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
mPrivate->EnableMpio = TRUE;
|
mPrivate->EnableMpio = TRUE;
|
||||||
mPrivate->MpioCount++;
|
mPrivate->MpioCount++;
|
||||||
mPrivate->SinglePathCount--;
|
mPrivate->SinglePathCount--;
|
||||||
|
} else if ((IfrNvData->Enabled == ISCSI_ENABLED) &&
|
||||||
} else if (IfrNvData->Enabled == ISCSI_ENABLED &&
|
(Attempt->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO))
|
||||||
Attempt->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) {
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Enabled for MPIO" to "Enabled".
|
// User updates the Attempt from "Enabled for MPIO" to "Enabled".
|
||||||
//
|
//
|
||||||
@ -1334,34 +1341,34 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
if (--mPrivate->MpioCount == 0) {
|
if (--mPrivate->MpioCount == 0) {
|
||||||
mPrivate->EnableMpio = FALSE;
|
mPrivate->EnableMpio = FALSE;
|
||||||
}
|
}
|
||||||
mPrivate->SinglePathCount++;
|
|
||||||
|
|
||||||
} else if (IfrNvData->Enabled != ISCSI_DISABLED &&
|
mPrivate->SinglePathCount++;
|
||||||
Attempt->SessionConfigData.Enabled == ISCSI_DISABLED) {
|
} else if ((IfrNvData->Enabled != ISCSI_DISABLED) &&
|
||||||
|
(Attempt->SessionConfigData.Enabled == ISCSI_DISABLED))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// User updates the Attempt from "Disabled" to "Enabled"/"Enabled for MPIO".
|
// User updates the Attempt from "Disabled" to "Enabled"/"Enabled for MPIO".
|
||||||
//
|
//
|
||||||
if (IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO) {
|
if (IfrNvData->Enabled == ISCSI_ENABLED_FOR_MPIO) {
|
||||||
mPrivate->EnableMpio = TRUE;
|
mPrivate->EnableMpio = TRUE;
|
||||||
mPrivate->MpioCount++;
|
mPrivate->MpioCount++;
|
||||||
|
|
||||||
} else if (IfrNvData->Enabled == ISCSI_ENABLED) {
|
} else if (IfrNvData->Enabled == ISCSI_ENABLED) {
|
||||||
mPrivate->SinglePathCount++;
|
mPrivate->SinglePathCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Attempt->SessionConfigData.Enabled = IfrNvData->Enabled;
|
|
||||||
|
|
||||||
|
Attempt->SessionConfigData.Enabled = IfrNvData->Enabled;
|
||||||
} else if ((OffSet >= ATTEMPT_ADDRESS_TYPE_VAR_OFFSET) && (OffSet < ATTEMPT_CONNECT_RETRY_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_ADDRESS_TYPE_VAR_OFFSET) && (OffSet < ATTEMPT_CONNECT_RETRY_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_ADDRESS_TYPE_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_ADDRESS_TYPE_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
if (Attempt == NULL) {
|
if (Attempt == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Attempt->SessionConfigData.IpMode = IfrNvData->ISCSIIpAddressTypeList[AttemptIndex - 1];
|
Attempt->SessionConfigData.IpMode = IfrNvData->ISCSIIpAddressTypeList[AttemptIndex - 1];
|
||||||
if (Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) {
|
if (Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) {
|
||||||
Attempt->AutoConfigureMode = 0;
|
Attempt->AutoConfigureMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_CONNECT_RETRY_VAR_OFFSET) && (OffSet < ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_CONNECT_RETRY_VAR_OFFSET) && (OffSet < ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_CONNECT_RETRY_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_CONNECT_RETRY_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
@ -1378,8 +1385,8 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
Attempt->SessionConfigData.ConnectRetryCount = IfrNvData->ISCSIConnectRetry[AttemptIndex - 1];
|
|
||||||
|
|
||||||
|
Attempt->SessionConfigData.ConnectRetryCount = IfrNvData->ISCSIConnectRetry[AttemptIndex - 1];
|
||||||
} else if ((OffSet >= ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) / 2 + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_CONNECT_TIMEOUT_VAR_OFFSET) / 2 + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
@ -1388,7 +1395,8 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] < CONNECT_MIN_TIMEOUT) ||
|
if ((IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] < CONNECT_MIN_TIMEOUT) ||
|
||||||
(IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] > CONNECT_MAX_TIMEOUT)) {
|
(IfrNvData->ISCSIConnectTimeout[AttemptIndex - 1] > CONNECT_MAX_TIMEOUT))
|
||||||
|
{
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
||||||
&Key,
|
&Key,
|
||||||
@ -1402,15 +1410,14 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
if (Attempt->SessionConfigData.ConnectTimeout == 0) {
|
if (Attempt->SessionConfigData.ConnectTimeout == 0) {
|
||||||
Attempt->SessionConfigData.ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
|
Attempt->SessionConfigData.ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_INITIATOR_VIA_DHCP_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
if (Attempt == NULL) {
|
if (Attempt == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
Attempt->SessionConfigData.InitiatorInfoFromDhcp = IfrNvData->ISCSIInitiatorInfoViaDHCP[AttemptIndex - 1];
|
|
||||||
|
|
||||||
|
Attempt->SessionConfigData.InitiatorInfoFromDhcp = IfrNvData->ISCSIInitiatorInfoViaDHCP[AttemptIndex - 1];
|
||||||
} else if ((OffSet >= ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_TARGET_VIA_DHCP_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
@ -1429,13 +1436,13 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET) && (OffSet < ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET) && (OffSet < ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET) / 2 + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_TARGET_TCP_PORT_VAR_OFFSET) / 2 + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
if (Attempt == NULL) {
|
if (Attempt == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (!Attempt->SessionConfigData.TargetInfoFromDhcp)) {
|
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (!Attempt->SessionConfigData.TargetInfoFromDhcp)) {
|
||||||
Attempt->SessionConfigData.TargetPort = IfrNvData->ISCSITargetTcpPort[AttemptIndex - 1];
|
Attempt->SessionConfigData.TargetPort = IfrNvData->ISCSITargetTcpPort[AttemptIndex - 1];
|
||||||
if (Attempt->SessionConfigData.TargetPort == 0) {
|
if (Attempt->SessionConfigData.TargetPort == 0) {
|
||||||
@ -1450,7 +1457,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET) && (OffSet < ATTEMPT_CHARTYPE_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET) && (OffSet < ATTEMPT_CHARTYPE_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_AUTHENTICATION_METHOD_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
@ -1459,17 +1465,16 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Attempt->AuthenticationType = IfrNvData->ISCSIAuthenticationMethod[AttemptIndex - 1];
|
Attempt->AuthenticationType = IfrNvData->ISCSIAuthenticationMethod[AttemptIndex - 1];
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_CHARTYPE_VAR_OFFSET) && (OffSet < ATTEMPT_ISID_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_CHARTYPE_VAR_OFFSET) && (OffSet < ATTEMPT_ISID_VAR_OFFSET)) {
|
||||||
AttemptIndex = (UINT8)((OffSet - ATTEMPT_CHARTYPE_VAR_OFFSET) + 1);
|
AttemptIndex = (UINT8)((OffSet - ATTEMPT_CHARTYPE_VAR_OFFSET) + 1);
|
||||||
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
Attempt = IScsiConfigGetAttemptByConfigIndex (AttemptIndex);
|
||||||
if (Attempt == NULL) {
|
if (Attempt == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
||||||
Attempt->AuthConfigData.CHAP.CHAPType = IfrNvData->ISCSIChapType[AttemptIndex - 1];
|
Attempt->AuthConfigData.CHAP.CHAPType = IfrNvData->ISCSIChapType[AttemptIndex - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (OffSet >= ATTEMPT_ISID_VAR_OFFSET) {
|
} else if (OffSet >= ATTEMPT_ISID_VAR_OFFSET) {
|
||||||
Index = (UINT8)((OffSet - ATTEMPT_ISID_VAR_OFFSET) / sizeof (KEYWORD_STR));
|
Index = (UINT8)((OffSet - ATTEMPT_ISID_VAR_OFFSET) / sizeof (KEYWORD_STR));
|
||||||
AttemptIndex = Index + 1;
|
AttemptIndex = Index + 1;
|
||||||
@ -1482,7 +1487,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
|
|
||||||
if ((OffSet >= ATTEMPT_ISID_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET)) {
|
if ((OffSet >= ATTEMPT_ISID_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET)) {
|
||||||
IScsiParseIsIdFromString (IfrNvData->Keyword[Index].ISCSIIsId, Attempt->SessionConfigData.IsId);
|
IScsiParseIsIdFromString (IfrNvData->Keyword[Index].ISCSIIsId, Attempt->SessionConfigData.IsId);
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_INITIATOR_IP_ADDRESS_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET)) {
|
||||||
if ((Attempt->SessionConfigData.IpMode == IP_MODE_IP4) && (!Attempt->SessionConfigData.InitiatorInfoFromDhcp)) {
|
if ((Attempt->SessionConfigData.IpMode == IP_MODE_IP4) && (!Attempt->SessionConfigData.InitiatorInfoFromDhcp)) {
|
||||||
//
|
//
|
||||||
@ -1490,7 +1494,8 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
//
|
//
|
||||||
Status = NetLibStrToIp4 (IfrNvData->Keyword[Index].ISCSIInitiatorIpAddress, &HostIp.v4);
|
Status = NetLibStrToIp4 (IfrNvData->Keyword[Index].ISCSIInitiatorIpAddress, &HostIp.v4);
|
||||||
if (EFI_ERROR (Status) || ((Attempt->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
if (EFI_ERROR (Status) || ((Attempt->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
||||||
!NetIp4IsUnicast (NTOHL (HostIp.Addr[0]), NTOHL(*(UINT32*)Attempt->SessionConfigData.SubnetMask.Addr)))) {
|
!NetIp4IsUnicast (NTOHL (HostIp.Addr[0]), NTOHL (*(UINT32 *)Attempt->SessionConfigData.SubnetMask.Addr))))
|
||||||
|
{
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
||||||
&Key,
|
&Key,
|
||||||
@ -1510,7 +1515,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_INITIATOR_NET_MASK_VAR_OFFSET) && (OffSet < ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET)) {
|
||||||
if ((Attempt->SessionConfigData.IpMode == IP_MODE_IP4) && (!Attempt->SessionConfigData.InitiatorInfoFromDhcp)) {
|
if ((Attempt->SessionConfigData.IpMode == IP_MODE_IP4) && (!Attempt->SessionConfigData.InitiatorInfoFromDhcp)) {
|
||||||
Status = NetLibStrToIp4 (IfrNvData->Keyword[Index].ISCSIInitiatorNetmask, &SubnetMask.v4);
|
Status = NetLibStrToIp4 (IfrNvData->Keyword[Index].ISCSIInitiatorNetmask, &SubnetMask.v4);
|
||||||
@ -1534,13 +1538,13 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_NAME_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_INITIATOR_GATE_WAY_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_NAME_VAR_OFFSET)) {
|
||||||
if ((Attempt->SessionConfigData.IpMode == IP_MODE_IP4) && (!Attempt->SessionConfigData.InitiatorInfoFromDhcp)) {
|
if ((Attempt->SessionConfigData.IpMode == IP_MODE_IP4) && (!Attempt->SessionConfigData.InitiatorInfoFromDhcp)) {
|
||||||
Status = NetLibStrToIp4 (IfrNvData->Keyword[Index].ISCSIInitiatorGateway, &Gateway.v4);
|
Status = NetLibStrToIp4 (IfrNvData->Keyword[Index].ISCSIInitiatorGateway, &Gateway.v4);
|
||||||
if (EFI_ERROR (Status) ||
|
if (EFI_ERROR (Status) ||
|
||||||
((Gateway.Addr[0] != 0) && (Attempt->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
((Gateway.Addr[0] != 0) && (Attempt->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
||||||
!NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL(*(UINT32*)Attempt->SessionConfigData.SubnetMask.Addr)))) {
|
!NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL (*(UINT32 *)Attempt->SessionConfigData.SubnetMask.Addr))))
|
||||||
|
{
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
||||||
&Key,
|
&Key,
|
||||||
@ -1560,7 +1564,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_TARGET_NAME_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_TARGET_NAME_VAR_OFFSET) && (OffSet < ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET)) {
|
||||||
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (!Attempt->SessionConfigData.TargetInfoFromDhcp)) {
|
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (!Attempt->SessionConfigData.TargetInfoFromDhcp)) {
|
||||||
UnicodeStrToAsciiStrS (IfrNvData->Keyword[Index].ISCSITargetName, IScsiName, ISCSI_NAME_MAX_SIZE);
|
UnicodeStrToAsciiStrS (IfrNvData->Keyword[Index].ISCSITargetName, IScsiName, ISCSI_NAME_MAX_SIZE);
|
||||||
@ -1575,6 +1578,7 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
} else {
|
} else {
|
||||||
AsciiStrCpyS (Attempt->SessionConfigData.TargetName, ISCSI_NAME_MAX_SIZE, IScsiName);
|
AsciiStrCpyS (Attempt->SessionConfigData.TargetName, ISCSI_NAME_MAX_SIZE, IScsiName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
|
if (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED) {
|
||||||
if (Attempt->SessionConfigData.TargetName[0] == L'\0') {
|
if (Attempt->SessionConfigData.TargetName[0] == L'\0') {
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -1595,7 +1599,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET) && (OffSet < ATTEMPT_LUN_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_TARGET_IP_ADDRESS_VAR_OFFSET) && (OffSet < ATTEMPT_LUN_VAR_OFFSET)) {
|
||||||
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (!Attempt->SessionConfigData.TargetInfoFromDhcp)) {
|
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (!Attempt->SessionConfigData.TargetInfoFromDhcp)) {
|
||||||
UnicodeStrToAsciiStrS (IfrNvData->Keyword[Index].ISCSITargetIpAddress, IpString, sizeof (IpString));
|
UnicodeStrToAsciiStrS (IfrNvData->Keyword[Index].ISCSITargetIpAddress, IpString, sizeof (IpString));
|
||||||
@ -1617,7 +1620,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_LUN_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_USER_NAME_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_LUN_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_USER_NAME_VAR_OFFSET)) {
|
||||||
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (Attempt->SessionConfigData.TargetInfoFromDhcp == 0)) {
|
if ((Attempt->SessionConfigData.IpMode < IP_MODE_AUTOCONFIG) && (Attempt->SessionConfigData.TargetInfoFromDhcp == 0)) {
|
||||||
//
|
//
|
||||||
@ -1644,7 +1646,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_CHAR_USER_NAME_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_SECRET_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_CHAR_USER_NAME_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_SECRET_VAR_OFFSET)) {
|
||||||
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
||||||
UnicodeStrToAsciiStrS (
|
UnicodeStrToAsciiStrS (
|
||||||
@ -1673,7 +1674,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_CHAR_SECRET_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_CHAR_SECRET_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET)) {
|
||||||
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
if (Attempt->AuthenticationType == ISCSI_AUTH_TYPE_CHAP) {
|
||||||
ChapSecretLen = (UINT8)StrLen (IfrNvData->Keyword[Index].ISCSIChapSecret);
|
ChapSecretLen = (UINT8)StrLen (IfrNvData->Keyword[Index].ISCSIChapSecret);
|
||||||
@ -1703,7 +1703,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((OffSet >= ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET)) {
|
} else if ((OffSet >= ATTEMPT_CHAR_REVERSE_USER_NAME_VAR_OFFSET) && (OffSet < ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET)) {
|
||||||
if (Attempt->AuthConfigData.CHAP.CHAPType == ISCSI_CHAP_MUTUAL) {
|
if (Attempt->AuthConfigData.CHAP.CHAPType == ISCSI_CHAP_MUTUAL) {
|
||||||
UnicodeStrToAsciiStrS (
|
UnicodeStrToAsciiStrS (
|
||||||
@ -1731,7 +1730,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
);
|
);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (OffSet >= ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET) {
|
} else if (OffSet >= ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET) {
|
||||||
if (Attempt->AuthConfigData.CHAP.CHAPType == ISCSI_CHAP_MUTUAL) {
|
if (Attempt->AuthConfigData.CHAP.CHAPType == ISCSI_CHAP_MUTUAL) {
|
||||||
ReverseChapSecretLen = (UINT8)StrLen (IfrNvData->Keyword[Index].ISCSIReverseChapSecret);
|
ReverseChapSecretLen = (UINT8)StrLen (IfrNvData->Keyword[Index].ISCSIReverseChapSecret);
|
||||||
@ -1764,8 +1762,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Record the user configuration information in NVR.
|
// Record the user configuration information in NVR.
|
||||||
//
|
//
|
||||||
@ -1778,7 +1774,6 @@ IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (
|
|||||||
sizeof (ISCSI_ATTEMPT_CONFIG_NVDATA),
|
sizeof (ISCSI_ATTEMPT_CONFIG_NVDATA),
|
||||||
Attempt
|
Attempt
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1810,7 +1805,7 @@ IScsiCreateOpCode (
|
|||||||
EFI_IFR_GUID_LABEL *InternalStartLabel;
|
EFI_IFR_GUID_LABEL *InternalStartLabel;
|
||||||
EFI_IFR_GUID_LABEL *InternalEndLabel;
|
EFI_IFR_GUID_LABEL *InternalEndLabel;
|
||||||
|
|
||||||
if (StartOpCodeHandle == NULL || StartLabel == NULL || EndOpCodeHandle == NULL || EndLabel == NULL) {
|
if ((StartOpCodeHandle == NULL) || (StartLabel == NULL) || (EndOpCodeHandle == NULL) || (EndLabel == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1877,6 +1872,7 @@ Exit:
|
|||||||
if (*EndOpCodeHandle != NULL) {
|
if (*EndOpCodeHandle != NULL) {
|
||||||
HiiFreeOpCodeHandle (*EndOpCodeHandle);
|
HiiFreeOpCodeHandle (*EndOpCodeHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2118,7 +2114,7 @@ IScsiConfigAddAttemptsByKeywords (
|
|||||||
(VOID **)&AttemptConfigData,
|
(VOID **)&AttemptConfigData,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (AttemptConfigData == NULL || AttemptConfigData->Actived == ISCSI_ACTIVE_ENABLED) {
|
if ((AttemptConfigData == NULL) || (AttemptConfigData->Actived == ISCSI_ACTIVE_ENABLED)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2180,8 +2176,10 @@ IScsiConfigAddAttemptsByKeywords (
|
|||||||
if (AttemptConfigOrder != NULL) {
|
if (AttemptConfigOrder != NULL) {
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AttemptConfigOrder != NULL) {
|
if (AttemptConfigOrder != NULL) {
|
||||||
CopyMem (AttemptConfigOrderTmp, AttemptConfigOrder, AttemptConfigOrderSize);
|
CopyMem (AttemptConfigOrderTmp, AttemptConfigOrder, AttemptConfigOrderSize);
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
@ -2216,7 +2214,6 @@ IScsiConfigAddAttemptsByKeywords (
|
|||||||
sizeof (ISCSI_ATTEMPT_CONFIG_NVDATA),
|
sizeof (ISCSI_ATTEMPT_CONFIG_NVDATA),
|
||||||
AttemptConfigData
|
AttemptConfigData
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -2324,6 +2321,7 @@ IScsiConfigDeleteAttempts (
|
|||||||
if (AttemptConfigData == NULL) {
|
if (AttemptConfigData == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigData = &AttemptConfigData->SessionConfigData;
|
ConfigData = &AttemptConfigData->SessionConfigData;
|
||||||
ConfigData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
ConfigData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
||||||
ConfigData->ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
|
ConfigData->ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
|
||||||
@ -2368,6 +2366,7 @@ IScsiConfigDeleteAttempts (
|
|||||||
if (mCallbackInfo->Current == AttemptConfigData) {
|
if (mCallbackInfo->Current == AttemptConfigData) {
|
||||||
mCallbackInfo->Current = NULL;
|
mCallbackInfo->Current = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (AttemptConfigData);
|
FreePool (AttemptConfigData);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2411,7 +2410,6 @@ Error:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function when user presses "Delete Attempts".
|
Callback function when user presses "Delete Attempts".
|
||||||
|
|
||||||
@ -2427,7 +2425,6 @@ IScsiConfigDisplayDeleteAttempts (
|
|||||||
IN ISCSI_CONFIG_IFR_NVDATA *IfrNvData
|
IN ISCSI_CONFIG_IFR_NVDATA *IfrNvData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
UINT8 *AttemptConfigOrder;
|
UINT8 *AttemptConfigOrder;
|
||||||
UINTN AttemptConfigOrderSize;
|
UINTN AttemptConfigOrderSize;
|
||||||
LIST_ENTRY *Entry;
|
LIST_ENTRY *Entry;
|
||||||
@ -2501,7 +2498,6 @@ IScsiConfigDisplayDeleteAttempts (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function when user presses "Change Attempt Order".
|
Callback function when user presses "Change Attempt Order".
|
||||||
|
|
||||||
@ -2536,6 +2532,7 @@ IScsiConfigDisplayOrderAttempts (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (StartOpCodeHandle != NULL);
|
ASSERT (StartOpCodeHandle != NULL);
|
||||||
|
|
||||||
OptionsOpCodeHandle = NULL;
|
OptionsOpCodeHandle = NULL;
|
||||||
@ -2710,7 +2707,6 @@ Exit:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function when a user presses "Attempt *" or when a user selects a NIC to
|
Callback function when a user presses "Attempt *" or when a user selects a NIC to
|
||||||
create the new attempt.
|
create the new attempt.
|
||||||
@ -2751,14 +2747,15 @@ IScsiConfigProcessDefault (
|
|||||||
NewAttempt = FALSE;
|
NewAttempt = FALSE;
|
||||||
|
|
||||||
if ((KeyValue >= KEY_MAC_ENTRY_BASE) &&
|
if ((KeyValue >= KEY_MAC_ENTRY_BASE) &&
|
||||||
(KeyValue <= (UINT16) (mPrivate->MaxNic + KEY_MAC_ENTRY_BASE))) {
|
(KeyValue <= (UINT16)(mPrivate->MaxNic + KEY_MAC_ENTRY_BASE)))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// User has pressed "Add an Attempt" and then selects a NIC.
|
// User has pressed "Add an Attempt" and then selects a NIC.
|
||||||
//
|
//
|
||||||
NewAttempt = TRUE;
|
NewAttempt = TRUE;
|
||||||
} else if ((KeyValue >= KEY_ATTEMPT_ENTRY_BASE) &&
|
} else if ((KeyValue >= KEY_ATTEMPT_ENTRY_BASE) &&
|
||||||
(KeyValue < (ISCSI_MAX_ATTEMPTS_NUM + KEY_ATTEMPT_ENTRY_BASE))) {
|
(KeyValue < (ISCSI_MAX_ATTEMPTS_NUM + KEY_ATTEMPT_ENTRY_BASE)))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// User has pressed "Attempt *".
|
// User has pressed "Attempt *".
|
||||||
//
|
//
|
||||||
@ -2806,7 +2803,7 @@ IScsiConfigProcessDefault (
|
|||||||
(VOID **)&AttemptConfigData,
|
(VOID **)&AttemptConfigData,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if (AttemptConfigData == NULL || AttemptConfigData->Actived == ISCSI_ACTIVE_ENABLED) {
|
if ((AttemptConfigData == NULL) || (AttemptConfigData->Actived == ISCSI_ACTIVE_ENABLED)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2872,7 +2869,6 @@ IScsiConfigProcessDefault (
|
|||||||
FreePool (AttemptConfigData);
|
FreePool (AttemptConfigData);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Determine which Attempt user has selected to configure.
|
// Determine which Attempt user has selected to configure.
|
||||||
@ -2907,7 +2903,6 @@ IScsiConfigProcessDefault (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
This function allows the caller to request the current
|
This function allows the caller to request the current
|
||||||
@ -2998,7 +2993,7 @@ IScsiFormExtractConfig (
|
|||||||
BOOLEAN AllocatedRequest;
|
BOOLEAN AllocatedRequest;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
if (This == NULL || Progress == NULL || Results == NULL) {
|
if ((This == NULL) || (Progress == NULL) || (Results == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3018,7 +3013,6 @@ IScsiFormExtractConfig (
|
|||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Private->Current != NULL) {
|
if (Private->Current != NULL) {
|
||||||
IScsiConvertAttemptConfigDataToIfrNvData (Private->Current, IfrNvData);
|
IScsiConvertAttemptConfigDataToIfrNvData (Private->Current, IfrNvData);
|
||||||
}
|
}
|
||||||
@ -3065,6 +3059,7 @@ IScsiFormExtractConfig (
|
|||||||
FreePool (InitiatorName);
|
FreePool (InitiatorName);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocatedRequest = TRUE;
|
AllocatedRequest = TRUE;
|
||||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||||
FreePool (ConfigRequestHdr);
|
FreePool (ConfigRequestHdr);
|
||||||
@ -3088,6 +3083,7 @@ IScsiFormExtractConfig (
|
|||||||
FreePool (ConfigRequest);
|
FreePool (ConfigRequest);
|
||||||
ConfigRequest = NULL;
|
ConfigRequest = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Progress string to the original request string.
|
// Set Progress string to the original request string.
|
||||||
//
|
//
|
||||||
@ -3100,7 +3096,6 @@ IScsiFormExtractConfig (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
This function applies changes in a driver's configuration.
|
This function applies changes in a driver's configuration.
|
||||||
@ -3170,7 +3165,7 @@ IScsiFormRouteConfig (
|
|||||||
AttemptList = NULL;
|
AttemptList = NULL;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
if (This == NULL || Configuration == NULL || Progress == NULL) {
|
if ((This == NULL) || (Configuration == NULL) || (Progress == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3261,13 +3256,13 @@ IScsiFormRouteConfig (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (IfrNvData->ISCSIDeleteAttemptList[0] != L'\0') {
|
} else if (IfrNvData->ISCSIDeleteAttemptList[0] != L'\0') {
|
||||||
AttemptList = (UINT8 *)AllocateZeroPool ((ISCSI_MAX_ATTEMPTS_NUM + 1) * sizeof (UINT8));
|
AttemptList = (UINT8 *)AllocateZeroPool ((ISCSI_MAX_ATTEMPTS_NUM + 1) * sizeof (UINT8));
|
||||||
if (AttemptList == NULL) {
|
if (AttemptList == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IScsiGetAttemptIndexList (IfrNvData->ISCSIDeleteAttemptList, AttemptList, FALSE);
|
Status = IScsiGetAttemptIndexList (IfrNvData->ISCSIDeleteAttemptList, AttemptList, FALSE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
@ -3289,8 +3284,10 @@ IScsiFormRouteConfig (
|
|||||||
IfrNvData->DeleteAttemptList[Index2] = 1;
|
IfrNvData->DeleteAttemptList[Index2] = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Index2++;
|
Index2++;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
}
|
}
|
||||||
@ -3301,7 +3298,6 @@ IScsiFormRouteConfig (
|
|||||||
}
|
}
|
||||||
|
|
||||||
FreePool (AttemptList);
|
FreePool (AttemptList);
|
||||||
|
|
||||||
} else if (IfrNvData->ISCSIAttemptOrder[0] != L'\0') {
|
} else if (IfrNvData->ISCSIAttemptOrder[0] != L'\0') {
|
||||||
Status = IScsiGetAttemptIndexList (IfrNvData->ISCSIAttemptOrder, IfrNvData->DynamicOrderedList, FALSE);
|
Status = IScsiGetAttemptIndexList (IfrNvData->ISCSIAttemptOrder, IfrNvData->DynamicOrderedList, FALSE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -3318,7 +3314,6 @@ IScsiFormRouteConfig (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (IfrNvData->ISCSIMacAddr[0] != L'\0') {
|
} else if (IfrNvData->ISCSIMacAddr[0] != L'\0') {
|
||||||
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
||||||
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
||||||
@ -3338,7 +3333,6 @@ IScsiFormRouteConfig (
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Status = IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (IfrNvData, OffSet);
|
Status = IScsiConvertlfrNvDataToAttemptConfigDataByKeyword (IfrNvData, OffSet);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -3622,7 +3616,8 @@ IScsiFormCallback (
|
|||||||
Status = NetLibStrToIp4 (IfrNvData->LocalIp, &HostIp.v4);
|
Status = NetLibStrToIp4 (IfrNvData->LocalIp, &HostIp.v4);
|
||||||
if (EFI_ERROR (Status) ||
|
if (EFI_ERROR (Status) ||
|
||||||
((Private->Current->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
((Private->Current->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
||||||
!NetIp4IsUnicast (NTOHL (HostIp.Addr[0]), NTOHL(*(UINT32*)Private->Current->SessionConfigData.SubnetMask.Addr)))) {
|
!NetIp4IsUnicast (NTOHL (HostIp.Addr[0]), NTOHL (*(UINT32 *)Private->Current->SessionConfigData.SubnetMask.Addr))))
|
||||||
|
{
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
||||||
&Key,
|
&Key,
|
||||||
@ -3659,7 +3654,8 @@ IScsiFormCallback (
|
|||||||
if (EFI_ERROR (Status) ||
|
if (EFI_ERROR (Status) ||
|
||||||
((Gateway.Addr[0] != 0) &&
|
((Gateway.Addr[0] != 0) &&
|
||||||
(Private->Current->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
(Private->Current->SessionConfigData.SubnetMask.Addr[0] != 0) &&
|
||||||
!NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL(*(UINT32*)Private->Current->SessionConfigData.SubnetMask.Addr)))) {
|
!NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL (*(UINT32 *)Private->Current->SessionConfigData.SubnetMask.Addr))))
|
||||||
|
{
|
||||||
CreatePopUp (
|
CreatePopUp (
|
||||||
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
|
||||||
&Key,
|
&Key,
|
||||||
@ -3797,7 +3793,6 @@ IScsiFormCallback (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the iSCSI configuration form.
|
Initialize the iSCSI configuration form.
|
||||||
|
|
||||||
@ -3868,7 +3863,6 @@ IScsiConfigFormInit (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Unload the iSCSI configuration form, this includes: delete all the iSCSI
|
Unload the iSCSI configuration form, this includes: delete all the iSCSI
|
||||||
configuration entries, uninstall the form callback protocol, and
|
configuration entries, uninstall the form callback protocol, and
|
||||||
|
@ -18,7 +18,6 @@ extern UINT8 IScsiConfigVfrBin[];
|
|||||||
extern UINT8 IScsiDxeStrings[];
|
extern UINT8 IScsiDxeStrings[];
|
||||||
extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
|
extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
#define VAR_OFFSET(Field) \
|
#define VAR_OFFSET(Field) \
|
||||||
((UINT16) ((UINTN) &(((ISCSI_CONFIG_IFR_NVDATA *) 0)->Field)))
|
((UINT16) ((UINTN) &(((ISCSI_CONFIG_IFR_NVDATA *) 0)->Field)))
|
||||||
|
|
||||||
@ -80,7 +79,6 @@ extern ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
|
|||||||
#define ATTEMPT_CHAR_REVERSE_SECRET_QUESTION_ID QUESTION_ID (Keyword->ISCSIReverseChapSecret)
|
#define ATTEMPT_CHAR_REVERSE_SECRET_QUESTION_ID QUESTION_ID (Keyword->ISCSIReverseChapSecret)
|
||||||
#define ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIReverseChapSecret)
|
#define ATTEMPT_CHAR_REVERSE_SECRET_VAR_OFFSET VAR_OFFSET (Keyword->ISCSIReverseChapSecret)
|
||||||
|
|
||||||
|
|
||||||
#define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
|
#define ISCSI_INITATOR_NAME_VAR_NAME L"I_NAME"
|
||||||
|
|
||||||
#define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
|
#define ISCSI_CONFIG_VAR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE)
|
||||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "IScsiImpl.h"
|
#include "IScsiImpl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extract the Root Path option and get the required target information.
|
Extract the Root Path option and get the required target information.
|
||||||
|
|
||||||
@ -51,6 +50,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
if ((Length <= IScsiRootPathIdLen) || (CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0)) {
|
if ((Length <= IScsiRootPathIdLen) || (CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip the iSCSI RootPath ID "iscsi:".
|
// Skip the iSCSI RootPath ID "iscsi:".
|
||||||
//
|
//
|
||||||
@ -101,11 +101,12 @@ IScsiDhcpExtractRootPath (
|
|||||||
if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||
|
if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||
|
||||||
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||
|
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||
|
||||||
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)
|
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP address of the target.
|
// Get the IP address of the target.
|
||||||
//
|
//
|
||||||
@ -125,6 +126,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
|
if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
|
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
|
||||||
ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
|
ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
|
||||||
} else {
|
} else {
|
||||||
@ -137,6 +139,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the protocol type.
|
// Check the protocol type.
|
||||||
//
|
//
|
||||||
@ -145,6 +148,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the port of the iSCSI target.
|
// Get the port of the iSCSI target.
|
||||||
//
|
//
|
||||||
@ -154,6 +158,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
} else {
|
} else {
|
||||||
ConfigNvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
ConfigNvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the LUN.
|
// Get the LUN.
|
||||||
//
|
//
|
||||||
@ -166,6 +171,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
} else {
|
} else {
|
||||||
ZeroMem (ConfigNvData->BootLun, sizeof (ConfigNvData->BootLun));
|
ZeroMem (ConfigNvData->BootLun, sizeof (ConfigNvData->BootLun));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the target iSCSI Name.
|
// Get the target iSCSI Name.
|
||||||
//
|
//
|
||||||
@ -175,6 +181,7 @@ IScsiDhcpExtractRootPath (
|
|||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate the iSCSI name.
|
// Validate the iSCSI name.
|
||||||
//
|
//
|
||||||
@ -335,11 +342,11 @@ IScsiParseDhcpAck (
|
|||||||
// Get DNS server addresses and DHCP server address from this offer.
|
// Get DNS server addresses and DHCP server address from this offer.
|
||||||
//
|
//
|
||||||
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
|
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
|
||||||
|
|
||||||
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
|
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Primary DNS server address.
|
// Primary DNS server address.
|
||||||
//
|
//
|
||||||
@ -534,6 +541,7 @@ IScsiDoDhcp (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse the ACK to get required information.
|
// Parse the ACK to get required information.
|
||||||
//
|
//
|
||||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "IScsiImpl.h"
|
#include "IScsiImpl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extract the Root Path option and get the required target information from
|
Extract the Root Path option and get the required target information from
|
||||||
Boot File Uniform Resource Locator (URL) Option.
|
Boot File Uniform Resource Locator (URL) Option.
|
||||||
@ -51,9 +50,11 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
IScsiRootPathIdLen = (UINT16)AsciiStrLen (ISCSI_ROOT_PATH_ID);
|
IScsiRootPathIdLen = (UINT16)AsciiStrLen (ISCSI_ROOT_PATH_ID);
|
||||||
|
|
||||||
if ((Length <= IScsiRootPathIdLen) ||
|
if ((Length <= IScsiRootPathIdLen) ||
|
||||||
(CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0)) {
|
(CompareMem (RootPath, ISCSI_ROOT_PATH_ID, IScsiRootPathIdLen) != 0))
|
||||||
|
{
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip the iSCSI RootPath ID "iscsi:".
|
// Skip the iSCSI RootPath ID "iscsi:".
|
||||||
//
|
//
|
||||||
@ -100,6 +101,7 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
while ((TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) && (Index < Length)) {
|
while ((TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) && (Index < Length)) {
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip ':'.
|
// Skip ':'.
|
||||||
//
|
//
|
||||||
@ -113,7 +115,6 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
// Extract others fields in the Root Path option string.
|
// Extract others fields in the Root Path option string.
|
||||||
//
|
//
|
||||||
for (FieldIndex = 1; (FieldIndex < RP_FIELD_IDX_MAX) && (Index < Length); FieldIndex++) {
|
for (FieldIndex = 1; (FieldIndex < RP_FIELD_IDX_MAX) && (Index < Length); FieldIndex++) {
|
||||||
|
|
||||||
if (TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) {
|
if (TmpStr[Index] != ISCSI_ROOT_PATH_FIELD_DELIMITER) {
|
||||||
Fields[FieldIndex].Str = &TmpStr[Index];
|
Fields[FieldIndex].Str = &TmpStr[Index];
|
||||||
}
|
}
|
||||||
@ -142,11 +143,12 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||
|
if ((Fields[RP_FIELD_IDX_SERVERNAME].Str == NULL) ||
|
||||||
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||
|
(Fields[RP_FIELD_IDX_TARGETNAME].Str == NULL) ||
|
||||||
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)
|
(Fields[RP_FIELD_IDX_PROTOCOL].Len > 1)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the IP address of the target.
|
// Get the IP address of the target.
|
||||||
//
|
//
|
||||||
@ -164,6 +166,7 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
|
if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
|
CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);
|
||||||
ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
|
ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
|
||||||
} else {
|
} else {
|
||||||
@ -184,6 +187,7 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the port of the iSCSI target.
|
// Get the port of the iSCSI target.
|
||||||
//
|
//
|
||||||
@ -193,6 +197,7 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
} else {
|
} else {
|
||||||
ConfigNvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
ConfigNvData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the LUN.
|
// Get the LUN.
|
||||||
//
|
//
|
||||||
@ -205,6 +210,7 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
} else {
|
} else {
|
||||||
ZeroMem (ConfigNvData->BootLun, sizeof (ConfigNvData->BootLun));
|
ZeroMem (ConfigNvData->BootLun, sizeof (ConfigNvData->BootLun));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the target iSCSI Name.
|
// Get the target iSCSI Name.
|
||||||
//
|
//
|
||||||
@ -214,6 +220,7 @@ IScsiDhcp6ExtractRootPath (
|
|||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate the iSCSI name.
|
// Validate the iSCSI name.
|
||||||
//
|
//
|
||||||
@ -300,11 +307,11 @@ IScsiDhcp6ParseReply (
|
|||||||
// Get DNS server addresses from this reply packet.
|
// Get DNS server addresses from this reply packet.
|
||||||
//
|
//
|
||||||
if (OptionList[Index]->OpCode == DHCP6_OPT_DNS_SERVERS) {
|
if (OptionList[Index]->OpCode == DHCP6_OPT_DNS_SERVERS) {
|
||||||
|
|
||||||
if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {
|
if (((OptionList[Index]->OpLen & 0xf) != 0) || (OptionList[Index]->OpLen == 0)) {
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Primary DNS server address.
|
// Primary DNS server address.
|
||||||
//
|
//
|
||||||
@ -316,7 +323,6 @@ IScsiDhcp6ParseReply (
|
|||||||
//
|
//
|
||||||
CopyMem (&ConfigData->SecondaryDns, &OptionList[Index]->Data[16], sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&ConfigData->SecondaryDns, &OptionList[Index]->Data[16], sizeof (EFI_IPv6_ADDRESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_URL) {
|
} else if (OptionList[Index]->OpCode == DHCP6_OPT_BOOT_FILE_URL) {
|
||||||
//
|
//
|
||||||
// The server sends this option to inform the client about an URL to a boot file.
|
// The server sends this option to inform the client about an URL to a boot file.
|
||||||
@ -330,6 +336,7 @@ IScsiDhcp6ParseReply (
|
|||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check param-len 1, should be 16 bytes.
|
// Check param-len 1, should be 16 bytes.
|
||||||
//
|
//
|
||||||
@ -363,7 +370,6 @@ Exit:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Parse the DHCP ACK to get the address configuration and DNS information.
|
Parse the DHCP ACK to get the address configuration and DNS information.
|
||||||
|
|
||||||
@ -493,7 +499,6 @@ IScsiDoDhcp6 (
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
TimerStatus = gBS->CheckEvent (Timer);
|
TimerStatus = gBS->CheckEvent (Timer);
|
||||||
|
|
||||||
if (!EFI_ERROR (TimerStatus)) {
|
if (!EFI_ERROR (TimerStatus)) {
|
||||||
@ -509,9 +514,7 @@ IScsiDoDhcp6 (
|
|||||||
ConfigData
|
ConfigData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (TimerStatus == EFI_NOT_READY);
|
} while (TimerStatus == EFI_NOT_READY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ON_EXIT:
|
ON_EXIT:
|
||||||
@ -542,4 +545,3 @@ ON_EXIT:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define ISCSI_ROOT_PATH_ADDR_START_DELIMITER '['
|
#define ISCSI_ROOT_PATH_ADDR_START_DELIMITER '['
|
||||||
#define ISCSI_ROOT_PATH_ADDR_END_DELIMITER ']'
|
#define ISCSI_ROOT_PATH_ADDR_END_DELIMITER ']'
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Extract the Root Path option and get the required target information from
|
Extract the Root Path option and get the required target information from
|
||||||
Boot File Uniform Resource Locator (URL) Option.
|
Boot File Uniform Resource Locator (URL) Option.
|
||||||
|
@ -89,7 +89,6 @@ IScsiDns4 (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create a DNS child instance and get the protocol.
|
// Create a DNS child instance and get the protocol.
|
||||||
//
|
//
|
||||||
@ -183,10 +182,12 @@ IScsiDns4 (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
|
|
||||||
|
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We just return the first IP address from DNS protocol.
|
// We just return the first IP address from DNS protocol.
|
||||||
//
|
//
|
||||||
@ -199,10 +200,12 @@ Exit:
|
|||||||
if (Token.Event != NULL) {
|
if (Token.Event != NULL) {
|
||||||
gBS->CloseEvent (Token.Event);
|
gBS->CloseEvent (Token.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token.RspData.H2AData != NULL) {
|
if (Token.RspData.H2AData != NULL) {
|
||||||
if (Token.RspData.H2AData->IpList != NULL) {
|
if (Token.RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Token.RspData.H2AData->IpList);
|
FreePool (Token.RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Token.RspData.H2AData);
|
FreePool (Token.RspData.H2AData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,10 +384,12 @@ IScsiDns6 (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (Token.RspData.H2AData->IpCount == 0 || Token.RspData.H2AData->IpList == NULL) {
|
|
||||||
|
if ((Token.RspData.H2AData->IpCount == 0) || (Token.RspData.H2AData->IpList == NULL)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We just return the first IPv6 address from DNS protocol.
|
// We just return the first IPv6 address from DNS protocol.
|
||||||
//
|
//
|
||||||
@ -397,10 +402,12 @@ Exit:
|
|||||||
if (Token.Event != NULL) {
|
if (Token.Event != NULL) {
|
||||||
gBS->CloseEvent (Token.Event);
|
gBS->CloseEvent (Token.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token.RspData.H2AData != NULL) {
|
if (Token.RspData.H2AData != NULL) {
|
||||||
if (Token.RspData.H2AData->IpList != NULL) {
|
if (Token.RspData.H2AData->IpList != NULL) {
|
||||||
FreePool (Token.RspData.H2AData->IpList);
|
FreePool (Token.RspData.H2AData->IpList);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Token.RspData.H2AData);
|
FreePool (Token.RspData.H2AData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,4 +433,3 @@ Exit:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ IScsiCheckAip (
|
|||||||
&AipHandleCount,
|
&AipHandleCount,
|
||||||
&AipHandleBuffer
|
&AipHandleBuffer
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || AipHandleCount == 0) {
|
if (EFI_ERROR (Status) || (AipHandleCount == 0)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,16 +134,17 @@ IScsiCheckAip (
|
|||||||
&gEfiExtScsiPassThruProtocolGuid,
|
&gEfiExtScsiPassThruProtocolGuid,
|
||||||
(VOID *)&ExtScsiPassThru
|
(VOID *)&ExtScsiPassThru
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || ExtScsiPassThru == NULL) {
|
if (EFI_ERROR (Status) || (ExtScsiPassThru == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoTypesBuffer = NULL;
|
InfoTypesBuffer = NULL;
|
||||||
InfoTypeBufferCount = 0;
|
InfoTypeBufferCount = 0;
|
||||||
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
|
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
|
||||||
if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {
|
if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check whether the AIP instance has Network boot information block.
|
// Check whether the AIP instance has Network boot information block.
|
||||||
//
|
//
|
||||||
@ -166,7 +167,7 @@ IScsiCheckAip (
|
|||||||
InfoBlock = NULL;
|
InfoBlock = NULL;
|
||||||
InfoBlockSize = 0;
|
InfoBlockSize = 0;
|
||||||
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoNetworkBootGuid, &InfoBlock, &InfoBlockSize);
|
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoNetworkBootGuid, &InfoBlock, &InfoBlockSize);
|
||||||
if (EFI_ERROR (Status) || InfoBlock == NULL) {
|
if (EFI_ERROR (Status) || (InfoBlock == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,18 +181,20 @@ IScsiCheckAip (
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4) != 0 &&
|
|
||||||
|
if ((((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP4) != 0) &&
|
||||||
!NetworkBoot->iScsiIpv4BootCapablity) ||
|
!NetworkBoot->iScsiIpv4BootCapablity) ||
|
||||||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6) != 0 &&
|
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_IP6) != 0) &&
|
||||||
!NetworkBoot->iScsiIpv6BootCapablity) ||
|
!NetworkBoot->iScsiIpv6BootCapablity) ||
|
||||||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD) != 0 &&
|
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_OFFLOAD) != 0) &&
|
||||||
!NetworkBoot->OffloadCapability) ||
|
!NetworkBoot->OffloadCapability) ||
|
||||||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO) != 0 &&
|
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_SUPPORT_MPIO) != 0) &&
|
||||||
!NetworkBoot->iScsiMpioCapability) ||
|
!NetworkBoot->iScsiMpioCapability) ||
|
||||||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4) != 0 &&
|
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP4) != 0) &&
|
||||||
!NetworkBoot->iScsiIpv4Boot) ||
|
!NetworkBoot->iScsiIpv4Boot) ||
|
||||||
((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6) != 0 &&
|
(((NetworkBootPolicy & STOP_UEFI_ISCSI_IF_AIP_CONFIGURED_IP6) != 0) &&
|
||||||
!NetworkBoot->iScsiIpv6Boot)) {
|
!NetworkBoot->iScsiIpv6Boot))
|
||||||
|
{
|
||||||
FreePool (InfoBlock);
|
FreePool (InfoBlock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -206,9 +209,11 @@ Exit:
|
|||||||
if (InfoBlock != NULL) {
|
if (InfoBlock != NULL) {
|
||||||
FreePool (InfoBlock);
|
FreePool (InfoBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AipHandleBuffer != NULL) {
|
if (AipHandleBuffer != NULL) {
|
||||||
FreePool (AipHandleBuffer);
|
FreePool (AipHandleBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +262,6 @@ IScsiSupported (
|
|||||||
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
|
TcpServiceBindingGuid = &gEfiTcp4ServiceBindingProtocolGuid;
|
||||||
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
|
DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid;
|
||||||
DnsServiceBindingGuid = &gEfiDns4ServiceBindingProtocolGuid;
|
DnsServiceBindingGuid = &gEfiDns4ServiceBindingProtocolGuid;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
|
IScsiServiceBindingGuid = &gIScsiV6PrivateGuid;
|
||||||
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
||||||
@ -325,7 +329,6 @@ IScsiSupported (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start to manage the controller. This is the worker function for
|
Start to manage the controller. This is the worker function for
|
||||||
IScsiIp4(6)DriverBindingStart.
|
IScsiIp4(6)DriverBindingStart.
|
||||||
@ -622,9 +625,10 @@ IScsiStart (
|
|||||||
// Don't process the attempt that does not associate with the current NIC or
|
// Don't process the attempt that does not associate with the current NIC or
|
||||||
// this attempt is disabled or established.
|
// this attempt is disabled or established.
|
||||||
//
|
//
|
||||||
if (AttemptConfigData->NicIndex != mPrivate->CurrentNic ||
|
if ((AttemptConfigData->NicIndex != mPrivate->CurrentNic) ||
|
||||||
AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED ||
|
(AttemptConfigData->SessionConfigData.Enabled == ISCSI_DISABLED) ||
|
||||||
AttemptConfigData->ValidPath) {
|
AttemptConfigData->ValidPath)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,9 +637,10 @@ IScsiStart (
|
|||||||
// In default single path mode, don't process attempts configured for multipath.
|
// In default single path mode, don't process attempts configured for multipath.
|
||||||
//
|
//
|
||||||
if ((mPrivate->EnableMpio &&
|
if ((mPrivate->EnableMpio &&
|
||||||
AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO) ||
|
(AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO)) ||
|
||||||
(!mPrivate->EnableMpio &&
|
(!mPrivate->EnableMpio &&
|
||||||
AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED)) {
|
(AttemptConfigData->SessionConfigData.Enabled != ISCSI_ENABLED)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,18 +648,21 @@ IScsiStart (
|
|||||||
// Don't process the attempt that fails to get the init/target information from DHCP.
|
// Don't process the attempt that fails to get the init/target information from DHCP.
|
||||||
//
|
//
|
||||||
if (AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp &&
|
if (AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp &&
|
||||||
!AttemptConfigData->DhcpSuccess) {
|
!AttemptConfigData->DhcpSuccess)
|
||||||
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
|
{
|
||||||
|
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
|
||||||
mPrivate->ValidSinglePathCount--;
|
mPrivate->ValidSinglePathCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Don't process the autoconfigure path if it is already established.
|
// Don't process the autoconfigure path if it is already established.
|
||||||
//
|
//
|
||||||
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
|
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
|
||||||
AttemptConfigData->AutoConfigureSuccess) {
|
AttemptConfigData->AutoConfigureSuccess)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,16 +673,20 @@ IScsiStart (
|
|||||||
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) {
|
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
|
|
||||||
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6) {
|
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
|
||||||
|
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) {
|
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
|
|
||||||
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4) {
|
if ((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
|
||||||
|
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -742,12 +754,11 @@ IScsiStart (
|
|||||||
// In Single path mode, only the successful attempt will be recorded in iBFT;
|
// In Single path mode, only the successful attempt will be recorded in iBFT;
|
||||||
// in multi-path mode, all the attempt entries in MPIO will be recorded in iBFT.
|
// in multi-path mode, all the attempt entries in MPIO will be recorded in iBFT.
|
||||||
//
|
//
|
||||||
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
|
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
|
||||||
mPrivate->ValidSinglePathCount--;
|
mPrivate->ValidSinglePathCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (Session);
|
FreePool (Session);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
AttemptConfigData->ValidPath = TRUE;
|
AttemptConfigData->ValidPath = TRUE;
|
||||||
|
|
||||||
@ -756,7 +767,7 @@ IScsiStart (
|
|||||||
// TODO: record KRB5 attempt information in the iSCSI device path.
|
// TODO: record KRB5 attempt information in the iSCSI device path.
|
||||||
//
|
//
|
||||||
if (Session->AuthType == ISCSI_AUTH_TYPE_KRB) {
|
if (Session->AuthType == ISCSI_AUTH_TYPE_KRB) {
|
||||||
if (!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount > 0) {
|
if (!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount > 0)) {
|
||||||
mPrivate->ValidSinglePathCount--;
|
mPrivate->ValidSinglePathCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +825,7 @@ IScsiStart (
|
|||||||
//
|
//
|
||||||
// Reinstall the original ExtScsiPassThru back.
|
// Reinstall the original ExtScsiPassThru back.
|
||||||
//
|
//
|
||||||
if (mPrivate->OneSessionEstablished && ExistPrivate != NULL) {
|
if (mPrivate->OneSessionEstablished && (ExistPrivate != NULL)) {
|
||||||
Status = gBS->InstallProtocolInterface (
|
Status = gBS->InstallProtocolInterface (
|
||||||
&ExistPrivate->ExtScsiPassThruHandle,
|
&ExistPrivate->ExtScsiPassThruHandle,
|
||||||
&gEfiExtScsiPassThruProtocolGuid,
|
&gEfiExtScsiPassThruProtocolGuid,
|
||||||
@ -837,8 +848,7 @@ IScsiStart (
|
|||||||
//
|
//
|
||||||
// More than one attempt successes.
|
// More than one attempt successes.
|
||||||
//
|
//
|
||||||
if (Private->Session != NULL && mPrivate->OneSessionEstablished) {
|
if ((Private->Session != NULL) && mPrivate->OneSessionEstablished) {
|
||||||
|
|
||||||
AttemptConfigOrder = IScsiGetVariableAndSize (
|
AttemptConfigOrder = IScsiGetVariableAndSize (
|
||||||
L"AttemptOrder",
|
L"AttemptOrder",
|
||||||
&gIScsiConfigGuid,
|
&gIScsiConfigGuid,
|
||||||
@ -847,9 +857,11 @@ IScsiStart (
|
|||||||
if (AttemptConfigOrder == NULL) {
|
if (AttemptConfigOrder == NULL) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
|
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
|
||||||
if (AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex ||
|
if ((AttemptConfigOrder[Index] == mPrivate->BootSelectedIndex) ||
|
||||||
AttemptConfigOrder[Index] == BootSelected) {
|
(AttemptConfigOrder[Index] == BootSelected))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -887,6 +899,7 @@ IScsiStart (
|
|||||||
if (AttemptConfigOrder[Index] != BootSelected) {
|
if (AttemptConfigOrder[Index] != BootSelected) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPrivate->BootSelectedIndex = BootSelected;
|
mPrivate->BootSelectedIndex = BootSelected;
|
||||||
//
|
//
|
||||||
// Clear the resource in ExistPrivate.
|
// Clear the resource in ExistPrivate.
|
||||||
@ -917,7 +930,6 @@ IScsiStart (
|
|||||||
|
|
||||||
gBS->CloseEvent (ExistPrivate->ExitBootServiceEvent);
|
gBS->CloseEvent (ExistPrivate->ExitBootServiceEvent);
|
||||||
FreePool (ExistPrivate);
|
FreePool (ExistPrivate);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
@ -927,7 +939,6 @@ IScsiStart (
|
|||||||
NeedUpdate = FALSE;
|
NeedUpdate = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NeedUpdate) {
|
if (NeedUpdate) {
|
||||||
@ -945,6 +956,7 @@ IScsiStart (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install the updated device path onto the ExtScsiPassThruHandle.
|
// Install the updated device path onto the ExtScsiPassThruHandle.
|
||||||
//
|
//
|
||||||
@ -1042,7 +1054,6 @@ IScsiStop (
|
|||||||
EFI_GUID *TcpServiceBindingGuid;
|
EFI_GUID *TcpServiceBindingGuid;
|
||||||
EFI_GUID *TcpProtocolGuid;
|
EFI_GUID *TcpProtocolGuid;
|
||||||
|
|
||||||
|
|
||||||
if (NumberOfChildren != 0) {
|
if (NumberOfChildren != 0) {
|
||||||
//
|
//
|
||||||
// We should have only one child.
|
// We should have only one child.
|
||||||
@ -1102,6 +1113,7 @@ IScsiStop (
|
|||||||
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
|
TcpProtocolGuid = &gEfiTcp6ProtocolGuid;
|
||||||
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
TcpServiceBindingGuid = &gEfiTcp6ServiceBindingProtocolGuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
IScsiController = NetLibGetNicHandle (ControllerHandle, TcpProtocolGuid);
|
IScsiController = NetLibGetNicHandle (ControllerHandle, TcpProtocolGuid);
|
||||||
if (IScsiController == NULL) {
|
if (IScsiController == NULL) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -1524,11 +1536,13 @@ IScsiUnload (
|
|||||||
Status = IScsiTestManagedDevice (
|
Status = IScsiTestManagedDevice (
|
||||||
DeviceHandleBuffer[Index],
|
DeviceHandleBuffer[Index],
|
||||||
gIScsiIp4DriverBinding.DriverBindingHandle,
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
&gEfiTcp4ProtocolGuid)
|
&gEfiTcp4ProtocolGuid
|
||||||
|
)
|
||||||
;
|
;
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->DisconnectController (
|
Status = gBS->DisconnectController (
|
||||||
DeviceHandleBuffer[Index],
|
DeviceHandleBuffer[Index],
|
||||||
gIScsiIp4DriverBinding.DriverBindingHandle,
|
gIScsiIp4DriverBinding.DriverBindingHandle,
|
||||||
@ -1551,6 +1565,7 @@ IScsiUnload (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->DisconnectController (
|
Status = gBS->DisconnectController (
|
||||||
DeviceHandleBuffer[Index],
|
DeviceHandleBuffer[Index],
|
||||||
gIScsiIp6DriverBinding.DriverBindingHandle,
|
gIScsiIp6DriverBinding.DriverBindingHandle,
|
||||||
@ -1587,6 +1602,7 @@ IScsiUnload (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
gIScsiControllerNameTable = NULL;
|
gIScsiControllerNameTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1873,4 +1889,3 @@ Error1:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ EFI_EXT_SCSI_PASS_THRU_PROTOCOL gIScsiExtScsiPassThruProtocolTemplate = {
|
|||||||
IScsiExtScsiPassThruGetNextTarget
|
IScsiExtScsiPassThruGetNextTarget
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel.
|
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel.
|
||||||
This function supports both blocking I/O and nonblocking I/O. The blocking I/O
|
This function supports both blocking I/O and nonblocking I/O. The blocking I/O
|
||||||
@ -107,7 +106,6 @@ IScsiExtScsiPassThruFunction (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on
|
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on
|
||||||
a SCSI channel. These can either be the list SCSI devices that are actually
|
a SCSI channel. These can either be the list SCSI devices that are actually
|
||||||
@ -152,7 +150,7 @@ IScsiExtScsiPassThruGetNextTargetLun (
|
|||||||
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
|
Private = ISCSI_DRIVER_DATA_FROM_EXT_SCSI_PASS_THRU (This);
|
||||||
ConfigNvData = &Private->Session->ConfigData->SessionConfigData;
|
ConfigNvData = &Private->Session->ConfigData->SessionConfigData;
|
||||||
|
|
||||||
if ((*Target)[0] == 0 && (CompareMem (Lun, ConfigNvData->BootLun, sizeof (UINT64)) == 0)) {
|
if (((*Target)[0] == 0) && (CompareMem (Lun, ConfigNvData->BootLun, sizeof (UINT64)) == 0)) {
|
||||||
//
|
//
|
||||||
// Only one <Target, Lun> pair per iSCSI Driver instance.
|
// Only one <Target, Lun> pair per iSCSI Driver instance.
|
||||||
//
|
//
|
||||||
@ -170,7 +168,6 @@ IScsiExtScsiPassThruGetNextTargetLun (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate and build a device path node for a SCSI device on a SCSI channel.
|
Allocate and build a device path node for a SCSI device on a SCSI channel.
|
||||||
|
|
||||||
@ -259,6 +256,7 @@ IScsiExtScsiPassThruBuildDevicePath (
|
|||||||
if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) {
|
if (AuthConfig->CHAPType == ISCSI_CHAP_UNI) {
|
||||||
Node->Iscsi.LoginOption |= 0x1000;
|
Node->Iscsi.LoginOption |= 0x1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -274,7 +272,6 @@ IScsiExtScsiPassThruBuildDevicePath (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Translate a device path node to a Target ID and LUN.
|
Translate a device path node to a Target ID and LUN.
|
||||||
|
|
||||||
@ -315,7 +312,8 @@ IScsiExtScsiPassThruGetTargetLun (
|
|||||||
if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
|
if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
|
||||||
(DevicePath->SubType != MSG_ISCSI_DP) ||
|
(DevicePath->SubType != MSG_ISCSI_DP) ||
|
||||||
(DevicePathNodeLength (DevicePath) <= sizeof (ISCSI_DEVICE_PATH))
|
(DevicePathNodeLength (DevicePath) <= sizeof (ISCSI_DEVICE_PATH))
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +332,6 @@ IScsiExtScsiPassThruGetTargetLun (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets a SCSI channel. This operation resets all the SCSI devices connected to
|
Resets a SCSI channel. This operation resets all the SCSI devices connected to
|
||||||
the SCSI channel.
|
the SCSI channel.
|
||||||
@ -353,7 +350,6 @@ IScsiExtScsiPassThruResetChannel (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets a SCSI device that is connected to a SCSI channel.
|
Resets a SCSI device that is connected to a SCSI channel.
|
||||||
|
|
||||||
@ -416,4 +412,3 @@ IScsiExtScsiPassThruGetNextTarget (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ IScsiInitIbfTableHeader (
|
|||||||
CopyMem (&Header->OemTableId, OemTableId, sizeof (UINT64));
|
CopyMem (&Header->OemTableId, OemTableId, sizeof (UINT64));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the control section of the iSCSI Boot Firmware Table.
|
Initialize the control section of the iSCSI Boot Firmware Table.
|
||||||
|
|
||||||
@ -83,7 +82,6 @@ IScsiInitControlSection (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add one item into the heap.
|
Add one item into the heap.
|
||||||
|
|
||||||
@ -109,7 +107,6 @@ IScsiAddHeapItem (
|
|||||||
*(*Heap + Len) = 0;
|
*(*Heap + Len) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fill the Initiator section of the iSCSI Boot Firmware Table.
|
Fill the Initiator section of the iSCSI Boot Firmware Table.
|
||||||
|
|
||||||
@ -151,7 +148,6 @@ IScsiFillInitiatorSection (
|
|||||||
Initiator->IScsiNameOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
|
Initiator->IScsiNameOffset = (UINT16)((UINTN)*Heap - (UINTN)Table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Map the v4 IP address into v6 IP address.
|
Map the v4 IP address into v6 IP address.
|
||||||
|
|
||||||
@ -177,7 +173,6 @@ IScsiMapV4ToV6Addr (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fill the NIC and target sections in iSCSI Boot Firmware Table.
|
Fill the NIC and target sections in iSCSI Boot Firmware Table.
|
||||||
|
|
||||||
@ -233,9 +228,8 @@ IScsiFillNICAndTargetSections (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED);
|
ASSERT (Attempt->SessionConfigData.Enabled != ISCSI_DISABLED);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (Index == 1 && Flag) {
|
if ((Index == 1) && Flag) {
|
||||||
Entry = mPrivate->AttemptConfigs.ForwardLink;
|
Entry = mPrivate->AttemptConfigs.ForwardLink;
|
||||||
Flag = FALSE;
|
Flag = FALSE;
|
||||||
}
|
}
|
||||||
@ -260,7 +254,7 @@ IScsiFillNICAndTargetSections (
|
|||||||
//
|
//
|
||||||
// If multipath mode is enabled, only the attempts in MPIO will be recorded in iBFT.
|
// If multipath mode is enabled, only the attempts in MPIO will be recorded in iBFT.
|
||||||
//
|
//
|
||||||
if (mPrivate->EnableMpio && Attempt->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO) {
|
if (mPrivate->EnableMpio && (Attempt->SessionConfigData.Enabled != ISCSI_ENABLED_FOR_MPIO)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +289,7 @@ IScsiFillNICAndTargetSections (
|
|||||||
Nic->Origin = IpPrefixOriginManual;
|
Nic->Origin = IpPrefixOriginManual;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NvData->IpMode == IP_MODE_IP4 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
|
if ((NvData->IpMode == IP_MODE_IP4) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
|
||||||
//
|
//
|
||||||
// Get the subnet mask prefix length.
|
// Get the subnet mask prefix length.
|
||||||
//
|
//
|
||||||
@ -309,16 +303,13 @@ IScsiFillNICAndTargetSections (
|
|||||||
IScsiMapV4ToV6Addr (&Attempt->PrimaryDns.v4, &Nic->PrimaryDns);
|
IScsiMapV4ToV6Addr (&Attempt->PrimaryDns.v4, &Nic->PrimaryDns);
|
||||||
IScsiMapV4ToV6Addr (&Attempt->SecondaryDns.v4, &Nic->SecondaryDns);
|
IScsiMapV4ToV6Addr (&Attempt->SecondaryDns.v4, &Nic->SecondaryDns);
|
||||||
IScsiMapV4ToV6Addr (&Attempt->DhcpServer.v4, &Nic->DhcpServer);
|
IScsiMapV4ToV6Addr (&Attempt->DhcpServer.v4, &Nic->DhcpServer);
|
||||||
|
} else if ((NvData->IpMode == IP_MODE_IP6) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
|
||||||
} else if (NvData->IpMode == IP_MODE_IP6 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
|
|
||||||
|
|
||||||
Nic->SubnetMaskPrefixLength = NvData->PrefixLength;
|
Nic->SubnetMaskPrefixLength = NvData->PrefixLength;
|
||||||
CopyMem (&Nic->Ip, &NvData->LocalIp, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&Nic->Ip, &NvData->LocalIp, sizeof (EFI_IPv6_ADDRESS));
|
||||||
CopyMem (&Nic->Gateway, &NvData->Gateway, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&Nic->Gateway, &NvData->Gateway, sizeof (EFI_IPv6_ADDRESS));
|
||||||
CopyMem (&Nic->PrimaryDns, &Attempt->PrimaryDns, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&Nic->PrimaryDns, &Attempt->PrimaryDns, sizeof (EFI_IPv6_ADDRESS));
|
||||||
CopyMem (&Nic->SecondaryDns, &Attempt->SecondaryDns, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&Nic->SecondaryDns, &Attempt->SecondaryDns, sizeof (EFI_IPv6_ADDRESS));
|
||||||
CopyMem (&Nic->DhcpServer, &Attempt->DhcpServer, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&Nic->DhcpServer, &Attempt->DhcpServer, sizeof (EFI_IPv6_ADDRESS));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
@ -364,9 +355,9 @@ IScsiFillNICAndTargetSections (
|
|||||||
|
|
||||||
Target->NicIndex = (UINT8)Index;
|
Target->NicIndex = (UINT8)Index;
|
||||||
|
|
||||||
if (NvData->IpMode == IP_MODE_IP4 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
|
if ((NvData->IpMode == IP_MODE_IP4) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
|
||||||
IScsiMapV4ToV6Addr (&NvData->TargetIp.v4, &Target->Ip);
|
IScsiMapV4ToV6Addr (&NvData->TargetIp.v4, &Target->Ip);
|
||||||
} else if (NvData->IpMode == IP_MODE_IP6 || NvData->IpMode == IP_MODE_AUTOCONFIG) {
|
} else if ((NvData->IpMode == IP_MODE_IP6) || (NvData->IpMode == IP_MODE_AUTOCONFIG)) {
|
||||||
CopyMem (&Target->Ip, &NvData->TargetIp, sizeof (EFI_IPv6_ADDRESS));
|
CopyMem (&Target->Ip, &NvData->TargetIp, sizeof (EFI_IPv6_ADDRESS));
|
||||||
} else {
|
} else {
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -434,7 +425,6 @@ IScsiFillNICAndTargetSections (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
|
Publish and remove the iSCSI Boot Firmware Table according to the iSCSI
|
||||||
session status.
|
session status.
|
||||||
@ -472,7 +462,7 @@ IScsiPublishIbft (
|
|||||||
|
|
||||||
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
|
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
|
||||||
return;
|
return;
|
||||||
} else if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION && Rsdp->XsdtAddress != 0) {
|
} else if ((Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) && (Rsdp->XsdtAddress != 0)) {
|
||||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress;
|
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress;
|
||||||
} else if (Rsdp->RsdtAddress != 0) {
|
} else if (Rsdp->RsdtAddress != 0) {
|
||||||
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress;
|
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress;
|
||||||
@ -490,14 +480,16 @@ IScsiPublishIbft (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mIbftInstalled = FALSE;
|
mIbftInstalled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there is no valid attempt configuration, just return.
|
// If there is no valid attempt configuration, just return.
|
||||||
//
|
//
|
||||||
if ((!mPrivate->EnableMpio && mPrivate->ValidSinglePathCount == 0) ||
|
if ((!mPrivate->EnableMpio && (mPrivate->ValidSinglePathCount == 0)) ||
|
||||||
(mPrivate->EnableMpio && mPrivate->MpioCount <= mPrivate->Krb5MpioCount)) {
|
(mPrivate->EnableMpio && (mPrivate->MpioCount <= mPrivate->Krb5MpioCount)))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName = {
|
|||||||
IScsiSetInitiatorName
|
IScsiSetInitiatorName
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the current set value of iSCSI Initiator Name.
|
Retrieves the current set value of iSCSI Initiator Name.
|
||||||
|
|
||||||
@ -64,7 +63,6 @@ IScsiGetInitiatorName (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the iSSI Initiator Name.
|
Sets the iSSI Initiator Name.
|
||||||
|
|
||||||
@ -110,6 +108,7 @@ IScsiSetInitiatorName (
|
|||||||
*BufferSize = ISCSI_NAME_MAX_SIZE;
|
*BufferSize = ISCSI_NAME_MAX_SIZE;
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only support iqn iSCSI names.
|
// Only support iqn iSCSI names.
|
||||||
//
|
//
|
||||||
|
@ -36,7 +36,6 @@ IScsiStrTrim (
|
|||||||
// Trim off the leading and trailing characters c
|
// Trim off the leading and trailing characters c
|
||||||
//
|
//
|
||||||
for (Pointer1 = Str; (*Pointer1 != 0) && (*Pointer1 == CharC); Pointer1++) {
|
for (Pointer1 = Str; (*Pointer1 != 0) && (*Pointer1 == CharC); Pointer1++) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointer2 = Str;
|
Pointer2 = Str;
|
||||||
@ -51,13 +50,13 @@ IScsiStrTrim (
|
|||||||
Pointer1++;
|
Pointer1++;
|
||||||
Pointer2++;
|
Pointer2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Pointer2 = 0;
|
*Pointer2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Pointer1 = Str + StrLen (Str) - 1; Pointer1 >= Str && *Pointer1 == CharC; Pointer1--) {
|
for (Pointer1 = Str + StrLen (Str) - 1; Pointer1 >= Str && *Pointer1 == CharC; Pointer1--) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pointer1 != Str + StrLen (Str) - 1) {
|
if (Pointer1 != Str + StrLen (Str) - 1) {
|
||||||
*(Pointer1 + 1) = 0;
|
*(Pointer1 + 1) = 0;
|
||||||
}
|
}
|
||||||
@ -104,7 +103,6 @@ IScsiGetSubnetMaskPrefixLength (
|
|||||||
return (UINT8)(32 - Len);
|
return (UINT8)(32 - Len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the hexadecimal encoded LUN string into the 64-bit LUN.
|
Convert the hexadecimal encoded LUN string into the 64-bit LUN.
|
||||||
|
|
||||||
@ -136,7 +134,7 @@ IScsiAsciiStrToLun (
|
|||||||
for (Index = 0; Index < SizeStr; Index++) {
|
for (Index = 0; Index < SizeStr; Index++) {
|
||||||
TemStr[0] = Str[Index];
|
TemStr[0] = Str[Index];
|
||||||
TemValue = (UINT8)AsciiStrHexToUint64 (TemStr);
|
TemValue = (UINT8)AsciiStrHexToUint64 (TemStr);
|
||||||
if (TemValue == 0 && TemStr[0] != '0') {
|
if ((TemValue == 0) && (TemStr[0] != '0')) {
|
||||||
if ((TemStr[0] != '-') || (IndexNum == 0)) {
|
if ((TemStr[0] != '-') || (IndexNum == 0)) {
|
||||||
//
|
//
|
||||||
// Invalid Lun Char.
|
// Invalid Lun Char.
|
||||||
@ -155,6 +153,7 @@ IScsiAsciiStrToLun (
|
|||||||
//
|
//
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Restart str index for the next lun value.
|
// Restart str index for the next lun value.
|
||||||
//
|
//
|
||||||
@ -201,7 +200,6 @@ IScsiLunToUnicodeStr (
|
|||||||
TempStr = Str;
|
TempStr = Str;
|
||||||
|
|
||||||
for (Index = 0; Index < 4; Index++) {
|
for (Index = 0; Index < 4; Index++) {
|
||||||
|
|
||||||
if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {
|
if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {
|
||||||
CopyMem (TempStr, L"0-", sizeof (L"0-"));
|
CopyMem (TempStr, L"0-", sizeof (L"0-"));
|
||||||
} else {
|
} else {
|
||||||
@ -217,6 +215,7 @@ IScsiLunToUnicodeStr (
|
|||||||
|
|
||||||
TempStr += StrLen (TempStr);
|
TempStr += StrLen (TempStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remove the last '-'
|
// Remove the last '-'
|
||||||
//
|
//
|
||||||
@ -253,19 +252,17 @@ IScsiAsciiStrToIp (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (IpMode == IP_MODE_IP4 || IpMode == IP_MODE_AUTOCONFIG_IP4) {
|
if ((IpMode == IP_MODE_IP4) || (IpMode == IP_MODE_AUTOCONFIG_IP4)) {
|
||||||
return NetLibAsciiStrToIp4 (Str, &Ip->v4);
|
return NetLibAsciiStrToIp4 (Str, &Ip->v4);
|
||||||
|
} else if ((IpMode == IP_MODE_IP6) || (IpMode == IP_MODE_AUTOCONFIG_IP6)) {
|
||||||
} else if (IpMode == IP_MODE_IP6 || IpMode == IP_MODE_AUTOCONFIG_IP6) {
|
|
||||||
return NetLibAsciiStrToIp6 (Str, &Ip->v6);
|
return NetLibAsciiStrToIp6 (Str, &Ip->v6);
|
||||||
|
|
||||||
} else if (IpMode == IP_MODE_AUTOCONFIG) {
|
} else if (IpMode == IP_MODE_AUTOCONFIG) {
|
||||||
Status = NetLibAsciiStrToIp4 (Str, &Ip->v4);
|
Status = NetLibAsciiStrToIp4 (Str, &Ip->v4);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
return NetLibAsciiStrToIp6 (Str, &Ip->v6);
|
|
||||||
|
|
||||||
|
return NetLibAsciiStrToIp6 (Str, &Ip->v6);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
@ -340,7 +337,8 @@ IScsiBinToHex (
|
|||||||
// Safely calculate: HexLengthMin := BinLength * 2 + 3.
|
// Safely calculate: HexLengthMin := BinLength * 2 + 3.
|
||||||
//
|
//
|
||||||
if (RETURN_ERROR (SafeUint32Mult (BinLength, 2, &HexLengthMin)) ||
|
if (RETURN_ERROR (SafeUint32Mult (BinLength, 2, &HexLengthMin)) ||
|
||||||
RETURN_ERROR (SafeUint32Add (HexLengthMin, 3, &HexLengthMin))) {
|
RETURN_ERROR (SafeUint32Add (HexLengthMin, 3, &HexLengthMin)))
|
||||||
|
{
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
return EFI_BAD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +364,6 @@ IScsiBinToHex (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the hexadecimal string into a binary encoded buffer.
|
Convert the hexadecimal string into a binary encoded buffer.
|
||||||
|
|
||||||
@ -411,9 +408,10 @@ IScsiHexToBin (
|
|||||||
//
|
//
|
||||||
// Reject an empty hex string; reject a stray nibble.
|
// Reject an empty hex string; reject a stray nibble.
|
||||||
//
|
//
|
||||||
if (Length == 0 || Length % 2 != 0) {
|
if ((Length == 0) || (Length % 2 != 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if the caller provides enough room for the decoded blob.
|
// Check if the caller provides enough room for the decoded blob.
|
||||||
//
|
//
|
||||||
@ -421,6 +419,7 @@ IScsiHexToBin (
|
|||||||
if (BinLengthMin > MAX_UINT32) {
|
if (BinLengthMin > MAX_UINT32) {
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
return EFI_BAD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BinLengthProvided = *BinLength;
|
BinLengthProvided = *BinLength;
|
||||||
*BinLength = (UINT32)BinLengthMin;
|
*BinLength = (UINT32)BinLengthMin;
|
||||||
if (BinLengthProvided < BinLengthMin) {
|
if (BinLengthProvided < BinLengthMin) {
|
||||||
@ -430,22 +429,23 @@ IScsiHexToBin (
|
|||||||
for (Index = 0; Index < Length; Index++) {
|
for (Index = 0; Index < Length; Index++) {
|
||||||
TemStr[0] = HexStr[Index];
|
TemStr[0] = HexStr[Index];
|
||||||
Digit = (UINT8)AsciiStrHexToUint64 (TemStr);
|
Digit = (UINT8)AsciiStrHexToUint64 (TemStr);
|
||||||
if (Digit == 0 && TemStr[0] != '0') {
|
if ((Digit == 0) && (TemStr[0] != '0')) {
|
||||||
//
|
//
|
||||||
// Invalid Hex Char.
|
// Invalid Hex Char.
|
||||||
//
|
//
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Index & 1) == 0) {
|
if ((Index & 1) == 0) {
|
||||||
BinBuffer[Index/2] = Digit;
|
BinBuffer[Index/2] = Digit;
|
||||||
} else {
|
} else {
|
||||||
BinBuffer[Index/2] = (UINT8)((BinBuffer[Index/2] << 4) + Digit);
|
BinBuffer[Index/2] = (UINT8)((BinBuffer[Index/2] << 4) + Digit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the decimal-constant string or hex-constant string into a numerical value.
|
Convert the decimal-constant string or hex-constant string into a numerical value.
|
||||||
|
|
||||||
@ -468,7 +468,6 @@ IScsiNetNtoi (
|
|||||||
return AsciiStrDecimalToUintn (Str);
|
return AsciiStrDecimalToUintn (Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generate random numbers.
|
Generate random numbers.
|
||||||
|
|
||||||
@ -491,7 +490,6 @@ IScsiGenRandom (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether UNDI protocol supports IPv6.
|
Check whether UNDI protocol supports IPv6.
|
||||||
|
|
||||||
@ -554,14 +552,14 @@ IScsiCheckIpv6Support (
|
|||||||
&gEfiAdapterInformationProtocolGuid,
|
&gEfiAdapterInformationProtocolGuid,
|
||||||
(VOID *)&Aip
|
(VOID *)&Aip
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || Aip == NULL) {
|
if (EFI_ERROR (Status) || (Aip == NULL)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoTypesBuffer = NULL;
|
InfoTypesBuffer = NULL;
|
||||||
InfoTypeBufferCount = 0;
|
InfoTypeBufferCount = 0;
|
||||||
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
|
Status = Aip->GetSupportedTypes (Aip, &InfoTypesBuffer, &InfoTypeBufferCount);
|
||||||
if (EFI_ERROR (Status) || InfoTypesBuffer == NULL) {
|
if (EFI_ERROR (Status) || (InfoTypesBuffer == NULL)) {
|
||||||
FreePool (InfoTypesBuffer);
|
FreePool (InfoTypesBuffer);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -585,7 +583,7 @@ IScsiCheckIpv6Support (
|
|||||||
InfoBlock = NULL;
|
InfoBlock = NULL;
|
||||||
InfoBlockSize = 0;
|
InfoBlockSize = 0;
|
||||||
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
|
Status = Aip->GetInformation (Aip, &gEfiAdapterInfoUndiIpv6SupportGuid, &InfoBlock, &InfoBlockSize);
|
||||||
if (EFI_ERROR (Status) || InfoBlock == NULL) {
|
if (EFI_ERROR (Status) || (InfoBlock == NULL)) {
|
||||||
FreePool (InfoBlock);
|
FreePool (InfoBlock);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -638,9 +636,10 @@ IScsiAddNic (
|
|||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
||||||
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
||||||
if (NicInfo->HwAddressSize == HwAddressSize &&
|
if ((NicInfo->HwAddressSize == HwAddressSize) &&
|
||||||
CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0 &&
|
(CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0) &&
|
||||||
NicInfo->VlanId == VlanId) {
|
(NicInfo->VlanId == VlanId))
|
||||||
|
{
|
||||||
mPrivate->CurrentNic = NicInfo->NicIndex;
|
mPrivate->CurrentNic = NicInfo->NicIndex;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -706,7 +705,6 @@ IScsiAddNic (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Delete the recorded NIC info from global structure. Also delete corresponding
|
Delete the recorded NIC info from global structure. Also delete corresponding
|
||||||
attempts.
|
attempts.
|
||||||
@ -752,10 +750,10 @@ IScsiRemoveNic (
|
|||||||
|
|
||||||
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
NET_LIST_FOR_EACH (Entry, &mPrivate->NicInfoList) {
|
||||||
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
NicInfo = NET_LIST_USER_STRUCT (Entry, ISCSI_NIC_INFO, Link);
|
||||||
if (NicInfo->HwAddressSize == HwAddressSize &&
|
if ((NicInfo->HwAddressSize == HwAddressSize) &&
|
||||||
CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0 &&
|
(CompareMem (&NicInfo->PermanentAddress, MacAddr.Addr, HwAddressSize) == 0) &&
|
||||||
NicInfo->VlanId == VlanId) {
|
(NicInfo->VlanId == VlanId))
|
||||||
|
{
|
||||||
ThisNic = NicInfo;
|
ThisNic = NicInfo;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -780,16 +778,15 @@ IScsiRemoveNic (
|
|||||||
RemoveEntryList (&AttemptConfigData->Link);
|
RemoveEntryList (&AttemptConfigData->Link);
|
||||||
mPrivate->AttemptCount--;
|
mPrivate->AttemptCount--;
|
||||||
|
|
||||||
if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO && mPrivate->MpioCount > 0) {
|
if ((AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED_FOR_MPIO) && (mPrivate->MpioCount > 0)) {
|
||||||
if (--mPrivate->MpioCount == 0) {
|
if (--mPrivate->MpioCount == 0) {
|
||||||
mPrivate->EnableMpio = FALSE;
|
mPrivate->EnableMpio = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AttemptConfigData->AuthenticationType == ISCSI_AUTH_TYPE_KRB && mPrivate->Krb5MpioCount > 0) {
|
if ((AttemptConfigData->AuthenticationType == ISCSI_AUTH_TYPE_KRB) && (mPrivate->Krb5MpioCount > 0)) {
|
||||||
mPrivate->Krb5MpioCount--;
|
mPrivate->Krb5MpioCount--;
|
||||||
}
|
}
|
||||||
|
} else if ((AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED) && (mPrivate->SinglePathCount > 0)) {
|
||||||
} else if (AttemptConfigData->SessionConfigData.Enabled == ISCSI_ENABLED && mPrivate->SinglePathCount > 0) {
|
|
||||||
mPrivate->SinglePathCount--;
|
mPrivate->SinglePathCount--;
|
||||||
|
|
||||||
if (mPrivate->ValidSinglePathCount > 0) {
|
if (mPrivate->ValidSinglePathCount > 0) {
|
||||||
@ -841,6 +838,7 @@ IScsiCreateAttempts (
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalNumber++;
|
TotalNumber++;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -851,6 +849,7 @@ IScsiCreateAttempts (
|
|||||||
if (AttemptConfigOrder != NULL) {
|
if (AttemptConfigOrder != NULL) {
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,10 +871,14 @@ IScsiCreateAttempts (
|
|||||||
);
|
);
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_ERROR,
|
DEBUG ((
|
||||||
|
DEBUG_ERROR,
|
||||||
"%a: Failed to set 'InitialAttemptOrder' with Guid (%g): "
|
"%a: Failed to set 'InitialAttemptOrder' with Guid (%g): "
|
||||||
"%r\n",
|
"%r\n",
|
||||||
__FUNCTION__, &gIScsiConfigGuid, Status));
|
__FUNCTION__,
|
||||||
|
&gIScsiConfigGuid,
|
||||||
|
Status
|
||||||
|
));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,6 +889,7 @@ IScsiCreateAttempts (
|
|||||||
if (AttemptConfigData == NULL) {
|
if (AttemptConfigData == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigData = &AttemptConfigData->SessionConfigData;
|
ConfigData = &AttemptConfigData->SessionConfigData;
|
||||||
ConfigData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
ConfigData->TargetPort = ISCSI_WELL_KNOWN_PORT;
|
||||||
ConfigData->ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
|
ConfigData->ConnectTimeout = CONNECT_DEFAULT_TIMEOUT;
|
||||||
@ -918,10 +922,14 @@ IScsiCreateAttempts (
|
|||||||
);
|
);
|
||||||
FreePool (AttemptConfigData);
|
FreePool (AttemptConfigData);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((DEBUG_ERROR,
|
DEBUG ((
|
||||||
|
DEBUG_ERROR,
|
||||||
"%a: Failed to set variable (mPrivate->PortString) with Guid (%g): "
|
"%a: Failed to set variable (mPrivate->PortString) with Guid (%g): "
|
||||||
"%r\n",
|
"%r\n",
|
||||||
__FUNCTION__, &gEfiIScsiInitiatorNameProtocolGuid, Status));
|
__FUNCTION__,
|
||||||
|
&gEfiIScsiInitiatorNameProtocolGuid,
|
||||||
|
Status
|
||||||
|
));
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1559,7 +1567,7 @@ IScsiCleanAttemptVariable (
|
|||||||
&gIScsiConfigGuid,
|
&gIScsiConfigGuid,
|
||||||
&AttemptConfigOrderSize
|
&AttemptConfigOrderSize
|
||||||
);
|
);
|
||||||
if (AttemptConfigOrder == NULL || AttemptConfigOrderSize == 0) {
|
if ((AttemptConfigOrder == NULL) || (AttemptConfigOrderSize == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1588,6 +1596,7 @@ IScsiCleanAttemptVariable (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1617,7 +1626,6 @@ IScsiGetNicInfoByIndex (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the NIC's PCI location and return it according to the composited
|
Get the NIC's PCI location and return it according to the composited
|
||||||
format defined in iSCSI Boot Firmware Table.
|
format defined in iSCSI Boot Firmware Table.
|
||||||
@ -1675,7 +1683,6 @@ IScsiGetNICPciLocation (
|
|||||||
return (UINT16)((*Bus << 8) | (*Device << 3) | *Function);
|
return (UINT16)((*Bus << 8) | (*Device << 3) | *Function);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
|
Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
|
||||||
buffer, and the size of the buffer. If failure, return NULL.
|
buffer, and the size of the buffer. If failure, return NULL.
|
||||||
@ -1715,6 +1722,7 @@ IScsiGetVariableAndSize (
|
|||||||
if (Buffer == NULL) {
|
if (Buffer == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read variable into the allocated buffer.
|
// Read variable into the allocated buffer.
|
||||||
//
|
//
|
||||||
@ -1728,7 +1736,6 @@ IScsiGetVariableAndSize (
|
|||||||
return Buffer;
|
return Buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create the iSCSI driver data.
|
Create the iSCSI driver data.
|
||||||
|
|
||||||
@ -1789,7 +1796,6 @@ IScsiCreateDriverData (
|
|||||||
return Private;
|
return Private;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean the iSCSI driver data.
|
Clean the iSCSI driver data.
|
||||||
|
|
||||||
@ -1876,7 +1882,7 @@ IScsiDhcpIsConfigured (
|
|||||||
&gIScsiConfigGuid,
|
&gIScsiConfigGuid,
|
||||||
&AttemptConfigOrderSize
|
&AttemptConfigOrderSize
|
||||||
);
|
);
|
||||||
if (AttemptConfigOrder == NULL || AttemptConfigOrderSize == 0) {
|
if ((AttemptConfigOrder == NULL) || (AttemptConfigOrderSize == 0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1887,6 +1893,7 @@ IScsiDhcpIsConfigured (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get VLAN ID of this network device.
|
// Get VLAN ID of this network device.
|
||||||
//
|
//
|
||||||
@ -1906,7 +1913,7 @@ IScsiDhcpIsConfigured (
|
|||||||
(VOID **)&AttemptTmp,
|
(VOID **)&AttemptTmp,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if(AttemptTmp == NULL || EFI_ERROR (Status)) {
|
if ((AttemptTmp == NULL) || EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1917,21 +1924,23 @@ IScsiDhcpIsConfigured (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG &&
|
if ((AttemptTmp->SessionConfigData.IpMode != IP_MODE_AUTOCONFIG) &&
|
||||||
AttemptTmp->SessionConfigData.IpMode != ((IpVersion == IP_VERSION_4) ? IP_MODE_IP4 : IP_MODE_IP6)) {
|
(AttemptTmp->SessionConfigData.IpMode != ((IpVersion == IP_VERSION_4) ? IP_MODE_IP4 : IP_MODE_IP6)))
|
||||||
|
{
|
||||||
FreePool (AttemptTmp);
|
FreePool (AttemptTmp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
|
AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
|
||||||
|
|
||||||
if (AttemptTmp->Actived == ISCSI_ACTIVE_DISABLED || StrCmp (MacString, AttemptMacString)) {
|
if ((AttemptTmp->Actived == ISCSI_ACTIVE_DISABLED) || StrCmp (MacString, AttemptMacString)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG ||
|
if ((AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) ||
|
||||||
AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp == TRUE ||
|
(AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp == TRUE) ||
|
||||||
AttemptTmp->SessionConfigData.TargetInfoFromDhcp == TRUE) {
|
(AttemptTmp->SessionConfigData.TargetInfoFromDhcp == TRUE))
|
||||||
|
{
|
||||||
FreePool (AttemptTmp);
|
FreePool (AttemptTmp);
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1975,7 +1984,7 @@ IScsiDnsIsConfigured (
|
|||||||
&gIScsiConfigGuid,
|
&gIScsiConfigGuid,
|
||||||
&AttemptConfigOrderSize
|
&AttemptConfigOrderSize
|
||||||
);
|
);
|
||||||
if (AttemptConfigOrder == NULL || AttemptConfigOrderSize == 0) {
|
if ((AttemptConfigOrder == NULL) || (AttemptConfigOrderSize == 0)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1986,6 +1995,7 @@ IScsiDnsIsConfigured (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get VLAN ID of this network device.
|
// Get VLAN ID of this network device.
|
||||||
//
|
//
|
||||||
@ -2006,7 +2016,7 @@ IScsiDnsIsConfigured (
|
|||||||
(VOID **)&AttemptTmp,
|
(VOID **)&AttemptTmp,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
if(AttemptTmp == NULL || EFI_ERROR (Status)) {
|
if ((AttemptTmp == NULL) || EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2014,7 +2024,7 @@ IScsiDnsIsConfigured (
|
|||||||
|
|
||||||
AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
|
AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
|
||||||
|
|
||||||
if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED || StrCmp (MacString, AttemptMacString)) {
|
if ((AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) || StrCmp (MacString, AttemptMacString)) {
|
||||||
FreePool (AttemptTmp);
|
FreePool (AttemptTmp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2027,12 +2037,10 @@ IScsiDnsIsConfigured (
|
|||||||
FreePool (AttemptTmp);
|
FreePool (AttemptTmp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (AttemptConfigOrder);
|
FreePool (AttemptConfigOrder);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2070,7 +2078,7 @@ IScsiGetConfigData (
|
|||||||
&gIScsiConfigGuid,
|
&gIScsiConfigGuid,
|
||||||
&AttemptConfigOrderSize
|
&AttemptConfigOrderSize
|
||||||
);
|
);
|
||||||
if (AttemptConfigOrder == NULL || AttemptConfigOrderSize == 0) {
|
if ((AttemptConfigOrder == NULL) || (AttemptConfigOrderSize == 0)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2091,27 +2099,29 @@ IScsiGetConfigData (
|
|||||||
// Get the normal configuration.
|
// Get the normal configuration.
|
||||||
//
|
//
|
||||||
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
|
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check whether the attempt exists in AttemptConfig.
|
// Check whether the attempt exists in AttemptConfig.
|
||||||
//
|
//
|
||||||
AttemptTmp = IScsiConfigGetAttemptByConfigIndex (AttemptConfigOrder[Index]);
|
AttemptTmp = IScsiConfigGetAttemptByConfigIndex (AttemptConfigOrder[Index]);
|
||||||
if (AttemptTmp != NULL && AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) {
|
if ((AttemptTmp != NULL) && (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (AttemptTmp != NULL && AttemptTmp->SessionConfigData.Enabled != ISCSI_DISABLED) {
|
} else if ((AttemptTmp != NULL) && (AttemptTmp->SessionConfigData.Enabled != ISCSI_DISABLED)) {
|
||||||
//
|
//
|
||||||
// Check the autoconfig path to see whether it should be retried.
|
// Check the autoconfig path to see whether it should be retried.
|
||||||
//
|
//
|
||||||
if (AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG &&
|
if ((AttemptTmp->SessionConfigData.IpMode == IP_MODE_AUTOCONFIG) &&
|
||||||
!AttemptTmp->AutoConfigureSuccess) {
|
!AttemptTmp->AutoConfigureSuccess)
|
||||||
|
{
|
||||||
if (mPrivate->Ipv6Flag &&
|
if (mPrivate->Ipv6Flag &&
|
||||||
AttemptTmp->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6) {
|
(AttemptTmp->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Autoconfigure for IP6 already attempted but failed. Do not try again.
|
// Autoconfigure for IP6 already attempted but failed. Do not try again.
|
||||||
//
|
//
|
||||||
continue;
|
continue;
|
||||||
} else if (!mPrivate->Ipv6Flag &&
|
} else if (!mPrivate->Ipv6Flag &&
|
||||||
AttemptTmp->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4) {
|
(AttemptTmp->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Autoconfigure for IP4 already attempted but failed. Do not try again.
|
// Autoconfigure for IP4 already attempted but failed. Do not try again.
|
||||||
//
|
//
|
||||||
@ -2163,7 +2173,8 @@ IScsiGetConfigData (
|
|||||||
}
|
}
|
||||||
} else if (AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp &&
|
} else if (AttemptTmp->SessionConfigData.InitiatorInfoFromDhcp &&
|
||||||
!AttemptTmp->ValidPath &&
|
!AttemptTmp->ValidPath &&
|
||||||
AttemptTmp->NicIndex == mPrivate->CurrentNic) {
|
(AttemptTmp->NicIndex == mPrivate->CurrentNic))
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// If the attempt associates with the current NIC, we can
|
// If the attempt associates with the current NIC, we can
|
||||||
// get DHCP information for already added, but failed, attempt.
|
// get DHCP information for already added, but failed, attempt.
|
||||||
@ -2200,7 +2211,6 @@ IScsiGetConfigData (
|
|||||||
);
|
);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2228,8 +2238,9 @@ IScsiGetConfigData (
|
|||||||
);
|
);
|
||||||
AsciiStrToUnicodeStrS (AttemptConfigData->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
|
AsciiStrToUnicodeStrS (AttemptConfigData->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
|
||||||
|
|
||||||
if (AttemptConfigData == NULL || AttemptConfigData->Actived == ISCSI_ACTIVE_DISABLED ||
|
if ((AttemptConfigData == NULL) || (AttemptConfigData->Actived == ISCSI_ACTIVE_DISABLED) ||
|
||||||
StrCmp (MacString, AttemptMacString)) {
|
StrCmp (MacString, AttemptMacString))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2252,19 +2263,21 @@ IScsiGetConfigData (
|
|||||||
//
|
//
|
||||||
// Get some information from dhcp server.
|
// Get some information from dhcp server.
|
||||||
//
|
//
|
||||||
if (AttemptConfigData->SessionConfigData.Enabled != ISCSI_DISABLED &&
|
if ((AttemptConfigData->SessionConfigData.Enabled != ISCSI_DISABLED) &&
|
||||||
AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp) {
|
AttemptConfigData->SessionConfigData.InitiatorInfoFromDhcp)
|
||||||
|
{
|
||||||
if (!mPrivate->Ipv6Flag &&
|
if (!mPrivate->Ipv6Flag &&
|
||||||
(AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4 ||
|
((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP4) ||
|
||||||
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4)) {
|
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP4)))
|
||||||
|
{
|
||||||
Status = IScsiDoDhcp (Private->Image, Private->Controller, AttemptConfigData);
|
Status = IScsiDoDhcp (Private->Image, Private->Controller, AttemptConfigData);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
AttemptConfigData->DhcpSuccess = TRUE;
|
AttemptConfigData->DhcpSuccess = TRUE;
|
||||||
}
|
}
|
||||||
} else if (mPrivate->Ipv6Flag &&
|
} else if (mPrivate->Ipv6Flag &&
|
||||||
(AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6 ||
|
((AttemptConfigData->SessionConfigData.IpMode == IP_MODE_IP6) ||
|
||||||
AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6)) {
|
(AttemptConfigData->AutoConfigureMode == IP_MODE_AUTOCONFIG_IP6)))
|
||||||
|
{
|
||||||
Status = IScsiDoDhcp6 (Private->Image, Private->Controller, AttemptConfigData);
|
Status = IScsiDoDhcp6 (Private->Image, Private->Controller, AttemptConfigData);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
AttemptConfigData->DhcpSuccess = TRUE;
|
AttemptConfigData->DhcpSuccess = TRUE;
|
||||||
@ -2377,13 +2390,13 @@ IScsiGetConfigData (
|
|||||||
if (mPrivate->SinglePathCount == 0) {
|
if (mPrivate->SinglePathCount == 0) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPrivate->ValidSinglePathCount = mPrivate->SinglePathCount;
|
mPrivate->ValidSinglePathCount = mPrivate->SinglePathCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the device path of the iSCSI tcp connection and update it.
|
Get the device path of the iSCSI tcp connection and update it.
|
||||||
|
|
||||||
@ -2423,6 +2436,7 @@ IScsiGetTcpConnDevicePath (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Duplicate it.
|
// Duplicate it.
|
||||||
//
|
//
|
||||||
@ -2435,7 +2449,7 @@ IScsiGetTcpConnDevicePath (
|
|||||||
|
|
||||||
while (!IsDevicePathEnd (&DPathNode->DevPath)) {
|
while (!IsDevicePathEnd (&DPathNode->DevPath)) {
|
||||||
if (DevicePathType (&DPathNode->DevPath) == MESSAGING_DEVICE_PATH) {
|
if (DevicePathType (&DPathNode->DevPath) == MESSAGING_DEVICE_PATH) {
|
||||||
if (!Conn->Ipv6Flag && DevicePathSubType (&DPathNode->DevPath) == MSG_IPv4_DP) {
|
if (!Conn->Ipv6Flag && (DevicePathSubType (&DPathNode->DevPath) == MSG_IPv4_DP)) {
|
||||||
DPathNode->Ipv4.LocalPort = 0;
|
DPathNode->Ipv4.LocalPort = 0;
|
||||||
|
|
||||||
DPathNode->Ipv4.StaticIpAddress =
|
DPathNode->Ipv4.StaticIpAddress =
|
||||||
@ -2451,7 +2465,6 @@ IScsiGetTcpConnDevicePath (
|
|||||||
PathLen = DevicePathNodeLength (&DPathNode->Ipv4);
|
PathLen = DevicePathNodeLength (&DPathNode->Ipv4);
|
||||||
|
|
||||||
if (PathLen == IP4_NODE_LEN_NEW_VERSIONS) {
|
if (PathLen == IP4_NODE_LEN_NEW_VERSIONS) {
|
||||||
|
|
||||||
IP4_COPY_ADDRESS (
|
IP4_COPY_ADDRESS (
|
||||||
&DPathNode->Ipv4.GatewayIpAddress,
|
&DPathNode->Ipv4.GatewayIpAddress,
|
||||||
&Session->ConfigData->SessionConfigData.Gateway
|
&Session->ConfigData->SessionConfigData.Gateway
|
||||||
@ -2464,7 +2477,7 @@ IScsiGetTcpConnDevicePath (
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else if (Conn->Ipv6Flag && DevicePathSubType (&DPathNode->DevPath) == MSG_IPv6_DP) {
|
} else if (Conn->Ipv6Flag && (DevicePathSubType (&DPathNode->DevPath) == MSG_IPv6_DP)) {
|
||||||
DPathNode->Ipv6.LocalPort = 0;
|
DPathNode->Ipv6.LocalPort = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2478,13 +2491,10 @@ IScsiGetTcpConnDevicePath (
|
|||||||
PathLen = DevicePathNodeLength (&DPathNode->Ipv6);
|
PathLen = DevicePathNodeLength (&DPathNode->Ipv6);
|
||||||
|
|
||||||
if (PathLen == IP6_NODE_LEN_NEW_VERSIONS ) {
|
if (PathLen == IP6_NODE_LEN_NEW_VERSIONS ) {
|
||||||
|
|
||||||
DPathNode->Ipv6.IpAddressOrigin = 0;
|
DPathNode->Ipv6.IpAddressOrigin = 0;
|
||||||
DPathNode->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;
|
DPathNode->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;
|
||||||
ZeroMem (&DPathNode->Ipv6.GatewayIpAddress, sizeof (EFI_IPv6_ADDRESS));
|
ZeroMem (&DPathNode->Ipv6.GatewayIpAddress, sizeof (EFI_IPv6_ADDRESS));
|
||||||
}
|
} else if (PathLen == IP6_NODE_LEN_OLD_VERSIONS) {
|
||||||
else if (PathLen == IP6_NODE_LEN_OLD_VERSIONS) {
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// StaticIPAddress is a field in old versions of IPv6_DEVICE_PATH, while ignored in new
|
// StaticIPAddress is a field in old versions of IPv6_DEVICE_PATH, while ignored in new
|
||||||
// version. Set StaticIPAddress through its' offset in old IPv6_DEVICE_PATH.
|
// version. Set StaticIPAddress through its' offset in old IPv6_DEVICE_PATH.
|
||||||
@ -2503,7 +2513,6 @@ IScsiGetTcpConnDevicePath (
|
|||||||
return DevicePath;
|
return DevicePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Abort the session when the transition from BS to RT is initiated.
|
Abort the session when the transition from BS to RT is initiated.
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ typedef struct _ISCSI_DRIVER_DATA ISCSI_DRIVER_DATA;
|
|||||||
///
|
///
|
||||||
#define IP6_OLD_IPADDRESS_OFFSET 42
|
#define IP6_OLD_IPADDRESS_OFFSET 42
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
typedef struct _ISCSI_SESSION_CONFIG_NVDATA {
|
typedef struct _ISCSI_SESSION_CONFIG_NVDATA {
|
||||||
UINT16 TargetPort;
|
UINT16 TargetPort;
|
||||||
@ -56,7 +55,6 @@ typedef struct _ISCSI_SESSION_CONFIG_NVDATA {
|
|||||||
|
|
||||||
BOOLEAN DnsMode; // Flag indicate whether the Target address is expressed as URL format.
|
BOOLEAN DnsMode; // Flag indicate whether the Target address is expressed as URL format.
|
||||||
CHAR8 TargetUrl[ISCSI_TARGET_URI_MAX_SIZE];
|
CHAR8 TargetUrl[ISCSI_TARGET_URI_MAX_SIZE];
|
||||||
|
|
||||||
} ISCSI_SESSION_CONFIG_NVDATA;
|
} ISCSI_SESSION_CONFIG_NVDATA;
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
@ -185,7 +183,6 @@ IScsiHexToBin (
|
|||||||
IN CHAR8 *HexStr
|
IN CHAR8 *HexStr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the decimal-constant string or hex-constant string into a numerical value.
|
Convert the decimal-constant string or hex-constant string into a numerical value.
|
||||||
|
|
||||||
@ -295,7 +292,6 @@ IScsiGetNicInfoByIndex (
|
|||||||
IN UINT8 NicIndex
|
IN UINT8 NicIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the NIC's PCI location and return it according to the composited
|
Get the NIC's PCI location and return it according to the composited
|
||||||
format defined in iSCSI Boot Firmware Table.
|
format defined in iSCSI Boot Firmware Table.
|
||||||
@ -469,4 +465,5 @@ IScsiTestManagedDevice (
|
|||||||
IN EFI_HANDLE DriverBindingHandle,
|
IN EFI_HANDLE DriverBindingHandle,
|
||||||
IN EFI_GUID *ProtocolGuid
|
IN EFI_GUID *ProtocolGuid
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,7 +44,6 @@ IScsiDetatchConnection (
|
|||||||
Conn->Session = NULL;
|
Conn->Session = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check the sequence number according to RFC3720.
|
Check the sequence number according to RFC3720.
|
||||||
|
|
||||||
@ -80,7 +79,6 @@ IScsiCheckSN (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update the sequence numbers for the iSCSI command.
|
Update the sequence numbers for the iSCSI command.
|
||||||
|
|
||||||
@ -109,7 +107,6 @@ IScsiUpdateCmdSN (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function does the iSCSI connection login.
|
This function does the iSCSI connection login.
|
||||||
|
|
||||||
@ -171,7 +168,6 @@ IScsiConnLogin (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the iSCSI connection.
|
Reset the iSCSI connection.
|
||||||
|
|
||||||
@ -186,7 +182,6 @@ IScsiConnReset (
|
|||||||
TcpIoReset (&Conn->TcpIo);
|
TcpIoReset (&Conn->TcpIo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a TCP connection for the iSCSI session.
|
Create a TCP connection for the iSCSI session.
|
||||||
|
|
||||||
@ -305,7 +300,6 @@ IScsiCreateConnection (
|
|||||||
return Conn;
|
return Conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroy an iSCSI connection.
|
Destroy an iSCSI connection.
|
||||||
|
|
||||||
@ -390,6 +384,7 @@ IScsiGetIp6NicInfo (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RouteEntry != Ip6ModeData.RouteCount) {
|
if (RouteEntry != Ip6ModeData.RouteCount) {
|
||||||
IP6_COPY_ADDRESS (&NvData->Gateway, &Ip6ModeData.RouteTable[RouteEntry].Gateway);
|
IP6_COPY_ADDRESS (&NvData->Gateway, &Ip6ModeData.RouteTable[RouteEntry].Gateway);
|
||||||
}
|
}
|
||||||
@ -398,18 +393,23 @@ ON_EXIT:
|
|||||||
if (Ip6ModeData.AddressList != NULL) {
|
if (Ip6ModeData.AddressList != NULL) {
|
||||||
FreePool (Ip6ModeData.AddressList);
|
FreePool (Ip6ModeData.AddressList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.GroupTable != NULL) {
|
if (Ip6ModeData.GroupTable != NULL) {
|
||||||
FreePool (Ip6ModeData.GroupTable);
|
FreePool (Ip6ModeData.GroupTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.RouteTable != NULL) {
|
if (Ip6ModeData.RouteTable != NULL) {
|
||||||
FreePool (Ip6ModeData.RouteTable);
|
FreePool (Ip6ModeData.RouteTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.NeighborCache != NULL) {
|
if (Ip6ModeData.NeighborCache != NULL) {
|
||||||
FreePool (Ip6ModeData.NeighborCache);
|
FreePool (Ip6ModeData.NeighborCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.PrefixTable != NULL) {
|
if (Ip6ModeData.PrefixTable != NULL) {
|
||||||
FreePool (Ip6ModeData.PrefixTable);
|
FreePool (Ip6ModeData.PrefixTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ip6ModeData.IcmpTypeList != NULL) {
|
if (Ip6ModeData.IcmpTypeList != NULL) {
|
||||||
FreePool (Ip6ModeData.IcmpTypeList);
|
FreePool (Ip6ModeData.IcmpTypeList);
|
||||||
}
|
}
|
||||||
@ -533,7 +533,6 @@ IScsiSessionLogin (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wait for IPsec negotiation, then try to login the iSCSI session again.
|
Wait for IPsec negotiation, then try to login the iSCSI session again.
|
||||||
|
|
||||||
@ -549,7 +548,6 @@ IScsiSessionReLogin (
|
|||||||
IN ISCSI_SESSION *Session
|
IN ISCSI_SESSION *Session
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STATUS TimerStatus;
|
EFI_STATUS TimerStatus;
|
||||||
EFI_EVENT Timer;
|
EFI_EVENT Timer;
|
||||||
@ -571,20 +569,17 @@ IScsiSessionReLogin (
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
TimerStatus = gBS->CheckEvent (Timer);
|
TimerStatus = gBS->CheckEvent (Timer);
|
||||||
|
|
||||||
if (!EFI_ERROR (TimerStatus)) {
|
if (!EFI_ERROR (TimerStatus)) {
|
||||||
Status = IScsiSessionLogin (Session);
|
Status = IScsiSessionLogin (Session);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (TimerStatus == EFI_NOT_READY);
|
} while (TimerStatus == EFI_NOT_READY);
|
||||||
|
|
||||||
gBS->CloseEvent (Timer);
|
gBS->CloseEvent (Timer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Build and send the iSCSI login request to the iSCSI target according to
|
Build and send the iSCSI login request to the iSCSI target according to
|
||||||
the current login stage.
|
the current login stage.
|
||||||
@ -612,6 +607,7 @@ IScsiSendLoginReq (
|
|||||||
if (Pdu == NULL) {
|
if (Pdu == NULL) {
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Send it to the iSCSI target.
|
// Send it to the iSCSI target.
|
||||||
//
|
//
|
||||||
@ -622,7 +618,6 @@ IScsiSendLoginReq (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Receive and process the iSCSI login response.
|
Receive and process the iSCSI login response.
|
||||||
|
|
||||||
@ -649,6 +644,7 @@ IScsiReceiveLoginRsp (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Pdu != NULL);
|
ASSERT (Pdu != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -661,7 +657,6 @@ IScsiReceiveLoginRsp (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU.
|
Add an iSCSI key-value pair as a string into the data segment of the Login Request PDU.
|
||||||
The DataSegmentLength and the actual size of the net buffer containing this PDU will be
|
The DataSegmentLength and the actual size of the net buffer containing this PDU will be
|
||||||
@ -696,6 +691,7 @@ IScsiAddKeyValuePair (
|
|||||||
if (LoginReq == NULL) {
|
if (LoginReq == NULL) {
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataSegLen = NTOH24 (LoginReq->DataSegmentLength);
|
DataSegLen = NTOH24 (LoginReq->DataSegmentLength);
|
||||||
|
|
||||||
KeyLen = (UINT32)AsciiStrLen (Key);
|
KeyLen = (UINT32)AsciiStrLen (Key);
|
||||||
@ -714,6 +710,7 @@ IScsiAddKeyValuePair (
|
|||||||
if (Data == NULL) {
|
if (Data == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add the key.
|
// Add the key.
|
||||||
//
|
//
|
||||||
@ -739,7 +736,6 @@ IScsiAddKeyValuePair (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prepare the iSCSI login request to be sent according to the current login status.
|
Prepare the iSCSI login request to be sent according to the current login status.
|
||||||
|
|
||||||
@ -771,6 +767,7 @@ IScsiPrepareLoginReq (
|
|||||||
NetbufFree (Nbuf);
|
NetbufFree (Nbuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (LoginReq, sizeof (ISCSI_LOGIN_REQUEST));
|
ZeroMem (LoginReq, sizeof (ISCSI_LOGIN_REQUEST));
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -852,7 +849,6 @@ IScsiPrepareLoginReq (
|
|||||||
return Nbuf;
|
return Nbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the iSCSI Login Response.
|
Process the iSCSI Login Response.
|
||||||
|
|
||||||
@ -888,12 +884,14 @@ IScsiProcessLoginRsp (
|
|||||||
if (LoginRsp == NULL) {
|
if (LoginRsp == NULL) {
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ISCSI_CHECK_OPCODE (LoginRsp, ISCSI_OPCODE_LOGIN_RSP)) {
|
if (!ISCSI_CHECK_OPCODE (LoginRsp, ISCSI_OPCODE_LOGIN_RSP)) {
|
||||||
//
|
//
|
||||||
// It is not a Login Response.
|
// It is not a Login Response.
|
||||||
//
|
//
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the data segment, if any.
|
// Get the data segment, if any.
|
||||||
//
|
//
|
||||||
@ -903,6 +901,7 @@ IScsiProcessLoginRsp (
|
|||||||
} else {
|
} else {
|
||||||
DataSeg = NULL;
|
DataSeg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the status class in the login response PDU.
|
// Check the status class in the login response PDU.
|
||||||
//
|
//
|
||||||
@ -920,6 +919,7 @@ IScsiProcessLoginRsp (
|
|||||||
if (DataSeg == NULL) {
|
if (DataSeg == NULL) {
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Process the TargetAddress key-value strings in the data segment to update the
|
// Process the TargetAddress key-value strings in the data segment to update the
|
||||||
// target address info.
|
// target address info.
|
||||||
@ -928,6 +928,7 @@ IScsiProcessLoginRsp (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Session will be restarted on this error status because the Target is
|
// Session will be restarted on this error status because the Target is
|
||||||
// redirected by this Login Response.
|
// redirected by this Login Response.
|
||||||
@ -940,6 +941,7 @@ IScsiProcessLoginRsp (
|
|||||||
//
|
//
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The status is success; extract the wanted fields from the header segment.
|
// The status is success; extract the wanted fields from the header segment.
|
||||||
//
|
//
|
||||||
@ -957,7 +959,8 @@ IScsiProcessLoginRsp (
|
|||||||
(Transit && (NextStage != Conn->NextStage)) ||
|
(Transit && (NextStage != Conn->NextStage)) ||
|
||||||
(CompareMem (Session->Isid, LoginRsp->Isid, sizeof (LoginRsp->Isid)) != 0) ||
|
(CompareMem (Session->Isid, LoginRsp->Isid, sizeof (LoginRsp->Isid)) != 0) ||
|
||||||
(LoginRsp->InitiatorTaskTag != Session->InitiatorTaskTag)
|
(LoginRsp->InitiatorTaskTag != Session->InitiatorTaskTag)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// A Login Response with the C bit set to 1 MUST have the T bit set to 0.
|
// A Login Response with the C bit set to 1 MUST have the T bit set to 0.
|
||||||
// The CSG in the Login Response MUST be the same with the I-end of this connection.
|
// The CSG in the Login Response MUST be the same with the I-end of this connection.
|
||||||
@ -1003,6 +1006,7 @@ IScsiProcessLoginRsp (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trim off the header segment.
|
// Trim off the header segment.
|
||||||
//
|
//
|
||||||
@ -1033,6 +1037,7 @@ IScsiProcessLoginRsp (
|
|||||||
if (Session->AuthType != ISCSI_AUTH_TYPE_KRB) {
|
if (Session->AuthType != ISCSI_AUTH_TYPE_KRB) {
|
||||||
Status = IScsiCHAPOnRspReceived (Conn);
|
Status = IScsiCHAPOnRspReceived (Conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ISCSI_LOGIN_OPERATIONAL_NEGOTIATION:
|
case ISCSI_LOGIN_OPERATIONAL_NEGOTIATION:
|
||||||
@ -1070,6 +1075,7 @@ IScsiProcessLoginRsp (
|
|||||||
Session->Tsih = NTOHS (LoginRsp->Tsih);
|
Session->Tsih = NTOHS (LoginRsp->Tsih);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Flush the response(s) received.
|
// Flush the response(s) received.
|
||||||
//
|
//
|
||||||
@ -1078,7 +1084,6 @@ IScsiProcessLoginRsp (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Updated the target information according the data received in the iSCSI
|
Updated the target information according the data received in the iSCSI
|
||||||
login response with an target redirection status.
|
login response with an target redirection status.
|
||||||
@ -1159,7 +1164,6 @@ IScsiUpdateTargetAddress (
|
|||||||
|
|
||||||
*TargetAddress = '\0';
|
*TargetAddress = '\0';
|
||||||
TargetAddress++;
|
TargetAddress++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// The domainname of the target is presented in the format of a DNS host name.
|
// The domainname of the target is presented in the format of a DNS host name.
|
||||||
@ -1169,6 +1173,7 @@ IScsiUpdateTargetAddress (
|
|||||||
while ((*TargetAddress != '\0') && (*TargetAddress != ':') && (*TargetAddress != ',')) {
|
while ((*TargetAddress != '\0') && (*TargetAddress != ':') && (*TargetAddress != ',')) {
|
||||||
TargetAddress++;
|
TargetAddress++;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvData->DnsMode = TRUE;
|
NvData->DnsMode = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,6 +1228,7 @@ IScsiUpdateTargetAddress (
|
|||||||
if (AsciiStrSize (IpStr) > sizeof (Session->ConfigData->SessionConfigData.TargetUrl)) {
|
if (AsciiStrSize (IpStr) > sizeof (Session->ConfigData->SessionConfigData.TargetUrl)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (&Session->ConfigData->SessionConfigData.TargetUrl, IpStr, AsciiStrSize (IpStr));
|
CopyMem (&Session->ConfigData->SessionConfigData.TargetUrl, IpStr, AsciiStrSize (IpStr));
|
||||||
} else {
|
} else {
|
||||||
Status = IScsiAsciiStrToIp (
|
Status = IScsiAsciiStrToIp (
|
||||||
@ -1245,7 +1251,6 @@ IScsiUpdateTargetAddress (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The callback function to free the net buffer list.
|
The callback function to free the net buffer list.
|
||||||
|
|
||||||
@ -1264,7 +1269,6 @@ IScsiFreeNbufList (
|
|||||||
FreePool (Arg);
|
FreePool (Arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The callback function called in NetBufFree; it does nothing.
|
The callback function called in NetBufFree; it does nothing.
|
||||||
|
|
||||||
@ -1279,7 +1283,6 @@ IScsiNbufExtFree (
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and
|
Receive an iSCSI response PDU. An iSCSI response PDU contains an iSCSI PDU header and
|
||||||
an optional data segment. The two parts will be put into two blocks of buffers in the
|
an optional data segment. The two parts will be put into two blocks of buffers in the
|
||||||
@ -1344,6 +1347,7 @@ IScsiReceivePdu (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertTailList (NbufList, &PduHdr->List);
|
InsertTailList (NbufList, &PduHdr->List);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1372,6 +1376,7 @@ IScsiReceivePdu (
|
|||||||
//
|
//
|
||||||
goto FORM_PDU;
|
goto FORM_PDU;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the length of the padding bytes of the data segment.
|
// Get the length of the padding bytes of the data segment.
|
||||||
//
|
//
|
||||||
@ -1486,7 +1491,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check and get the result of the parameter negotiation.
|
Check and get the result of the parameter negotiation.
|
||||||
|
|
||||||
@ -1532,6 +1536,7 @@ IScsiCheckOpParams (
|
|||||||
FreePool (Data);
|
FreePool (Data);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// HeaderDigest
|
// HeaderDigest
|
||||||
//
|
//
|
||||||
@ -1549,6 +1554,7 @@ IScsiCheckOpParams (
|
|||||||
} else {
|
} else {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// DataDigest
|
// DataDigest
|
||||||
//
|
//
|
||||||
@ -1566,6 +1572,7 @@ IScsiCheckOpParams (
|
|||||||
} else {
|
} else {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ErrorRecoveryLevel: result function is Minimum.
|
// ErrorRecoveryLevel: result function is Minimum.
|
||||||
//
|
//
|
||||||
@ -1610,6 +1617,7 @@ IScsiCheckOpParams (
|
|||||||
if (Value != NULL) {
|
if (Value != NULL) {
|
||||||
Conn->MaxRecvDataSegmentLength = (UINT32)IScsiNetNtoi (Value);
|
Conn->MaxRecvDataSegmentLength = (UINT32)IScsiNetNtoi (Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// MaxBurstLength: result function is Minimum.
|
// MaxBurstLength: result function is Minimum.
|
||||||
//
|
//
|
||||||
@ -1690,6 +1698,7 @@ IScsiCheckOpParams (
|
|||||||
} else {
|
} else {
|
||||||
Session->DefaultTime2Wait = (UINT32)MAX (Session->DefaultTime2Wait, NumericValue);
|
Session->DefaultTime2Wait = (UINT32)MAX (Session->DefaultTime2Wait, NumericValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// DefaultTime2Retain: result function is Minimum.
|
// DefaultTime2Retain: result function is Minimum.
|
||||||
//
|
//
|
||||||
@ -1706,6 +1715,7 @@ IScsiCheckOpParams (
|
|||||||
} else {
|
} else {
|
||||||
Session->DefaultTime2Retain = (UINT32)MIN (Session->DefaultTime2Retain, NumericValue);
|
Session->DefaultTime2Retain = (UINT32)MIN (Session->DefaultTime2Retain, NumericValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// MaxOutstandingR2T: result function is Minimum.
|
// MaxOutstandingR2T: result function is Minimum.
|
||||||
//
|
//
|
||||||
@ -1728,7 +1738,6 @@ IScsiCheckOpParams (
|
|||||||
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_TARGET_ALIAS);
|
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_TARGET_ALIAS);
|
||||||
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_TARGET_PORTAL_GROUP_TAG);
|
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_TARGET_PORTAL_GROUP_TAG);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remove the key-value that may not needed for result function is OR.
|
// Remove the key-value that may not needed for result function is OR.
|
||||||
//
|
//
|
||||||
@ -1759,7 +1768,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Fill the operational parameters.
|
Fill the operational parameters.
|
||||||
|
|
||||||
@ -1821,7 +1829,6 @@ IScsiFillOpParams (
|
|||||||
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_MAX_OUTSTANDING_R2T, Value);
|
IScsiAddKeyValuePair (Pdu, ISCSI_KEY_MAX_OUTSTANDING_R2T, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pad the iSCSI AHS or data segment to an integer number of 4 byte words.
|
Pad the iSCSI AHS or data segment to an integer number of 4 byte words.
|
||||||
|
|
||||||
@ -1855,7 +1862,6 @@ IScsiPadSegment (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Build a key-value list from the data segment.
|
Build a key-value list from the data segment.
|
||||||
|
|
||||||
@ -1909,7 +1915,7 @@ IScsiBuildKeyValueList (
|
|||||||
|
|
||||||
KeyValuePair->Value = Data;
|
KeyValuePair->Value = Data;
|
||||||
|
|
||||||
InsertTailList (ListHead, &KeyValuePair->List);;
|
InsertTailList (ListHead, &KeyValuePair->List);
|
||||||
|
|
||||||
Data += AsciiStrLen (KeyValuePair->Value) + 1;
|
Data += AsciiStrLen (KeyValuePair->Value) + 1;
|
||||||
Len -= (UINT32)AsciiStrLen (KeyValuePair->Value) + 1;
|
Len -= (UINT32)AsciiStrLen (KeyValuePair->Value) + 1;
|
||||||
@ -1924,7 +1930,6 @@ ON_ERROR:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the value string by the key name from the key-value list. If found,
|
Get the value string by the key name from the key-value list. If found,
|
||||||
the key-value entry will be removed from the list.
|
the key-value entry will be removed from the list.
|
||||||
@ -1963,7 +1968,6 @@ IScsiGetValueByKeyFromList (
|
|||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free the key-value list.
|
Free the key-value list.
|
||||||
|
|
||||||
@ -1988,7 +1992,6 @@ IScsiFreeKeyValueList (
|
|||||||
FreePool (KeyValueList);
|
FreePool (KeyValueList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Normalize the iSCSI name according to RFC.
|
Normalize the iSCSI name according to RFC.
|
||||||
|
|
||||||
@ -2020,7 +2023,8 @@ IScsiNormalizeName (
|
|||||||
(Name[Index] != '-') &&
|
(Name[Index] != '-') &&
|
||||||
(Name[Index] != '.') &&
|
(Name[Index] != '.') &&
|
||||||
(Name[Index] != ':')
|
(Name[Index] != ':')
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// ASCII dash, dot, colon lower-case characters and digit characters
|
// ASCII dash, dot, colon lower-case characters and digit characters
|
||||||
// are allowed.
|
// are allowed.
|
||||||
@ -2039,7 +2043,6 @@ IScsiNormalizeName (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an iSCSI task control block.
|
Create an iSCSI task control block.
|
||||||
|
|
||||||
@ -2093,7 +2096,6 @@ IScsiNewTcb (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Delete the tcb from the connection and destroy it.
|
Delete the tcb from the connection and destroy it.
|
||||||
|
|
||||||
@ -2110,7 +2112,6 @@ IScsiDelTcb (
|
|||||||
FreePool (Tcb);
|
FreePool (Tcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a data segment, pad it, and calculate the CRC if needed.
|
Create a data segment, pad it, and calculate the CRC if needed.
|
||||||
|
|
||||||
@ -2151,7 +2152,6 @@ IScsiNewDataSegment (
|
|||||||
return DataSeg;
|
return DataSeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a iSCSI SCSI command PDU to encapsulate the command issued
|
Create a iSCSI SCSI command PDU to encapsulate the command issued
|
||||||
by SCSI through the EXT SCSI PASS THRU Protocol.
|
by SCSI through the EXT SCSI PASS THRU Protocol.
|
||||||
@ -2211,6 +2211,7 @@ IScsiNewScsiCmdPdu (
|
|||||||
NetbufFree (PduHeader);
|
NetbufFree (PduHeader);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Header = (ISCSI_ADDITIONAL_HEADER *)(ScsiCmd + 1);
|
Header = (ISCSI_ADDITIONAL_HEADER *)(ScsiCmd + 1);
|
||||||
|
|
||||||
ZeroMem (ScsiCmd, Length);
|
ZeroMem (ScsiCmd, Length);
|
||||||
@ -2314,7 +2315,8 @@ IScsiNewScsiCmdPdu (
|
|||||||
if (Session->InitialR2T ||
|
if (Session->InitialR2T ||
|
||||||
(ImmediateDataLen == Session->FirstBurstLength) ||
|
(ImmediateDataLen == Session->FirstBurstLength) ||
|
||||||
(ImmediateDataLen == Packet->OutTransferLength)
|
(ImmediateDataLen == Packet->OutTransferLength)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Unsolicited data out sequence is not allowed,
|
// Unsolicited data out sequence is not allowed,
|
||||||
// or FirstBustLength data is already sent out by immediate data,
|
// or FirstBustLength data is already sent out by immediate data,
|
||||||
@ -2330,7 +2332,6 @@ ON_EXIT:
|
|||||||
return Pdu;
|
return Pdu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new iSCSI SCSI Data Out PDU.
|
Create a new iSCSI SCSI Data Out PDU.
|
||||||
|
|
||||||
@ -2375,6 +2376,7 @@ IScsiNewDataOutPdu (
|
|||||||
FreePool (NbufList);
|
FreePool (NbufList);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Insert the BHS into the buffer list.
|
// Insert the BHS into the buffer list.
|
||||||
//
|
//
|
||||||
@ -2385,6 +2387,7 @@ IScsiNewDataOutPdu (
|
|||||||
IScsiFreeNbufList (NbufList);
|
IScsiFreeNbufList (NbufList);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XferContext = &Tcb->XferContext;
|
XferContext = &Tcb->XferContext;
|
||||||
|
|
||||||
ZeroMem (DataOutHdr, sizeof (ISCSI_SCSI_DATA_OUT));
|
ZeroMem (DataOutHdr, sizeof (ISCSI_SCSI_DATA_OUT));
|
||||||
@ -2404,6 +2407,7 @@ IScsiNewDataOutPdu (
|
|||||||
if (XferContext->TargetTransferTag != ISCSI_RESERVED_TAG) {
|
if (XferContext->TargetTransferTag != ISCSI_RESERVED_TAG) {
|
||||||
CopyMem (&DataOutHdr->Lun, &Lun, sizeof (DataOutHdr->Lun));
|
CopyMem (&DataOutHdr->Lun, &Lun, sizeof (DataOutHdr->Lun));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build the data segment for this Data Out PDU.
|
// Build the data segment for this Data Out PDU.
|
||||||
//
|
//
|
||||||
@ -2412,6 +2416,7 @@ IScsiNewDataOutPdu (
|
|||||||
IScsiFreeNbufList (NbufList);
|
IScsiFreeNbufList (NbufList);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Put the data segment into the buffer list and combine it with the BHS
|
// Put the data segment into the buffer list and combine it with the BHS
|
||||||
// into a full Data Out PDU.
|
// into a full Data Out PDU.
|
||||||
@ -2425,7 +2430,6 @@ IScsiNewDataOutPdu (
|
|||||||
return Pdu;
|
return Pdu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generate a consecutive sequence of iSCSI SCSI Data Out PDUs.
|
Generate a consecutive sequence of iSCSI SCSI Data Out PDUs.
|
||||||
|
|
||||||
@ -2491,6 +2495,7 @@ IScsiGenerateDataOutPduSequence (
|
|||||||
XferContext->DesiredLength -= DataLen;
|
XferContext->DesiredLength -= DataLen;
|
||||||
DataSN++;
|
DataSN++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the F bit for the last data out PDU in this sequence.
|
// Set the F bit for the last data out PDU in this sequence.
|
||||||
//
|
//
|
||||||
@ -2560,7 +2565,6 @@ IScsiSendDataOutPduSequence (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the received iSCSI SCSI Data In PDU.
|
Process the received iSCSI SCSI Data In PDU.
|
||||||
|
|
||||||
@ -2606,6 +2610,7 @@ IScsiOnDataInRcvd (
|
|||||||
if (DataInHdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) {
|
if (DataInHdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) {
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the command related sequence numbers.
|
// Update the command related sequence numbers.
|
||||||
//
|
//
|
||||||
@ -2627,6 +2632,7 @@ IScsiOnDataInRcvd (
|
|||||||
//
|
//
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// S bit is on, the StatSN is valid.
|
// S bit is on, the StatSN is valid.
|
||||||
//
|
//
|
||||||
@ -2651,7 +2657,6 @@ IScsiOnDataInRcvd (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the received iSCSI R2T PDU.
|
Process the received iSCSI R2T PDU.
|
||||||
|
|
||||||
@ -2691,8 +2696,9 @@ IScsiOnR2TRcvd (
|
|||||||
R2THdr->DesiredDataTransferLength = NTOHL (R2THdr->DesiredDataTransferLength);
|
R2THdr->DesiredDataTransferLength = NTOHL (R2THdr->DesiredDataTransferLength);
|
||||||
|
|
||||||
if ((R2THdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) || !ISCSI_SEQ_EQ (R2THdr->StatSN, Tcb->Conn->ExpStatSN)) {
|
if ((R2THdr->InitiatorTaskTag != Tcb->InitiatorTaskTag) || !ISCSI_SEQ_EQ (R2THdr->StatSN, Tcb->Conn->ExpStatSN)) {
|
||||||
return EFI_PROTOCOL_ERROR;;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the sequence number.
|
// Check the sequence number.
|
||||||
//
|
//
|
||||||
@ -2708,9 +2714,11 @@ IScsiOnR2TRcvd (
|
|||||||
|
|
||||||
if (((XferContext->Offset + XferContext->DesiredLength) > Packet->OutTransferLength) ||
|
if (((XferContext->Offset + XferContext->DesiredLength) > Packet->OutTransferLength) ||
|
||||||
(XferContext->DesiredLength > Tcb->Conn->Session->MaxBurstLength)
|
(XferContext->DesiredLength > Tcb->Conn->Session->MaxBurstLength)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Send the data solicited by this R2T.
|
// Send the data solicited by this R2T.
|
||||||
//
|
//
|
||||||
@ -2720,7 +2728,6 @@ IScsiOnR2TRcvd (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the received iSCSI SCSI Response PDU.
|
Process the received iSCSI SCSI Response PDU.
|
||||||
|
|
||||||
@ -2778,7 +2785,8 @@ IScsiOnScsiRspRcvd (
|
|||||||
|
|
||||||
if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW | SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW) ||
|
if (ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_BI_READ_OVERFLOW | SCSI_RSP_PDU_FLAG_BI_READ_UNDERFLOW) ||
|
||||||
ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_OVERFLOW | SCSI_RSP_PDU_FLAG_UNDERFLOW)
|
ISCSI_FLAG_ON (ScsiRspHdr, SCSI_RSP_PDU_FLAG_OVERFLOW | SCSI_RSP_PDU_FLAG_UNDERFLOW)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
return EFI_PROTOCOL_ERROR;
|
return EFI_PROTOCOL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2829,7 +2837,6 @@ IScsiOnScsiRspRcvd (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the received NOP In PDU.
|
Process the received NOP In PDU.
|
||||||
|
|
||||||
@ -2875,7 +2882,6 @@ IScsiOnNopInRcvd (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.
|
Execute the SCSI command issued through the EXT SCSI PASS THRU protocol.
|
||||||
|
|
||||||
@ -2942,6 +2948,7 @@ IScsiExecuteScsiCommand (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Encapsulate the SCSI request packet into an iSCSI SCSI Command PDU.
|
// Encapsulate the SCSI request packet into an iSCSI SCSI Command PDU.
|
||||||
//
|
//
|
||||||
@ -2958,6 +2965,7 @@ IScsiExecuteScsiCommand (
|
|||||||
NetbufFree (Pdu);
|
NetbufFree (Pdu);
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
XferContext->Offset = ISCSI_GET_DATASEG_LEN (PduHdr);
|
XferContext->Offset = ISCSI_GET_DATASEG_LEN (PduHdr);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2974,7 +2982,8 @@ IScsiExecuteScsiCommand (
|
|||||||
if (!Session->InitialR2T &&
|
if (!Session->InitialR2T &&
|
||||||
(XferContext->Offset < Session->FirstBurstLength) &&
|
(XferContext->Offset < Session->FirstBurstLength) &&
|
||||||
(XferContext->Offset < Packet->OutTransferLength)
|
(XferContext->Offset < Packet->OutTransferLength)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Unsolicited Data-Out sequence is allowed. There is remaining SCSI
|
// Unsolicited Data-Out sequence is allowed. There is remaining SCSI
|
||||||
// OUT data, and the limit of FirstBurstLength is not reached.
|
// OUT data, and the limit of FirstBurstLength is not reached.
|
||||||
@ -3022,6 +3031,7 @@ IScsiExecuteScsiCommand (
|
|||||||
NetbufFree (Pdu);
|
NetbufFree (Pdu);
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ISCSI_GET_OPCODE (PduHdr)) {
|
switch (ISCSI_GET_OPCODE (PduHdr)) {
|
||||||
case ISCSI_OPCODE_SCSI_DATA_IN:
|
case ISCSI_OPCODE_SCSI_DATA_IN:
|
||||||
Status = IScsiOnDataInRcvd (Pdu, Tcb, Packet);
|
Status = IScsiOnDataInRcvd (Pdu, Tcb, Packet);
|
||||||
@ -3072,7 +3082,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reinstate the session on some error.
|
Reinstate the session on some error.
|
||||||
|
|
||||||
@ -3105,7 +3114,6 @@ IScsiSessionReinstatement (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize some session parameters before login.
|
Initialize some session parameters before login.
|
||||||
|
|
||||||
@ -3147,7 +3155,6 @@ IScsiSessionInit (
|
|||||||
Session->ErrorRecoveryLevel = 0;
|
Session->ErrorRecoveryLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Abort the iSCSI session. That is, reset all the connection(s), and free the
|
Abort the iSCSI session. That is, reset all the connection(s), and free the
|
||||||
resources.
|
resources.
|
||||||
|
@ -29,4 +29,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
extern EFI_GUID gEdkiiHttpTlsCipherListGuid;
|
extern EFI_GUID gEdkiiHttpTlsCipherListGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -17,4 +17,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
extern EFI_GUID gTlsAuthConfigGuid;
|
extern EFI_GUID gTlsAuthConfigGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -21,4 +21,3 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
extern EFI_GUID gEfiTlsCaCertificateGuid;
|
extern EFI_GUID gEfiTlsCaCertificateGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -325,4 +325,5 @@ HttpIoSendChunkedTransfer (
|
|||||||
IN HTTP_IO_SEND_CHUNK_PROCESS *SendChunkProcess,
|
IN HTTP_IO_SEND_CHUNK_PROCESS *SendChunkProcess,
|
||||||
IN EFI_HTTP_MESSAGE *RequestMessage
|
IN EFI_HTTP_MESSAGE *RequestMessage
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <Protocol/Http.h>
|
#include <Protocol/Http.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Decode a percent-encoded URI component to the ASCII character.
|
Decode a percent-encoded URI component to the ASCII character.
|
||||||
|
|
||||||
@ -339,7 +338,6 @@ HttpFreeMsgParser (
|
|||||||
IN VOID *MsgParser
|
IN VOID *MsgParser
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find a specified header field according to the field name.
|
Find a specified header field according to the field name.
|
||||||
|
|
||||||
@ -485,7 +483,6 @@ typedef struct {
|
|||||||
EFI_HTTP_HEADER *Headers;
|
EFI_HTTP_HEADER *Headers;
|
||||||
} HTTP_IO_HEADER;
|
} HTTP_IO_HEADER;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a HTTP_IO_HEADER to hold the HTTP header items.
|
Create a HTTP_IO_HEADER to hold the HTTP header items.
|
||||||
|
|
||||||
@ -531,4 +528,3 @@ HttpIoSetHeader (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -71,11 +71,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
**/
|
**/
|
||||||
#define NET_PROTO_HDR(Buf, Type) ((Type *) ((Buf)->BlockOp[0].Head))
|
#define NET_PROTO_HDR(Buf, Type) ((Type *) ((Buf)->BlockOp[0].Head))
|
||||||
|
|
||||||
|
|
||||||
extern EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData;
|
extern EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData;
|
||||||
extern EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData;
|
extern EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// This error will be delivered to the
|
/// This error will be delivered to the
|
||||||
/// listening transportation layer protocol
|
/// listening transportation layer protocol
|
||||||
@ -604,4 +602,3 @@ IpIoRefreshNeighbor (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ typedef UINT32 IP4_ADDR;
|
|||||||
typedef UINT32 TCP_SEQNO;
|
typedef UINT32 TCP_SEQNO;
|
||||||
typedef UINT16 TCP_PORTNO;
|
typedef UINT16 TCP_PORTNO;
|
||||||
|
|
||||||
|
|
||||||
#define NET_ETHER_ADDR_LEN 6
|
#define NET_ETHER_ADDR_LEN 6
|
||||||
#define NET_IFTYPE_ETHERNET 0x01
|
#define NET_IFTYPE_ETHERNET 0x01
|
||||||
|
|
||||||
@ -94,7 +93,6 @@ typedef UINT16 TCP_PORTNO;
|
|||||||
//
|
//
|
||||||
#define MEDIA_STATE_DETECT_TIME_INTERVAL 1000000U
|
#define MEDIA_STATE_DETECT_TIME_INTERVAL 1000000U
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -141,7 +139,6 @@ typedef struct {
|
|||||||
IP4_ADDR Dst;
|
IP4_ADDR Dst;
|
||||||
} IP4_HEAD;
|
} IP4_HEAD;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ICMP head definition. Each ICMP message is categorized as either an error
|
// ICMP head definition. Each ICMP message is categorized as either an error
|
||||||
// message or query message. Two message types have their own head format.
|
// message or query message. Two message types have their own head format.
|
||||||
@ -357,7 +354,6 @@ NetDebugOutput (
|
|||||||
IN UINT8 *Message
|
IN UINT8 *Message
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the length of the mask.
|
Return the length of the mask.
|
||||||
|
|
||||||
@ -454,7 +450,6 @@ NetIp6IsValidUnicast (
|
|||||||
IN EFI_IPv6_ADDRESS *Ip6
|
IN EFI_IPv6_ADDRESS *Ip6
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether the incoming Ipv6 address is the unspecified address or not.
|
Check whether the incoming Ipv6 address is the unspecified address or not.
|
||||||
|
|
||||||
@ -533,7 +528,6 @@ Ip6Swap128 (
|
|||||||
|
|
||||||
extern IP4_ADDR gIp4AllMasks[IP4_MASK_NUM];
|
extern IP4_ADDR gIp4AllMasks[IP4_MASK_NUM];
|
||||||
|
|
||||||
|
|
||||||
extern EFI_IPv4_ADDRESS mZeroIp4Addr;
|
extern EFI_IPv4_ADDRESS mZeroIp4Addr;
|
||||||
|
|
||||||
#define NET_IS_DIGIT(Ch) (('0' <= (Ch)) && ((Ch) <= '9'))
|
#define NET_IS_DIGIT(Ch) (('0' <= (Ch)) && ((Ch) <= '9'))
|
||||||
@ -601,7 +595,6 @@ NetRandomInitSeed (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#define NET_LIST_USER_STRUCT(Entry, Type, Field) \
|
#define NET_LIST_USER_STRUCT(Entry, Type, Field) \
|
||||||
BASE_CR(Entry, Type, Field)
|
BASE_CR(Entry, Type, Field)
|
||||||
|
|
||||||
@ -635,7 +628,6 @@ NetRandomInitSeed (
|
|||||||
#define NET_LIST_TAIL(ListHead, Type, Field) \
|
#define NET_LIST_TAIL(ListHead, Type, Field) \
|
||||||
NET_LIST_USER_STRUCT((ListHead)->BackLink, Type, Field)
|
NET_LIST_USER_STRUCT((ListHead)->BackLink, Type, Field)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove the first node entry on the list, and return the removed node entry.
|
Remove the first node entry on the list, and return the removed node entry.
|
||||||
|
|
||||||
@ -1064,10 +1056,10 @@ NetMapIterate (
|
|||||||
IN VOID *Arg OPTIONAL
|
IN VOID *Arg OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Helper functions to implement driver binding and service binding protocols.
|
// Helper functions to implement driver binding and service binding protocols.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a child of the service that is identified by ServiceBindingGuid.
|
Create a child of the service that is identified by ServiceBindingGuid.
|
||||||
|
|
||||||
@ -1310,7 +1302,6 @@ NetLibDetectMediaWaitTimeout (
|
|||||||
OUT EFI_STATUS *MediaState
|
OUT EFI_STATUS *MediaState
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an IPv4 device path node.
|
Create an IPv4 device path node.
|
||||||
|
|
||||||
@ -1377,7 +1368,6 @@ NetLibCreateIPv6DPathNode (
|
|||||||
IN UINT16 Protocol
|
IN UINT16 Protocol
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the UNDI/SNP handle from controller and protocol GUID.
|
Find the UNDI/SNP handle from controller and protocol GUID.
|
||||||
|
|
||||||
@ -1542,7 +1532,6 @@ NetLibIp6ToStr (
|
|||||||
#define NET_VECTOR_SIGNATURE SIGNATURE_32 ('n', 'v', 'e', 'c')
|
#define NET_VECTOR_SIGNATURE SIGNATURE_32 ('n', 'v', 'e', 'c')
|
||||||
#define NET_QUE_SIGNATURE SIGNATURE_32 ('n', 'b', 'q', 'u')
|
#define NET_QUE_SIGNATURE SIGNATURE_32 ('n', 'b', 'q', 'u')
|
||||||
|
|
||||||
|
|
||||||
#define NET_PROTO_DATA 64 // Opaque buffer for protocols
|
#define NET_PROTO_DATA 64 // Opaque buffer for protocols
|
||||||
#define NET_BUF_HEAD 1 // Trim or allocate space from head
|
#define NET_BUF_HEAD 1 // Trim or allocate space from head
|
||||||
#define NET_BUF_TAIL 0 // Trim or allocate space from tail
|
#define NET_BUF_TAIL 0 // Trim or allocate space from tail
|
||||||
@ -2104,7 +2093,6 @@ NetbufQueTrim (
|
|||||||
IN UINT32 Len
|
IN UINT32 Len
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush the net buffer queue.
|
Flush the net buffer queue.
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#ifndef _TCP_IO_H_
|
#ifndef _TCP_IO_H_
|
||||||
#define _TCP_IO_H_
|
#define _TCP_IO_H_
|
||||||
|
|
||||||
|
|
||||||
#include <Protocol/Tcp4.h>
|
#include <Protocol/Tcp4.h>
|
||||||
#include <Protocol/Tcp6.h>
|
#include <Protocol/Tcp6.h>
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
///
|
///
|
||||||
#define TCP_GET_MAPPING_TIMEOUT 100000000U
|
#define TCP_GET_MAPPING_TIMEOUT 100000000U
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_IPv4_ADDRESS LocalIp;
|
EFI_IPv4_ADDRESS LocalIp;
|
||||||
EFI_IPv4_ADDRESS SubnetMask;
|
EFI_IPv4_ADDRESS SubnetMask;
|
||||||
@ -73,7 +71,6 @@ typedef union {
|
|||||||
EFI_TCP6_LISTEN_TOKEN Tcp6Token;
|
EFI_TCP6_LISTEN_TOKEN Tcp6Token;
|
||||||
} TCP_IO_LISTEN_TOKEN;
|
} TCP_IO_LISTEN_TOKEN;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 TcpVersion;
|
UINT8 TcpVersion;
|
||||||
EFI_HANDLE Image;
|
EFI_HANDLE Image;
|
||||||
@ -244,4 +241,3 @@ TcpIoReceive (
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -85,8 +85,6 @@ typedef struct {
|
|||||||
UDP_COMPLETION_TOKEN Token;
|
UDP_COMPLETION_TOKEN Token;
|
||||||
} UDP_RX_TOKEN;
|
} UDP_RX_TOKEN;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// This structure is used internally by UdpIo Library.
|
/// This structure is used internally by UdpIo Library.
|
||||||
///
|
///
|
||||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __DPC_H__
|
#ifndef __DPC_H__
|
||||||
#define __DPC_H__
|
#define __DPC_H__
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
//
|
//
|
||||||
typedef struct _EFI_DPC_PROTOCOL EFI_DPC_PROTOCOL;
|
typedef struct _EFI_DPC_PROTOCOL EFI_DPC_PROTOCOL;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Invoke a Deferred Procedure Call.
|
Invoke a Deferred Procedure Call.
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
Retrieves a Unicode string that is the user readable name of the driver.
|
||||||
|
|
||||||
@ -57,7 +58,6 @@ Ip4ComponentNameGetDriverName (
|
|||||||
OUT CHAR16 **DriverName
|
OUT CHAR16 **DriverName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
Retrieves a Unicode string that is the user readable name of the controller
|
||||||
that is being managed by a driver.
|
that is being managed by a driver.
|
||||||
@ -136,7 +136,6 @@ Ip4ComponentNameGetControllerName (
|
|||||||
OUT CHAR16 **ControllerName
|
OUT CHAR16 **ControllerName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Protocol
|
// EFI Component Name Protocol
|
||||||
//
|
//
|
||||||
@ -155,7 +154,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIp4ComponentName2 =
|
|||||||
"en"
|
"en"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIp4DriverNameTable[] = {
|
||||||
{
|
{
|
||||||
"eng;en",
|
"eng;en",
|
||||||
@ -223,7 +221,6 @@ Ip4ComponentNameGetDriverName (
|
|||||||
DriverName,
|
DriverName,
|
||||||
(BOOLEAN)(This == &gIp4ComponentName)
|
(BOOLEAN)(This == &gIp4ComponentName)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,7 +258,9 @@ UpdateName (
|
|||||||
if (!Ip4ModeData.IsStarted || !Ip4ModeData.IsConfigured) {
|
if (!Ip4ModeData.IsStarted || !Ip4ModeData.IsConfigured) {
|
||||||
UnicodeSPrint (HandleName, sizeof (HandleName), L"IPv4 (Not started)");
|
UnicodeSPrint (HandleName, sizeof (HandleName), L"IPv4 (Not started)");
|
||||||
} else {
|
} else {
|
||||||
UnicodeSPrint (HandleName, sizeof (HandleName),
|
UnicodeSPrint (
|
||||||
|
HandleName,
|
||||||
|
sizeof (HandleName),
|
||||||
L"IPv4 (SrcIP=%d.%d.%d.%d)",
|
L"IPv4 (SrcIP=%d.%d.%d.%d)",
|
||||||
Ip4ModeData.ConfigData.StationAddress.Addr[0],
|
Ip4ModeData.ConfigData.StationAddress.Addr[0],
|
||||||
Ip4ModeData.ConfigData.StationAddress.Addr[1],
|
Ip4ModeData.ConfigData.StationAddress.Addr[1],
|
||||||
@ -274,6 +273,7 @@ UpdateName (
|
|||||||
FreeUnicodeStringTable (gIp4ControllerNameTable);
|
FreeUnicodeStringTable (gIp4ControllerNameTable);
|
||||||
gIp4ControllerNameTable = NULL;
|
gIp4ControllerNameTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = AddUnicodeString2 (
|
Status = AddUnicodeString2 (
|
||||||
"eng",
|
"eng",
|
||||||
gIp4ComponentName.SupportedLanguages,
|
gIp4ComponentName.SupportedLanguages,
|
||||||
@ -425,4 +425,3 @@ Ip4ComponentNameGetControllerName (
|
|||||||
(BOOLEAN)(This == &gIp4ComponentName)
|
(BOOLEAN)(This == &gIp4ComponentName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Ip4Impl.h"
|
#include "Ip4Impl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the cast type (Unicast/Broadcast) specific to an
|
Return the cast type (Unicast/Broadcast) specific to an
|
||||||
interface. All the addresses are host byte ordered.
|
interface. All the addresses are host byte ordered.
|
||||||
@ -31,19 +30,15 @@ Ip4GetNetCast (
|
|||||||
{
|
{
|
||||||
if (IpAddr == IpIf->Ip) {
|
if (IpAddr == IpIf->Ip) {
|
||||||
return IP4_LOCAL_HOST;
|
return IP4_LOCAL_HOST;
|
||||||
|
|
||||||
} else if (IpAddr == IpIf->SubnetBrdcast) {
|
} else if (IpAddr == IpIf->SubnetBrdcast) {
|
||||||
return IP4_SUBNET_BROADCAST;
|
return IP4_SUBNET_BROADCAST;
|
||||||
|
|
||||||
} else if (IpAddr == IpIf->NetBrdcast) {
|
} else if (IpAddr == IpIf->NetBrdcast) {
|
||||||
return IP4_NET_BROADCAST;
|
return IP4_NET_BROADCAST;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the cast type of the packet related to the local host.
|
Find the cast type of the packet related to the local host.
|
||||||
This isn't the same as link layer cast type. For example, DHCP
|
This isn't the same as link layer cast type. For example, DHCP
|
||||||
@ -106,18 +101,16 @@ Ip4GetHostCast (
|
|||||||
if (Dst == IP4_ALLONE_ADDRESS) {
|
if (Dst == IP4_ALLONE_ADDRESS) {
|
||||||
IpIf = Ip4FindNet (IpSb, Src);
|
IpIf = Ip4FindNet (IpSb, Src);
|
||||||
|
|
||||||
if (IpIf != NULL && !IP4_IS_BROADCAST (Ip4GetNetCast (Src, IpIf))) {
|
if ((IpIf != NULL) && !IP4_IS_BROADCAST (Ip4GetNetCast (Src, IpIf))) {
|
||||||
return IP4_LOCAL_BROADCAST;
|
return IP4_LOCAL_BROADCAST;
|
||||||
}
|
}
|
||||||
|
} else if (IP4_IS_MULTICAST (Dst) && (Ip4FindGroup (&IpSb->IgmpCtrl, Dst) != NULL)) {
|
||||||
} else if (IP4_IS_MULTICAST (Dst) && Ip4FindGroup (&IpSb->IgmpCtrl, Dst) != NULL) {
|
|
||||||
return IP4_MULTICAST;
|
return IP4_MULTICAST;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Type;
|
return Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find an interface whose configured IP address is Ip.
|
Find an interface whose configured IP address is Ip.
|
||||||
|
|
||||||
@ -147,7 +140,6 @@ Ip4FindInterface (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find an interface that Ip is on that connected network.
|
Find an interface that Ip is on that connected network.
|
||||||
|
|
||||||
@ -177,7 +169,6 @@ Ip4FindNet (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find an interface of the service with the same Ip/Netmask pair.
|
Find an interface of the service with the same Ip/Netmask pair.
|
||||||
|
|
||||||
@ -209,7 +200,6 @@ Ip4FindStationAddress (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the MAC address for a multicast IP address. Call
|
Get the MAC address for a multicast IP address. Call
|
||||||
Mnp's McastIpToMac to find the MAC address in stead of
|
Mnp's McastIpToMac to find the MAC address in stead of
|
||||||
@ -237,7 +227,6 @@ Ip4GetMulticastMac (
|
|||||||
return Mnp->McastIpToMac (Mnp, FALSE, &EfiIp, Mac);
|
return Mnp->McastIpToMac (Mnp, FALSE, &EfiIp, Mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the multibyte field in IP header's byter order.
|
Convert the multibyte field in IP header's byter order.
|
||||||
In spite of its name, it can also be used to convert from
|
In spite of its name, it can also be used to convert from
|
||||||
@ -262,7 +251,6 @@ Ip4NtohHead (
|
|||||||
return Head;
|
return Head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Validate that Ip/Netmask pair is OK to be used as station
|
Validate that Ip/Netmask pair is OK to be used as station
|
||||||
address. Only continuous netmasks are supported. and check
|
address. Only continuous netmasks are supported. and check
|
||||||
|
@ -195,7 +195,6 @@ Ip4NtohHead (
|
|||||||
IN IP4_HEAD *Head
|
IN IP4_HEAD *Head
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Validate that Ip/Netmask pair is OK to be used as station
|
Validate that Ip/Netmask pair is OK to be used as station
|
||||||
address. Only continuous netmasks are supported. and check
|
address. Only continuous netmasks are supported. and check
|
||||||
|
@ -136,7 +136,7 @@ Ip4Config2OnPolicyChanged (
|
|||||||
IpSb->DefaultRouteTable = RouteTable;
|
IpSb->DefaultRouteTable = RouteTable;
|
||||||
Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
|
Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
|
||||||
|
|
||||||
if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State == IP4_SERVICE_STARTED) {
|
if ((IpSb->State == IP4_SERVICE_CONFIGED) || (IpSb->State == IP4_SERVICE_STARTED)) {
|
||||||
IpSb->State = IP4_SERVICE_UNSTARTED;
|
IpSb->State = IP4_SERVICE_UNSTARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,6 @@ Ip4Config2OnPolicyChanged (
|
|||||||
if (NewPolicy == Ip4Config2PolicyDhcp) {
|
if (NewPolicy == Ip4Config2PolicyDhcp) {
|
||||||
Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);
|
Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,7 +226,7 @@ Ip4Config2ReadConfigData (
|
|||||||
&VarSize,
|
&VarSize,
|
||||||
Variable
|
Variable
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || (UINT16) (~NetblockChecksum ((UINT8 *) Variable, (UINT32) VarSize)) != 0) {
|
if (EFI_ERROR (Status) || ((UINT16)(~NetblockChecksum ((UINT8 *)Variable, (UINT32)VarSize)) != 0)) {
|
||||||
//
|
//
|
||||||
// GetVariable still error or the variable is corrupted.
|
// GetVariable still error or the variable is corrupted.
|
||||||
// Fall back to the default value.
|
// Fall back to the default value.
|
||||||
@ -249,15 +248,14 @@ Ip4Config2ReadConfigData (
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (Index = 0; Index < Variable->DataRecordCount; Index++) {
|
for (Index = 0; Index < Variable->DataRecordCount; Index++) {
|
||||||
|
|
||||||
CopyMem (&DataRecord, &Variable->DataRecord[Index], sizeof (DataRecord));
|
CopyMem (&DataRecord, &Variable->DataRecord[Index], sizeof (DataRecord));
|
||||||
|
|
||||||
DataItem = &Instance->DataItem[DataRecord.DataType];
|
DataItem = &Instance->DataItem[DataRecord.DataType];
|
||||||
if (DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED) &&
|
if (DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED) &&
|
||||||
(DataItem->DataSize != DataRecord.DataSize)
|
(DataItem->DataSize != DataRecord.DataSize)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Perhaps a corrupted data record...
|
// Perhaps a corrupted data record...
|
||||||
//
|
//
|
||||||
@ -318,10 +316,8 @@ Ip4Config2WriteConfigData (
|
|||||||
VarSize = sizeof (IP4_CONFIG2_VARIABLE) - sizeof (IP4_CONFIG2_DATA_RECORD);
|
VarSize = sizeof (IP4_CONFIG2_VARIABLE) - sizeof (IP4_CONFIG2_DATA_RECORD);
|
||||||
|
|
||||||
for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {
|
for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {
|
||||||
|
|
||||||
DataItem = &Instance->DataItem[Index];
|
DataItem = &Instance->DataItem[Index];
|
||||||
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_VOLATILE) && !EFI_ERROR (DataItem->Status)) {
|
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_VOLATILE) && !EFI_ERROR (DataItem->Status)) {
|
||||||
|
|
||||||
VarSize += sizeof (IP4_CONFIG2_DATA_RECORD) + DataItem->DataSize;
|
VarSize += sizeof (IP4_CONFIG2_DATA_RECORD) + DataItem->DataSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,10 +331,8 @@ Ip4Config2WriteConfigData (
|
|||||||
Variable->DataRecordCount = 0;
|
Variable->DataRecordCount = 0;
|
||||||
|
|
||||||
for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {
|
for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {
|
||||||
|
|
||||||
DataItem = &Instance->DataItem[Index];
|
DataItem = &Instance->DataItem[Index];
|
||||||
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_VOLATILE) && !EFI_ERROR (DataItem->Status)) {
|
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_VOLATILE) && !EFI_ERROR (DataItem->Status)) {
|
||||||
|
|
||||||
Heap -= DataItem->DataSize;
|
Heap -= DataItem->DataSize;
|
||||||
CopyMem (Heap, DataItem->Data.Ptr, DataItem->DataSize);
|
CopyMem (Heap, DataItem->Data.Ptr, DataItem->DataSize);
|
||||||
|
|
||||||
@ -367,7 +361,6 @@ Ip4Config2WriteConfigData (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Build a EFI_IP4_ROUTE_TABLE to be returned to the caller of GetModeData.
|
Build a EFI_IP4_ROUTE_TABLE to be returned to the caller of GetModeData.
|
||||||
The EFI_IP4_ROUTE_TABLE is clumsy to use in the internal operation of the
|
The EFI_IP4_ROUTE_TABLE is clumsy to use in the internal operation of the
|
||||||
@ -410,7 +403,6 @@ Ip4Config2BuildDefaultRouteTable (
|
|||||||
Count = 0;
|
Count = 0;
|
||||||
|
|
||||||
for (Index = IP4_MASK_MAX; Index >= 0; Index--) {
|
for (Index = IP4_MASK_MAX; Index >= 0; Index--) {
|
||||||
|
|
||||||
NET_LIST_FOR_EACH (Entry, &(IpSb->DefaultRouteTable->RouteArea[Index])) {
|
NET_LIST_FOR_EACH (Entry, &(IpSb->DefaultRouteTable->RouteArea[Index])) {
|
||||||
RtEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_ENTRY, Link);
|
RtEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_ENTRY, Link);
|
||||||
|
|
||||||
@ -420,7 +412,6 @@ Ip4Config2BuildDefaultRouteTable (
|
|||||||
|
|
||||||
Count++;
|
Count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -623,7 +614,6 @@ Ip4Config2SetDefaultIf (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release all the DHCP related resources.
|
Release all the DHCP related resources.
|
||||||
|
|
||||||
@ -737,6 +727,7 @@ Ip4Config2SetDnsServerWorker (
|
|||||||
if (Tmp != NULL) {
|
if (Tmp != NULL) {
|
||||||
FreePool (Tmp);
|
FreePool (Tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,6 +764,7 @@ Ip4Config2SetDnsServerWorker (
|
|||||||
if (Item->Data.Ptr != NULL) {
|
if (Item->Data.Ptr != NULL) {
|
||||||
FreePool (Item->Data.Ptr);
|
FreePool (Item->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item->Data.Ptr = Tmp;
|
Item->Data.Ptr = Tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,8 +775,6 @@ Ip4Config2SetDnsServerWorker (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function when DHCP process finished. It will save the
|
Callback function when DHCP process finished. It will save the
|
||||||
retrieved IP configure parameter from DHCP to the NVRam.
|
retrieved IP configure parameter from DHCP to the NVRam.
|
||||||
@ -880,7 +870,6 @@ Exit:
|
|||||||
DispatchDpc ();
|
DispatchDpc ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start the DHCP configuration for this IP service instance.
|
Start the DHCP configuration for this IP service instance.
|
||||||
It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the
|
It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the
|
||||||
@ -1048,8 +1037,6 @@ Ip4StartAutoConfig (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The work function is to get the interface information of the communication
|
The work function is to get the interface information of the communication
|
||||||
device this IP4_CONFIG2_INSTANCE manages.
|
device this IP4_CONFIG2_INSTANCE manages.
|
||||||
@ -1157,7 +1144,7 @@ Ip4Config2SetPolicy (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NewPolicy == Instance->Policy) {
|
if (NewPolicy == Instance->Policy) {
|
||||||
if (NewPolicy != Ip4Config2PolicyDhcp || Instance->DhcpSuccess) {
|
if ((NewPolicy != Ip4Config2PolicyDhcp) || Instance->DhcpSuccess) {
|
||||||
return EFI_ABORTED;
|
return EFI_ABORTED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1169,6 +1156,7 @@ Ip4Config2SetPolicy (
|
|||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
DataItem->DataSize = 0;
|
DataItem->DataSize = 0;
|
||||||
DataItem->Status = EFI_NOT_FOUND;
|
DataItem->Status = EFI_NOT_FOUND;
|
||||||
@ -1178,6 +1166,7 @@ Ip4Config2SetPolicy (
|
|||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
DataItem->DataSize = 0;
|
DataItem->DataSize = 0;
|
||||||
DataItem->Status = EFI_NOT_FOUND;
|
DataItem->Status = EFI_NOT_FOUND;
|
||||||
@ -1187,6 +1176,7 @@ Ip4Config2SetPolicy (
|
|||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
DataItem->DataSize = 0;
|
DataItem->DataSize = 0;
|
||||||
DataItem->Status = EFI_NOT_FOUND;
|
DataItem->Status = EFI_NOT_FOUND;
|
||||||
@ -1279,7 +1269,7 @@ Ip4Config2SetManualAddress (
|
|||||||
|
|
||||||
DataItem = &Instance->DataItem[Ip4Config2DataTypeManualAddress];
|
DataItem = &Instance->DataItem[Ip4Config2DataTypeManualAddress];
|
||||||
|
|
||||||
if (Data != NULL && DataSize != 0) {
|
if ((Data != NULL) && (DataSize != 0)) {
|
||||||
NewAddress = *((EFI_IP4_CONFIG2_MANUAL_ADDRESS *)Data);
|
NewAddress = *((EFI_IP4_CONFIG2_MANUAL_ADDRESS *)Data);
|
||||||
|
|
||||||
StationAddress = EFI_NTOHL (NewAddress.Address);
|
StationAddress = EFI_NTOHL (NewAddress.Address);
|
||||||
@ -1314,10 +1304,11 @@ Ip4Config2SetManualAddress (
|
|||||||
|
|
||||||
DataItem->Status = Status;
|
DataItem->Status = Status;
|
||||||
|
|
||||||
if (EFI_ERROR (DataItem->Status) && DataItem->Status != EFI_NOT_READY) {
|
if (EFI_ERROR (DataItem->Status) && (DataItem->Status != EFI_NOT_READY)) {
|
||||||
if (Ptr != NULL) {
|
if (Ptr != NULL) {
|
||||||
FreePool (Ptr);
|
FreePool (Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1327,6 +1318,7 @@ Ip4Config2SetManualAddress (
|
|||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
DataItem->DataSize = 0;
|
DataItem->DataSize = 0;
|
||||||
DataItem->Status = EFI_NOT_FOUND;
|
DataItem->Status = EFI_NOT_FOUND;
|
||||||
@ -1370,7 +1362,7 @@ Ip4Config2SetManualAddress (
|
|||||||
//
|
//
|
||||||
// Reset the State to unstarted.
|
// Reset the State to unstarted.
|
||||||
//
|
//
|
||||||
if (IpSb->State == IP4_SERVICE_CONFIGED || IpSb->State == IP4_SERVICE_STARTED) {
|
if ((IpSb->State == IP4_SERVICE_CONFIGED) || (IpSb->State == IP4_SERVICE_STARTED)) {
|
||||||
IpSb->State = IP4_SERVICE_UNSTARTED;
|
IpSb->State = IP4_SERVICE_UNSTARTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1455,14 +1447,15 @@ Ip4Config2SetGateway (
|
|||||||
OneRemoved = TRUE;
|
OneRemoved = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Data != NULL && DataSize != 0) {
|
if ((Data != NULL) && (DataSize != 0)) {
|
||||||
NewGateway = (EFI_IPv4_ADDRESS *)Data;
|
NewGateway = (EFI_IPv4_ADDRESS *)Data;
|
||||||
NewGatewayCount = DataSize / sizeof (EFI_IPv4_ADDRESS);
|
NewGatewayCount = DataSize / sizeof (EFI_IPv4_ADDRESS);
|
||||||
for (Index1 = 0; Index1 < NewGatewayCount; Index1++) {
|
for (Index1 = 0; Index1 < NewGatewayCount; Index1++) {
|
||||||
CopyMem (&Gateway, NewGateway + Index1, sizeof (IP4_ADDR));
|
CopyMem (&Gateway, NewGateway + Index1, sizeof (IP4_ADDR));
|
||||||
|
|
||||||
if ((IpSb->DefaultInterface->SubnetMask != 0) &&
|
if ((IpSb->DefaultInterface->SubnetMask != 0) &&
|
||||||
!NetIp4IsUnicast (NTOHL (Gateway), IpSb->DefaultInterface->SubnetMask)) {
|
!NetIp4IsUnicast (NTOHL (Gateway), IpSb->DefaultInterface->SubnetMask))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1505,6 +1498,7 @@ Ip4Config2SetGateway (
|
|||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = Tmp;
|
DataItem->Data.Ptr = Tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1519,6 +1513,7 @@ Ip4Config2SetGateway (
|
|||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
DataItem->DataSize = 0;
|
DataItem->DataSize = 0;
|
||||||
DataItem->Status = EFI_NOT_FOUND;
|
DataItem->Status = EFI_NOT_FOUND;
|
||||||
@ -1572,7 +1567,7 @@ Ip4Config2SetDnsServer (
|
|||||||
REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);
|
REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Data != NULL && DataSize != 0) {
|
if ((Data != NULL) && (DataSize != 0)) {
|
||||||
Status = Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);
|
Status = Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
@ -1581,6 +1576,7 @@ Ip4Config2SetDnsServer (
|
|||||||
if (Item->Data.Ptr != NULL) {
|
if (Item->Data.Ptr != NULL) {
|
||||||
FreePool (Item->Data.Ptr);
|
FreePool (Item->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item->Data.Ptr = NULL;
|
Item->Data.Ptr = NULL;
|
||||||
Item->DataSize = 0;
|
Item->DataSize = 0;
|
||||||
Item->Status = EFI_NOT_FOUND;
|
Item->Status = EFI_NOT_FOUND;
|
||||||
@ -1615,8 +1611,6 @@ Ip4Config2InitIfInfo (
|
|||||||
CopyMem (&IfInfo->HwAddress, &IpSb->SnpMode.CurrentAddress, IfInfo->HwAddressSize);
|
CopyMem (&IfInfo->HwAddress, &IpSb->SnpMode.CurrentAddress, IfInfo->HwAddressSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the configuration for the EFI IPv4 network stack running on the communication
|
Set the configuration for the EFI IPv4 network stack running on the communication
|
||||||
device this EFI_IP4_CONFIG2_PROTOCOL instance manages.
|
device this EFI_IP4_CONFIG2_PROTOCOL instance manages.
|
||||||
@ -1678,7 +1672,7 @@ EfiIp4Config2SetData (
|
|||||||
IP4_CONFIG2_INSTANCE *Instance;
|
IP4_CONFIG2_INSTANCE *Instance;
|
||||||
IP4_SERVICE *IpSb;
|
IP4_SERVICE *IpSb;
|
||||||
|
|
||||||
if ((This == NULL) || (Data == NULL && DataSize != 0) || (Data != NULL && DataSize == 0)) {
|
if ((This == NULL) || ((Data == NULL) && (DataSize != 0)) || ((Data != NULL) && (DataSize == 0))) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1690,19 +1684,16 @@ EfiIp4Config2SetData (
|
|||||||
IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
|
IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
|
||||||
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
|
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
|
||||||
|
|
||||||
|
|
||||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||||
|
|
||||||
Status = Instance->DataItem[DataType].Status;
|
Status = Instance->DataItem[DataType].Status;
|
||||||
if (Status != EFI_NOT_READY) {
|
if (Status != EFI_NOT_READY) {
|
||||||
|
|
||||||
if (Instance->DataItem[DataType].SetData == NULL) {
|
if (Instance->DataItem[DataType].SetData == NULL) {
|
||||||
//
|
//
|
||||||
// This type of data is readonly.
|
// This type of data is readonly.
|
||||||
//
|
//
|
||||||
Status = EFI_WRITE_PROTECTED;
|
Status = EFI_WRITE_PROTECTED;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Status = Instance->DataItem[DataType].SetData (Instance, DataSize, Data);
|
Status = Instance->DataItem[DataType].SetData (Instance, DataSize, Data);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
@ -1798,9 +1789,7 @@ EfiIp4Config2GetData (
|
|||||||
|
|
||||||
Status = Instance->DataItem[DataType].Status;
|
Status = Instance->DataItem[DataType].Status;
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
|
|
||||||
if (DataItem->GetData != NULL) {
|
if (DataItem->GetData != NULL) {
|
||||||
|
|
||||||
Status = DataItem->GetData (Instance, DataSize, Data);
|
Status = DataItem->GetData (Instance, DataSize, Data);
|
||||||
} else if (*DataSize < Instance->DataItem[DataType].DataSize) {
|
} else if (*DataSize < Instance->DataItem[DataType].DataSize) {
|
||||||
//
|
//
|
||||||
@ -1809,7 +1798,6 @@ EfiIp4Config2GetData (
|
|||||||
*DataSize = Instance->DataItem[DataType].DataSize;
|
*DataSize = Instance->DataItem[DataType].DataSize;
|
||||||
Status = EFI_BUFFER_TOO_SMALL;
|
Status = EFI_BUFFER_TOO_SMALL;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
*DataSize = Instance->DataItem[DataType].DataSize;
|
*DataSize = Instance->DataItem[DataType].DataSize;
|
||||||
CopyMem (Data, Instance->DataItem[DataType].Data.Ptr, *DataSize);
|
CopyMem (Data, Instance->DataItem[DataType].Data.Ptr, *DataSize);
|
||||||
}
|
}
|
||||||
@ -1874,16 +1862,12 @@ EfiIp4Config2RegisterDataNotify (
|
|||||||
//
|
//
|
||||||
Item = NetMapFindKey (EventMap, Event);
|
Item = NetMapFindKey (EventMap, Event);
|
||||||
if (Item == NULL) {
|
if (Item == NULL) {
|
||||||
|
|
||||||
Status = NetMapInsertTail (EventMap, Event, NULL);
|
Status = NetMapInsertTail (EventMap, Event, NULL);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1934,11 +1918,9 @@ EfiIp4Config2UnregisterDataNotify (
|
|||||||
|
|
||||||
Item = NetMapFindKey (&Instance->DataItem[DataType].EventMap, Event);
|
Item = NetMapFindKey (&Instance->DataItem[DataType].EventMap, Event);
|
||||||
if (Item != NULL) {
|
if (Item != NULL) {
|
||||||
|
|
||||||
NetMapRemoveItem (&Instance->DataItem[DataType].EventMap, Item, NULL);
|
NetMapRemoveItem (&Instance->DataItem[DataType].EventMap, Item, NULL);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1969,12 +1951,10 @@ Ip4Config2InitInstance (
|
|||||||
UINT16 IfIndex;
|
UINT16 IfIndex;
|
||||||
IP4_CONFIG2_DATA_ITEM *DataItem;
|
IP4_CONFIG2_DATA_ITEM *DataItem;
|
||||||
|
|
||||||
|
|
||||||
IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
|
IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
|
||||||
|
|
||||||
Instance->Signature = IP4_CONFIG2_INSTANCE_SIGNATURE;
|
Instance->Signature = IP4_CONFIG2_INSTANCE_SIGNATURE;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the index of this interface.
|
// Determine the index of this interface.
|
||||||
//
|
//
|
||||||
@ -2002,7 +1982,6 @@ Ip4Config2InitInstance (
|
|||||||
NetMapInit (&Instance->DataItem[Index].EventMap);
|
NetMapInit (&Instance->DataItem[Index].EventMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize each data type: associate storage and set data size for the
|
// Initialize each data type: associate storage and set data size for the
|
||||||
// fixed size data types, hook the SetData function, set the data attribute.
|
// fixed size data types, hook the SetData function, set the data attribute.
|
||||||
@ -2060,7 +2039,6 @@ Ip4Config2InitInstance (
|
|||||||
return Ip4Config2FormInit (Instance);
|
return Ip4Config2FormInit (Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release an IP4_CONFIG2_INSTANCE.
|
Release an IP4_CONFIG2_INSTANCE.
|
||||||
|
|
||||||
@ -2084,7 +2062,6 @@ Ip4Config2CleanInstance (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Instance->Dhcp4Handle != NULL) {
|
if (Instance->Dhcp4Handle != NULL) {
|
||||||
|
|
||||||
Ip4Config2DestroyDhcp4 (Instance);
|
Ip4Config2DestroyDhcp4 (Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2097,13 +2074,13 @@ Ip4Config2CleanInstance (
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {
|
for (Index = 0; Index < Ip4Config2DataTypeMaximum; Index++) {
|
||||||
|
|
||||||
DataItem = &Instance->DataItem[Index];
|
DataItem = &Instance->DataItem[Index];
|
||||||
|
|
||||||
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED)) {
|
if (!DATA_ATTRIB_SET (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED)) {
|
||||||
if (DataItem->Data.Ptr != NULL) {
|
if (DataItem->Data.Ptr != NULL) {
|
||||||
FreePool (DataItem->Data.Ptr);
|
FreePool (DataItem->Data.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataItem->Data.Ptr = NULL;
|
DataItem->Data.Ptr = NULL;
|
||||||
DataItem->DataSize = 0;
|
DataItem->DataSize = 0;
|
||||||
}
|
}
|
||||||
@ -2145,7 +2122,6 @@ Ip4AutoReconfigCallBackDpc (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
|
Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.
|
||||||
|
|
||||||
@ -2165,4 +2141,3 @@ Ip4AutoReconfigCallBack (
|
|||||||
//
|
//
|
||||||
QueueDpc (TPL_CALLBACK, Ip4AutoReconfigCallBackDpc, Context);
|
QueueDpc (TPL_CALLBACK, Ip4AutoReconfigCallBackDpc, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ Ip4Config2StrToIp (
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
while (*Str != L'\0') {
|
while (*Str != L'\0') {
|
||||||
|
|
||||||
if (Index > 3) {
|
if (Index > 3) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -278,7 +277,6 @@ Ip4Config2IpToStr (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert the IPv4 address list into string consists of several decimal
|
Convert the IPv4 address list into string consists of several decimal
|
||||||
dotted IPv4 addresses separated by space.
|
dotted IPv4 addresses separated by space.
|
||||||
@ -337,6 +335,7 @@ Ip4Config2IpListToStr (
|
|||||||
} else {
|
} else {
|
||||||
Str[StrIndex++] = L' ';
|
Str[StrIndex++] = L' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
Str[StrIndex++] = *(TempStr + TemIndex);
|
Str[StrIndex++] = *(TempStr + TemIndex);
|
||||||
@ -582,9 +581,7 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
|
|||||||
TimeoutEvent = NULL;
|
TimeoutEvent = NULL;
|
||||||
SetAddressEvent = NULL;
|
SetAddressEvent = NULL;
|
||||||
|
|
||||||
|
if ((Instance == NULL) || (IfrFormNvData == NULL)) {
|
||||||
|
|
||||||
if (Instance == NULL || IfrFormNvData == NULL) {
|
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,21 +615,23 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
|
|||||||
|
|
||||||
Status = Ip4Config2StrToIp (IfrFormNvData->StationAddress, &StationAddress.v4);
|
Status = Ip4Config2StrToIp (IfrFormNvData->StationAddress, &StationAddress.v4);
|
||||||
if (EFI_ERROR (Status) ||
|
if (EFI_ERROR (Status) ||
|
||||||
(SubnetMask.Addr[0] != 0 && !NetIp4IsUnicast (NTOHL (StationAddress.Addr[0]), NTOHL (SubnetMask.Addr[0]))) ||
|
((SubnetMask.Addr[0] != 0) && !NetIp4IsUnicast (NTOHL (StationAddress.Addr[0]), NTOHL (SubnetMask.Addr[0]))) ||
|
||||||
!Ip4StationAddressValid (NTOHL (StationAddress.Addr[0]), NTOHL (SubnetMask.Addr[0]))) {
|
!Ip4StationAddressValid (NTOHL (StationAddress.Addr[0]), NTOHL (SubnetMask.Addr[0])))
|
||||||
|
{
|
||||||
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
|
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Ip4Config2StrToIp (IfrFormNvData->GatewayAddress, &Gateway.v4);
|
Status = Ip4Config2StrToIp (IfrFormNvData->GatewayAddress, &Gateway.v4);
|
||||||
if (EFI_ERROR (Status) ||
|
if (EFI_ERROR (Status) ||
|
||||||
(Gateway.Addr[0] != 0 && SubnetMask.Addr[0] != 0 && !NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL (SubnetMask.Addr[0])))) {
|
((Gateway.Addr[0] != 0) && (SubnetMask.Addr[0] != 0) && !NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL (SubnetMask.Addr[0]))))
|
||||||
|
{
|
||||||
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
|
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = Ip4Config2StrToIpList (IfrFormNvData->DnsAddress, &DnsAddress, &DnsCount);
|
Status = Ip4Config2StrToIpList (IfrFormNvData->DnsAddress, &DnsAddress, &DnsCount);
|
||||||
if (!EFI_ERROR (Status) && DnsCount > 0) {
|
if (!EFI_ERROR (Status) && (DnsCount > 0)) {
|
||||||
for (Index = 0; Index < DnsCount; Index++) {
|
for (Index = 0; Index < DnsCount; Index++) {
|
||||||
CopyMem (&Ip, &DnsAddress[Index], sizeof (IP4_ADDR));
|
CopyMem (&Ip, &DnsAddress[Index], sizeof (IP4_ADDR));
|
||||||
if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
|
if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
|
||||||
@ -650,6 +649,7 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
|
|||||||
if (Ip4NvData->ManualAddress != NULL) {
|
if (Ip4NvData->ManualAddress != NULL) {
|
||||||
FreePool (Ip4NvData->ManualAddress);
|
FreePool (Ip4NvData->ManualAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip4NvData->ManualAddressCount = 1;
|
Ip4NvData->ManualAddressCount = 1;
|
||||||
Ip4NvData->ManualAddress = AllocateZeroPool (sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS));
|
Ip4NvData->ManualAddress = AllocateZeroPool (sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS));
|
||||||
if (Ip4NvData->ManualAddress == NULL) {
|
if (Ip4NvData->ManualAddress == NULL) {
|
||||||
@ -659,25 +659,30 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
|
|||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (&Ip4NvData->ManualAddress->Address, &StationAddress.v4, sizeof (EFI_IPv4_ADDRESS));
|
CopyMem (&Ip4NvData->ManualAddress->Address, &StationAddress.v4, sizeof (EFI_IPv4_ADDRESS));
|
||||||
CopyMem (&Ip4NvData->ManualAddress->SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
|
CopyMem (&Ip4NvData->ManualAddress->SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
|
||||||
if (Ip4NvData->GatewayAddress != NULL) {
|
if (Ip4NvData->GatewayAddress != NULL) {
|
||||||
FreePool (Ip4NvData->GatewayAddress);
|
FreePool (Ip4NvData->GatewayAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip4NvData->GatewayAddressCount = 1;
|
Ip4NvData->GatewayAddressCount = 1;
|
||||||
Ip4NvData->GatewayAddress = AllocateZeroPool (sizeof (EFI_IPv4_ADDRESS));
|
Ip4NvData->GatewayAddress = AllocateZeroPool (sizeof (EFI_IPv4_ADDRESS));
|
||||||
if (Ip4NvData->GatewayAddress == NULL) {
|
if (Ip4NvData->GatewayAddress == NULL) {
|
||||||
if (DnsAddress != NULL) {
|
if (DnsAddress != NULL) {
|
||||||
FreePool (DnsAddress);
|
FreePool (DnsAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (Ip4NvData->GatewayAddress, &Gateway.v4, sizeof (EFI_IPv4_ADDRESS));
|
CopyMem (Ip4NvData->GatewayAddress, &Gateway.v4, sizeof (EFI_IPv4_ADDRESS));
|
||||||
|
|
||||||
if (Ip4NvData->DnsAddress != NULL) {
|
if (Ip4NvData->DnsAddress != NULL) {
|
||||||
FreePool (Ip4NvData->DnsAddress);
|
FreePool (Ip4NvData->DnsAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip4NvData->DnsAddressCount = (UINT32)DnsCount;
|
Ip4NvData->DnsAddressCount = (UINT32)DnsCount;
|
||||||
Ip4NvData->DnsAddress = DnsAddress;
|
Ip4NvData->DnsAddress = DnsAddress;
|
||||||
|
|
||||||
@ -777,7 +782,7 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
|
|||||||
//
|
//
|
||||||
// Set DNS addresses.
|
// Set DNS addresses.
|
||||||
//
|
//
|
||||||
if (Ip4NvData->DnsAddressCount > 0 && Ip4NvData->DnsAddress != NULL) {
|
if ((Ip4NvData->DnsAddressCount > 0) && (Ip4NvData->DnsAddress != NULL)) {
|
||||||
DataSize = Ip4NvData->DnsAddressCount * sizeof (EFI_IPv4_ADDRESS);
|
DataSize = Ip4NvData->DnsAddressCount * sizeof (EFI_IPv4_ADDRESS);
|
||||||
Status = Ip4Cfg2->SetData (
|
Status = Ip4Cfg2->SetData (
|
||||||
Ip4Cfg2,
|
Ip4Cfg2,
|
||||||
@ -880,7 +885,7 @@ Ip4FormExtractConfig (
|
|||||||
UINTN Size;
|
UINTN Size;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
|
|
||||||
if (Progress == NULL || Results == NULL) {
|
if ((Progress == NULL) || (Results == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,6 +925,7 @@ Ip4FormExtractConfig (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Failure;
|
goto Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocatedRequest = TRUE;
|
AllocatedRequest = TRUE;
|
||||||
|
|
||||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||||
@ -953,7 +959,7 @@ Ip4FormExtractConfig (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request == NULL || HiiIsConfigHdrMatch (Request, &gIp4Config2NvDataGuid, mIp4Config2StorageName)) {
|
if ((Request == NULL) || HiiIsConfigHdrMatch (Request, &gIp4Config2NvDataGuid, mIp4Config2StorageName)) {
|
||||||
*Results = FormResult;
|
*Results = FormResult;
|
||||||
} else {
|
} else {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
@ -1022,7 +1028,7 @@ Ip4FormRouteConfig (
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
IfrFormNvData = NULL;
|
IfrFormNvData = NULL;
|
||||||
|
|
||||||
if (Configuration == NULL || Progress == NULL) {
|
if ((Configuration == NULL) || (Progress == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,7 +1079,6 @@ Ip4FormRouteConfig (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1158,6 +1163,7 @@ Ip4FormCallback (
|
|||||||
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
|
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_SUBNET_MASK:
|
case KEY_SUBNET_MASK:
|
||||||
@ -1166,6 +1172,7 @@ Ip4FormCallback (
|
|||||||
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Subnet Mask!", NULL);
|
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Subnet Mask!", NULL);
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_GATE_WAY:
|
case KEY_GATE_WAY:
|
||||||
@ -1174,11 +1181,12 @@ Ip4FormCallback (
|
|||||||
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
|
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_DNS:
|
case KEY_DNS:
|
||||||
Status = Ip4Config2StrToIpList (IfrFormNvData->DnsAddress, &DnsAddress, &DnsCount);
|
Status = Ip4Config2StrToIpList (IfrFormNvData->DnsAddress, &DnsAddress, &DnsCount);
|
||||||
if (!EFI_ERROR (Status) && DnsCount > 0) {
|
if (!EFI_ERROR (Status) && (DnsCount > 0)) {
|
||||||
for (Index = 0; Index < DnsCount; Index++) {
|
for (Index = 0; Index < DnsCount; Index++) {
|
||||||
CopyMem (&Ip, &DnsAddress[Index], sizeof (IP4_ADDR));
|
CopyMem (&Ip, &DnsAddress[Index], sizeof (IP4_ADDR));
|
||||||
if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
|
if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
|
||||||
@ -1196,6 +1204,7 @@ Ip4FormCallback (
|
|||||||
if (DnsAddress != NULL) {
|
if (DnsAddress != NULL) {
|
||||||
FreePool (DnsAddress);
|
FreePool (DnsAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_SAVE_CHANGES:
|
case KEY_SAVE_CHANGES:
|
||||||
|
@ -36,12 +36,13 @@ IpSec2InstalledCallback (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test if protocol was even found.
|
// Test if protocol was even found.
|
||||||
// Notification function will be called at least once.
|
// Notification function will be called at least once.
|
||||||
//
|
//
|
||||||
Status = gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **)&mIpSec);
|
Status = gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **)&mIpSec);
|
||||||
if (Status == EFI_SUCCESS && mIpSec != NULL) {
|
if ((Status == EFI_SUCCESS) && (mIpSec != NULL)) {
|
||||||
//
|
//
|
||||||
// Close the event so it does not get called again.
|
// Close the event so it does not get called again.
|
||||||
//
|
//
|
||||||
@ -170,7 +171,6 @@ Ip4CleanService (
|
|||||||
IN IP4_SERVICE *IpSb
|
IN IP4_SERVICE *IpSb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new IP4 driver service binding private instance.
|
Create a new IP4 driver service binding private instance.
|
||||||
|
|
||||||
@ -375,6 +375,7 @@ Ip4CreateService (
|
|||||||
//
|
//
|
||||||
IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN;
|
IpSb->MaxPacketSize -= NET_VLAN_TAG_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
IpSb->OldMaxPacketSize = IpSb->MaxPacketSize;
|
IpSb->OldMaxPacketSize = IpSb->MaxPacketSize;
|
||||||
*Service = IpSb;
|
*Service = IpSb;
|
||||||
|
|
||||||
@ -387,7 +388,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up a IP4 service binding instance. It will release all
|
Clean up a IP4 service binding instance. It will release all
|
||||||
the resource allocated by the instance. The instance may be
|
the resource allocated by the instance. The instance may be
|
||||||
@ -502,7 +502,7 @@ Ip4DestroyChildEntryInHandleBuffer (
|
|||||||
UINTN NumberOfChildren;
|
UINTN NumberOfChildren;
|
||||||
EFI_HANDLE *ChildHandleBuffer;
|
EFI_HANDLE *ChildHandleBuffer;
|
||||||
|
|
||||||
if (Entry == NULL || Context == NULL) {
|
if ((Entry == NULL) || (Context == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ Ip4DriverBindingStart (
|
|||||||
goto UNINSTALL_PROTOCOL;
|
goto UNINSTALL_PROTOCOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Index == Ip4Config2DataTypePolicy && (*(DataItem->Data.Policy) == Ip4Config2PolicyDhcp)) {
|
if ((Index == Ip4Config2DataTypePolicy) && (*(DataItem->Data.Policy) == Ip4Config2PolicyDhcp)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -634,7 +634,7 @@ Ip4DriverBindingStart (
|
|||||||
//
|
//
|
||||||
Status = Ip4ReceiveFrame (IpSb->DefaultInterface, NULL, Ip4AccpetFrame, IpSb);
|
Status = Ip4ReceiveFrame (IpSb->DefaultInterface, NULL, Ip4AccpetFrame, IpSb);
|
||||||
|
|
||||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||||
goto UNINSTALL_PROTOCOL;
|
goto UNINSTALL_PROTOCOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,7 +673,6 @@ FREE_SERVICE:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stop this driver on ControllerHandle. This service is called by the
|
Stop this driver on ControllerHandle. This service is called by the
|
||||||
EFI boot service DisconnectController(). In order to
|
EFI boot service DisconnectController(). In order to
|
||||||
@ -758,7 +757,6 @@ Ip4DriverBindingStop (
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
} else if (IpSb->DefaultInterface->ArpHandle == ControllerHandle) {
|
} else if (IpSb->DefaultInterface->ArpHandle == ControllerHandle) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// The ARP protocol for the default interface is being uninstalled and all
|
// The ARP protocol for the default interface is being uninstalled and all
|
||||||
// its IP child handles should have been destroyed before. So, release the
|
// its IP child handles should have been destroyed before. So, release the
|
||||||
@ -772,10 +770,11 @@ Ip4DriverBindingStop (
|
|||||||
if (IpIf == NULL) {
|
if (IpIf == NULL) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
RouteTable = Ip4CreateRouteTable ();
|
RouteTable = Ip4CreateRouteTable ();
|
||||||
if (RouteTable == NULL) {
|
if (RouteTable == NULL) {
|
||||||
Ip4FreeInterface (IpIf, NULL);
|
Ip4FreeInterface (IpIf, NULL);
|
||||||
goto ON_ERROR;;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
IpSb->DefaultInterface = IpIf;
|
IpSb->DefaultInterface = IpIf;
|
||||||
@ -784,7 +783,6 @@ Ip4DriverBindingStop (
|
|||||||
Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
|
Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
|
||||||
|
|
||||||
IpSb->State = IP4_SERVICE_UNSTARTED;
|
IpSb->State = IP4_SERVICE_UNSTARTED;
|
||||||
|
|
||||||
} else if (IsListEmpty (&IpSb->Children)) {
|
} else if (IsListEmpty (&IpSb->Children)) {
|
||||||
State = IpSb->State;
|
State = IpSb->State;
|
||||||
//
|
//
|
||||||
@ -809,6 +807,7 @@ Ip4DriverBindingStop (
|
|||||||
FreeUnicodeStringTable (gIp4ControllerNameTable);
|
FreeUnicodeStringTable (gIp4ControllerNameTable);
|
||||||
gIp4ControllerNameTable = NULL;
|
gIp4ControllerNameTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (IpSb);
|
FreePool (IpSb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,7 +815,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a child handle and installs a protocol.
|
Creates a child handle and installs a protocol.
|
||||||
|
|
||||||
@ -913,7 +911,6 @@ Ip4ServiceBindingCreateChild (
|
|||||||
ON_ERROR:
|
ON_ERROR:
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
|
||||||
Ip4CleanProtocol (IpInstance);
|
Ip4CleanProtocol (IpInstance);
|
||||||
|
|
||||||
FreePool (IpInstance);
|
FreePool (IpInstance);
|
||||||
@ -922,7 +919,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Destroys a child handle with a protocol installed on it.
|
Destroys a child handle with a protocol installed on it.
|
||||||
|
|
||||||
@ -1007,7 +1003,7 @@ Ip4ServiceBindingDestroyChild (
|
|||||||
ChildHandle
|
ChildHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
if (IpInstance->Interface != NULL && IpInstance->Interface->Arp != NULL) {
|
if ((IpInstance->Interface != NULL) && (IpInstance->Interface->Arp != NULL)) {
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
IpInstance->Interface->ArpHandle,
|
IpInstance->Interface->ArpHandle,
|
||||||
&gEfiArpProtocolGuid,
|
&gEfiArpProtocolGuid,
|
||||||
|
@ -24,6 +24,7 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
// Function prototype for the driver's entry point
|
// Function prototype for the driver's entry point
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the declaration of an EFI image entry point. This entry point is
|
This is the declaration of an EFI image entry point. This entry point is
|
||||||
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
||||||
@ -49,6 +50,7 @@ Ip4DriverEntryPoint (
|
|||||||
//
|
//
|
||||||
// Function prototypes for the Driver Binding Protocol
|
// Function prototypes for the Driver Binding Protocol
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test to see if this driver supports ControllerHandle. This service
|
Test to see if this driver supports ControllerHandle. This service
|
||||||
is called by the EFI boot service ConnectController(). In
|
is called by the EFI boot service ConnectController(). In
|
||||||
@ -131,6 +133,7 @@ Ip4DriverBindingStop (
|
|||||||
//
|
//
|
||||||
// Function prototypes for the ServiceBinding Protocol
|
// Function prototypes for the ServiceBinding Protocol
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a child handle and installs a protocol.
|
Creates a child handle and installs a protocol.
|
||||||
|
|
||||||
@ -181,4 +184,5 @@ Ip4ServiceBindingDestroyChild (
|
|||||||
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
||||||
IN EFI_HANDLE ChildHandle
|
IN EFI_HANDLE ChildHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,8 +61,6 @@ mIp4SupportedIcmp[23] = {
|
|||||||
{ ICMP_PARAMETER_PROBLEM, ICMP_DEFAULT_CODE },
|
{ ICMP_PARAMETER_PROBLEM, ICMP_DEFAULT_CODE },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the ICMP redirect. Find the instance then update
|
Process the ICMP redirect. Find the instance then update
|
||||||
its route cache.
|
its route cache.
|
||||||
@ -146,7 +144,6 @@ Ip4ProcessIcmpRedirect (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the ICMP error packet. If it is an ICMP redirect packet,
|
Process the ICMP error packet. If it is an ICMP redirect packet,
|
||||||
update call Ip4ProcessIcmpRedirect to update the IP instance's
|
update call Ip4ProcessIcmpRedirect to update the IP instance's
|
||||||
@ -190,7 +187,6 @@ Ip4ProcessIcmpError (
|
|||||||
return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0);
|
return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Replay an ICMP echo request.
|
Replay an ICMP echo request.
|
||||||
|
|
||||||
@ -270,7 +266,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Process the ICMP query message. If it is an ICMP echo
|
Process the ICMP query message. If it is an ICMP echo
|
||||||
request, answer it. Otherwise deliver it to upper layer.
|
request, answer it. Otherwise deliver it to upper layer.
|
||||||
@ -308,7 +303,6 @@ Ip4ProcessIcmpQuery (
|
|||||||
return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0);
|
return Ip4Demultiplex (IpSb, Head, Packet, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle the ICMP packet. First validate the message format,
|
Handle the ICMP packet. First validate the message format,
|
||||||
then according to the message types, process it as query or
|
then according to the message types, process it as query or
|
||||||
@ -351,10 +345,8 @@ Ip4IcmpHandle (
|
|||||||
|
|
||||||
if (mIcmpClass[Icmp.Type].IcmpClass == ICMP_ERROR_MESSAGE) {
|
if (mIcmpClass[Icmp.Type].IcmpClass == ICMP_ERROR_MESSAGE) {
|
||||||
return Ip4ProcessIcmpError (IpSb, Head, Packet);
|
return Ip4ProcessIcmpError (IpSb, Head, Packet);
|
||||||
|
|
||||||
} else if (mIcmpClass[Icmp.Type].IcmpClass == ICMP_QUERY_MESSAGE) {
|
} else if (mIcmpClass[Icmp.Type].IcmpClass == ICMP_QUERY_MESSAGE) {
|
||||||
return Ip4ProcessIcmpQuery (IpSb, Head, Packet);
|
return Ip4ProcessIcmpQuery (IpSb, Head, Packet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DROP:
|
DROP:
|
||||||
|
@ -94,4 +94,5 @@ Ip4IcmpHandle (
|
|||||||
IN IP4_HEAD *Head,
|
IN IP4_HEAD *Head,
|
||||||
IN NET_BUF *Packet
|
IN NET_BUF *Packet
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -121,7 +121,6 @@ Ip4CancelFrameArp (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrap a transmit request into a newly allocated IP4_LINK_TX_TOKEN.
|
Wrap a transmit request into a newly allocated IP4_LINK_TX_TOKEN.
|
||||||
|
|
||||||
@ -154,8 +153,10 @@ Ip4WrapLinkTxToken (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 Count;
|
UINT32 Count;
|
||||||
|
|
||||||
Token = AllocatePool (sizeof (IP4_LINK_TX_TOKEN) + \
|
Token = AllocatePool (
|
||||||
(Packet->BlockOpNum - 1) * sizeof (EFI_MANAGED_NETWORK_FRAGMENT_DATA));
|
sizeof (IP4_LINK_TX_TOKEN) + \
|
||||||
|
(Packet->BlockOpNum - 1) * sizeof (EFI_MANAGED_NETWORK_FRAGMENT_DATA)
|
||||||
|
);
|
||||||
|
|
||||||
if (Token == NULL) {
|
if (Token == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -206,7 +207,6 @@ Ip4WrapLinkTxToken (
|
|||||||
return Token;
|
return Token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free the link layer transmit token. It will close the event
|
Free the link layer transmit token. It will close the event
|
||||||
then free the memory used.
|
then free the memory used.
|
||||||
@ -225,7 +225,6 @@ Ip4FreeLinkTxToken (
|
|||||||
FreePool (Token);
|
FreePool (Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an IP_ARP_QUE structure to request ARP service.
|
Create an IP_ARP_QUE structure to request ARP service.
|
||||||
|
|
||||||
@ -276,7 +275,6 @@ Ip4CreateArpQue (
|
|||||||
return ArpQue;
|
return ArpQue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove all the transmit requests queued on the ARP queue, then free it.
|
Remove all the transmit requests queued on the ARP queue, then free it.
|
||||||
|
|
||||||
@ -302,7 +300,6 @@ Ip4FreeArpQue (
|
|||||||
FreePool (ArpQue);
|
FreePool (ArpQue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a link layer receive token to wrap the receive request
|
Create a link layer receive token to wrap the receive request
|
||||||
|
|
||||||
@ -358,7 +355,6 @@ Ip4CreateLinkRxToken (
|
|||||||
return Token;
|
return Token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free the link layer request token. It will close the event
|
Free the link layer request token. It will close the event
|
||||||
then free the memory used.
|
then free the memory used.
|
||||||
@ -371,14 +367,12 @@ Ip4FreeFrameRxToken (
|
|||||||
IN IP4_LINK_RX_TOKEN *Token
|
IN IP4_LINK_RX_TOKEN *Token
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
NET_CHECK_SIGNATURE (Token, IP4_FRAME_RX_SIGNATURE);
|
NET_CHECK_SIGNATURE (Token, IP4_FRAME_RX_SIGNATURE);
|
||||||
|
|
||||||
gBS->CloseEvent (Token->MnpToken.Event);
|
gBS->CloseEvent (Token->MnpToken.Event);
|
||||||
FreePool (Token);
|
FreePool (Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove all the frames on the ARP queue that pass the FrameToCancel,
|
Remove all the frames on the ARP queue that pass the FrameToCancel,
|
||||||
that is, either FrameToCancel is NULL or it returns true for the frame.
|
that is, either FrameToCancel is NULL or it returns true for the frame.
|
||||||
@ -414,7 +408,6 @@ Ip4CancelFrameArp (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove all the frames on the interface that pass the FrameToCancel,
|
Remove all the frames on the interface that pass the FrameToCancel,
|
||||||
either queued on ARP queues or that have already been delivered to
|
either queued on ARP queues or that have already been delivered to
|
||||||
@ -467,7 +460,6 @@ Ip4CancelFrames (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an IP4_INTERFACE. Delay the creation of ARP instance until
|
Create an IP4_INTERFACE. Delay the creation of ARP instance until
|
||||||
the interface is configured.
|
the interface is configured.
|
||||||
@ -538,7 +530,6 @@ Ip4CreateInterface (
|
|||||||
return Interface;
|
return Interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the interface's address, create and configure
|
Set the interface's address, create and configure
|
||||||
the ARP child if necessary.
|
the ARP child if necessary.
|
||||||
@ -667,7 +658,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Filter function to cancel all the frame related to an IP instance.
|
Filter function to cancel all the frame related to an IP instance.
|
||||||
|
|
||||||
@ -693,8 +683,6 @@ Ip4CancelInstanceFrame (
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If there is a pending receive request, cancel it. Don't call
|
If there is a pending receive request, cancel it. Don't call
|
||||||
the receive request's callback because this function can be only
|
the receive request's callback because this function can be only
|
||||||
@ -725,7 +713,6 @@ Ip4CancelReceive (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free the interface used by IpInstance. All the IP instance with
|
Free the interface used by IpInstance. All the IP instance with
|
||||||
the same Ip/Netmask pair share the same interface. It is reference
|
the same Ip/Netmask pair share the same interface. It is reference
|
||||||
@ -830,18 +817,22 @@ Ip4SendFrameToDefaultRoute (
|
|||||||
if (Token->IpInstance != NULL) {
|
if (Token->IpInstance != NULL) {
|
||||||
RtCacheEntry = Ip4FindRouteCache (Token->IpInstance->RouteTable, NTOHL (ArpQue->Ip), Token->Interface->Ip);
|
RtCacheEntry = Ip4FindRouteCache (Token->IpInstance->RouteTable, NTOHL (ArpQue->Ip), Token->Interface->Ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RtCacheEntry == NULL) {
|
if (RtCacheEntry == NULL) {
|
||||||
RtCacheEntry = Ip4FindRouteCache (Token->IpSb->DefaultRouteTable, NTOHL (ArpQue->Ip), Token->Interface->Ip);
|
RtCacheEntry = Ip4FindRouteCache (Token->IpSb->DefaultRouteTable, NTOHL (ArpQue->Ip), Token->Interface->Ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RtCacheEntry == NULL) {
|
if (RtCacheEntry == NULL) {
|
||||||
Status = EFI_NO_MAPPING;
|
Status = EFI_NO_MAPPING;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultRoute = (IP4_ROUTE_ENTRY *)RtCacheEntry->Tag;
|
DefaultRoute = (IP4_ROUTE_ENTRY *)RtCacheEntry->Tag;
|
||||||
if (DefaultRoute == NULL) {
|
if (DefaultRoute == NULL) {
|
||||||
Status = EFI_NO_MAPPING;
|
Status = EFI_NO_MAPPING;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to send the frame to the default route.
|
// Try to send the frame to the default route.
|
||||||
//
|
//
|
||||||
@ -853,12 +844,14 @@ Ip4SendFrameToDefaultRoute (
|
|||||||
Status = EFI_NO_MAPPING;
|
Status = EFI_NO_MAPPING;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtCacheEntry->NextHop = Gateway;
|
RtCacheEntry->NextHop = Gateway;
|
||||||
Status = Ip4SendFrame (Token->Interface, Token->IpInstance, Token->Packet, Gateway, Token->CallBack, Token->Context, Token->IpSb);
|
Status = Ip4SendFrame (Token->Interface, Token->IpInstance, Token->Packet, Gateway, Token->CallBack, Token->Context, Token->IpSb);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Status = EFI_NO_MAPPING;
|
Status = EFI_NO_MAPPING;
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip4FreeRouteCacheEntry (RtCacheEntry);
|
Ip4FreeRouteCacheEntry (RtCacheEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -868,12 +861,12 @@ ON_ERROR:
|
|||||||
if (RtCacheEntry != NULL) {
|
if (RtCacheEntry != NULL) {
|
||||||
Ip4FreeRouteCacheEntry (RtCacheEntry);
|
Ip4FreeRouteCacheEntry (RtCacheEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
Token->CallBack (Token->IpInstance, Token->Packet, Status, 0, Token->Context);
|
Token->CallBack (Token->IpInstance, Token->Packet, Status, 0, Token->Context);
|
||||||
Ip4FreeLinkTxToken (Token);
|
Ip4FreeLinkTxToken (Token);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function when ARP request are finished. It will cancel
|
Callback function when ARP request are finished. It will cancel
|
||||||
all the queued frame if the ARP requests failed. Or transmit them
|
all the queued frame if the ARP requests failed. Or transmit them
|
||||||
@ -919,6 +912,7 @@ Ip4OnArpResolvedDpc (
|
|||||||
//
|
//
|
||||||
IoStatus = Ip4SendFrameToDefaultRoute (ArpQue);
|
IoStatus = Ip4SendFrameToDefaultRoute (ArpQue);
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,8 +974,6 @@ Ip4OnArpResolved (
|
|||||||
QueueDpc (TPL_CALLBACK, Ip4OnArpResolvedDpc, Context);
|
QueueDpc (TPL_CALLBACK, Ip4OnArpResolvedDpc, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Callback function when frame transmission is finished. It will
|
Callback function when frame transmission is finished. It will
|
||||||
call the frame owner's callback function to tell it the result.
|
call the frame owner's callback function to tell it the result.
|
||||||
@ -1033,8 +1025,6 @@ Ip4OnFrameSent (
|
|||||||
QueueDpc (TPL_CALLBACK, Ip4OnFrameSentDpc, Context);
|
QueueDpc (TPL_CALLBACK, Ip4OnFrameSentDpc, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send a frame from the interface. If the next hop is broadcast or
|
Send a frame from the interface. If the next hop is broadcast or
|
||||||
multicast address, it is transmitted immediately. If the next hop
|
multicast address, it is transmitted immediately. If the next hop
|
||||||
@ -1092,9 +1082,7 @@ Ip4SendFrame (
|
|||||||
if (NextHop == IP4_ALLONE_ADDRESS) {
|
if (NextHop == IP4_ALLONE_ADDRESS) {
|
||||||
CopyMem (&Token->DstMac, &Interface->BroadcastMac, sizeof (Token->DstMac));
|
CopyMem (&Token->DstMac, &Interface->BroadcastMac, sizeof (Token->DstMac));
|
||||||
goto SEND_NOW;
|
goto SEND_NOW;
|
||||||
|
|
||||||
} else if (IP4_IS_MULTICAST (NextHop)) {
|
} else if (IP4_IS_MULTICAST (NextHop)) {
|
||||||
|
|
||||||
Status = Ip4GetMulticastMac (Interface->Mnp, NextHop, &Token->DstMac);
|
Status = Ip4GetMulticastMac (Interface->Mnp, NextHop, &Token->DstMac);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -1120,7 +1108,6 @@ Ip4SendFrame (
|
|||||||
|
|
||||||
if (Status == EFI_SUCCESS) {
|
if (Status == EFI_SUCCESS) {
|
||||||
goto SEND_NOW;
|
goto SEND_NOW;
|
||||||
|
|
||||||
} else if (Status != EFI_NOT_READY) {
|
} else if (Status != EFI_NOT_READY) {
|
||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
@ -1187,7 +1174,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call back function when the received packet is freed.
|
Call back function when the received packet is freed.
|
||||||
Check Ip4OnFrameReceived for information.
|
Check Ip4OnFrameReceived for information.
|
||||||
@ -1210,7 +1196,6 @@ Ip4RecycleFrame (
|
|||||||
Ip4FreeFrameRxToken (Frame);
|
Ip4FreeFrameRxToken (Frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Received a frame from MNP, wrap it in net buffer then deliver
|
Received a frame from MNP, wrap it in net buffer then deliver
|
||||||
it to IP's input function. The ownship of the packet also
|
it to IP's input function. The ownship of the packet also
|
||||||
@ -1299,7 +1284,6 @@ Ip4OnFrameReceived (
|
|||||||
QueueDpc (TPL_CALLBACK, Ip4OnFrameReceivedDpc, Context);
|
QueueDpc (TPL_CALLBACK, Ip4OnFrameReceivedDpc, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Request to receive the packet from the interface.
|
Request to receive the packet from the interface.
|
||||||
|
|
||||||
@ -1345,5 +1329,6 @@ Ip4ReceiveFrame (
|
|||||||
Ip4FreeFrameRxToken (Token);
|
Ip4FreeFrameRxToken (Token);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
//
|
//
|
||||||
UINT32 mRouteAlertOption = 0x00000494;
|
UINT32 mRouteAlertOption = 0x00000494;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Init the IGMP control data of the IP4 service instance, configure
|
Init the IGMP control data of the IP4 service instance, configure
|
||||||
MNP to receive ALL SYSTEM multicast.
|
MNP to receive ALL SYSTEM multicast.
|
||||||
@ -74,7 +73,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find the IGMP_GROUP structure which contains the status of multicast
|
Find the IGMP_GROUP structure which contains the status of multicast
|
||||||
group Address in this IGMP control block
|
group Address in this IGMP control block
|
||||||
@ -107,7 +105,6 @@ Ip4FindGroup (
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Count the number of IP4 multicast groups that are mapped to the
|
Count the number of IP4 multicast groups that are mapped to the
|
||||||
same MAC address. Several IP4 multicast address may be mapped to
|
same MAC address. Several IP4 multicast address may be mapped to
|
||||||
@ -143,7 +140,6 @@ Ip4FindMac (
|
|||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send an IGMP protocol message to the Dst, such as IGMP v1 membership report.
|
Send an IGMP protocol message to the Dst, such as IGMP v1 membership report.
|
||||||
|
|
||||||
@ -216,7 +212,6 @@ Ip4SendIgmpMessage (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send an IGMP membership report. Depends on whether the server is
|
Send an IGMP membership report. Depends on whether the server is
|
||||||
v1 or v2, it will send either a V1 or V2 membership report.
|
v1 or v2, it will send either a V1 or V2 membership report.
|
||||||
@ -243,7 +238,6 @@ Ip4SendIgmpReport (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Join the multicast group on behalf of this IP4 child
|
Join the multicast group on behalf of this IP4 child
|
||||||
|
|
||||||
@ -323,7 +317,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Leave the IP4 multicast group on behalf of IpInstance.
|
Leave the IP4 multicast group on behalf of IpInstance.
|
||||||
|
|
||||||
@ -383,7 +376,7 @@ Ip4LeaveGroup (
|
|||||||
// Send a leave report if the membership is reported by us
|
// Send a leave report if the membership is reported by us
|
||||||
// and we are talking IGMPv2.
|
// and we are talking IGMPv2.
|
||||||
//
|
//
|
||||||
if (Group->ReportByUs && IgmpCtrl->Igmpv1QuerySeen == 0) {
|
if (Group->ReportByUs && (IgmpCtrl->Igmpv1QuerySeen == 0)) {
|
||||||
Ip4SendIgmpMessage (IpSb, IP4_ALLROUTER_ADDRESS, IGMP_LEAVE_GROUP, Group->Address);
|
Ip4SendIgmpMessage (IpSb, IP4_ALLROUTER_ADDRESS, IGMP_LEAVE_GROUP, Group->Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,7 +386,6 @@ Ip4LeaveGroup (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle the received IGMP message for the IP4 service instance.
|
Handle the received IGMP message for the IP4 service instance.
|
||||||
|
|
||||||
@ -494,7 +486,6 @@ Ip4IgmpHandle (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The periodical timer function for IGMP. It does the following
|
The periodical timer function for IGMP. It does the following
|
||||||
things:
|
things:
|
||||||
@ -539,7 +530,6 @@ Ip4IgmpTicking (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add a group address to the array of group addresses.
|
Add a group address to the array of group addresses.
|
||||||
The caller should make sure that no duplicated address
|
The caller should make sure that no duplicated address
|
||||||
@ -576,7 +566,6 @@ Ip4CombineGroups (
|
|||||||
return Groups;
|
return Groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove a group address from the array of group addresses.
|
Remove a group address from the array of group addresses.
|
||||||
Although the function doesn't assume the byte order of the
|
Although the function doesn't assume the byte order of the
|
||||||
|
@ -198,4 +198,5 @@ Ip4FindGroup (
|
|||||||
IN IGMP_SERVICE_DATA *IgmpCtrl,
|
IN IGMP_SERVICE_DATA *IgmpCtrl,
|
||||||
IN IP4_ADDR Address
|
IN IP4_ADDR Address
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -443,7 +443,6 @@ EfiIp4GetModeData (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Config the MNP parameter used by IP. The IP driver use one MNP
|
Config the MNP parameter used by IP. The IP driver use one MNP
|
||||||
child to transmit/receive frames. By default, it configures MNP
|
child to transmit/receive frames. By default, it configures MNP
|
||||||
@ -486,7 +485,6 @@ Ip4ServiceConfigMnp (
|
|||||||
// filter also.
|
// filter also.
|
||||||
//
|
//
|
||||||
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
|
NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
|
||||||
|
|
||||||
IpIf = NET_LIST_USER_STRUCT (Entry, IP4_INTERFACE, Link);
|
IpIf = NET_LIST_USER_STRUCT (Entry, IP4_INTERFACE, Link);
|
||||||
IpIf->PromiscRecv = FALSE;
|
IpIf->PromiscRecv = FALSE;
|
||||||
|
|
||||||
@ -523,7 +521,6 @@ Ip4ServiceConfigMnp (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the IP4_PROTOCOL structure to the unconfigured states.
|
Initialize the IP4_PROTOCOL structure to the unconfigured states.
|
||||||
|
|
||||||
@ -557,7 +554,6 @@ Ip4InitProtocol (
|
|||||||
EfiInitializeLock (&IpInstance->RecycleLock, TPL_NOTIFY);
|
EfiInitializeLock (&IpInstance->RecycleLock, TPL_NOTIFY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Configure the IP4 child. If the child is already configured,
|
Configure the IP4 child. If the child is already configured,
|
||||||
change the configuration parameter. Otherwise configure it
|
change the configuration parameter. Otherwise configure it
|
||||||
@ -646,7 +642,6 @@ Ip4ConfigProtocol (
|
|||||||
|
|
||||||
if (IpIf != NULL) {
|
if (IpIf != NULL) {
|
||||||
NET_GET_REF (IpIf);
|
NET_GET_REF (IpIf);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
IpIf = Ip4CreateInterface (IpSb->Mnp, IpSb->Controller, IpSb->Image);
|
IpIf = Ip4CreateInterface (IpSb->Mnp, IpSb->Controller, IpSb->Image);
|
||||||
|
|
||||||
@ -729,6 +724,7 @@ Ip4ConfigProtocol (
|
|||||||
goto ON_ERROR;
|
goto ON_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertTailList (&IpIf->IpInstances, &IpInstance->AddrLink);
|
InsertTailList (&IpIf->IpInstances, &IpInstance->AddrLink);
|
||||||
|
|
||||||
CopyMem (&IpInstance->ConfigData, Config, sizeof (IpInstance->ConfigData));
|
CopyMem (&IpInstance->ConfigData, Config, sizeof (IpInstance->ConfigData));
|
||||||
@ -751,7 +747,6 @@ ON_ERROR:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the IP4 child, release all the resources used by it.
|
Clean up the IP4 child, release all the resources used by it.
|
||||||
|
|
||||||
@ -780,7 +775,6 @@ Ip4CleanProtocol (
|
|||||||
// hasn't been called. Just leave it alone.
|
// hasn't been called. Just leave it alone.
|
||||||
//
|
//
|
||||||
if (!IsListEmpty (&IpInstance->Delivered)) {
|
if (!IsListEmpty (&IpInstance->Delivered)) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IpInstance->Interface != NULL) {
|
if (IpInstance->Interface != NULL) {
|
||||||
@ -793,6 +787,7 @@ Ip4CleanProtocol (
|
|||||||
IpInstance->Handle
|
IpInstance->Handle
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip4FreeInterface (IpInstance->Interface, IpInstance);
|
Ip4FreeInterface (IpInstance->Interface, IpInstance);
|
||||||
IpInstance->Interface = NULL;
|
IpInstance->Interface = NULL;
|
||||||
}
|
}
|
||||||
@ -825,7 +820,6 @@ Ip4CleanProtocol (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
|
Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
|
||||||
|
|
||||||
@ -898,7 +892,6 @@ EfiIp4Configure (
|
|||||||
// Validate the configuration first.
|
// Validate the configuration first.
|
||||||
//
|
//
|
||||||
if (IpConfigData != NULL) {
|
if (IpConfigData != NULL) {
|
||||||
|
|
||||||
CopyMem (&IpAddress, &IpConfigData->StationAddress, sizeof (IP4_ADDR));
|
CopyMem (&IpAddress, &IpConfigData->StationAddress, sizeof (IP4_ADDR));
|
||||||
CopyMem (&SubnetMask, &IpConfigData->SubnetMask, sizeof (IP4_ADDR));
|
CopyMem (&SubnetMask, &IpConfigData->SubnetMask, sizeof (IP4_ADDR));
|
||||||
|
|
||||||
@ -932,7 +925,8 @@ EfiIp4Configure (
|
|||||||
|
|
||||||
if (!Current->UseDefaultAddress &&
|
if (!Current->UseDefaultAddress &&
|
||||||
(!EFI_IP4_EQUAL (&Current->StationAddress, &IpConfigData->StationAddress) ||
|
(!EFI_IP4_EQUAL (&Current->StationAddress, &IpConfigData->StationAddress) ||
|
||||||
!EFI_IP4_EQUAL (&Current->SubnetMask, &IpConfigData->SubnetMask))) {
|
!EFI_IP4_EQUAL (&Current->SubnetMask, &IpConfigData->SubnetMask)))
|
||||||
|
{
|
||||||
Status = EFI_ALREADY_STARTED;
|
Status = EFI_ALREADY_STARTED;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -971,10 +965,8 @@ EfiIp4Configure (
|
|||||||
ON_EXIT:
|
ON_EXIT:
|
||||||
gBS->RestoreTPL (OldTpl);
|
gBS->RestoreTPL (OldTpl);
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Change the IP4 child's multicast setting. The caller
|
Change the IP4 child's multicast setting. The caller
|
||||||
should make sure that the parameters is valid.
|
should make sure that the parameters is valid.
|
||||||
@ -1072,7 +1064,6 @@ Ip4Groups (
|
|||||||
return ((GroupAddress != NULL) ? EFI_NOT_FOUND : EFI_SUCCESS);
|
return ((GroupAddress != NULL) ? EFI_NOT_FOUND : EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Joins and leaves multicast groups.
|
Joins and leaves multicast groups.
|
||||||
|
|
||||||
@ -1148,7 +1139,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Adds and deletes routing table entries.
|
Adds and deletes routing table entries.
|
||||||
|
|
||||||
@ -1221,7 +1211,8 @@ EfiIp4Routes (
|
|||||||
// First, validate the parameters
|
// First, validate the parameters
|
||||||
//
|
//
|
||||||
if ((This == NULL) || (SubnetAddress == NULL) ||
|
if ((This == NULL) || (SubnetAddress == NULL) ||
|
||||||
(SubnetMask == NULL) || (GatewayAddress == NULL)) {
|
(SubnetMask == NULL) || (GatewayAddress == NULL))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,9 +1248,9 @@ EfiIp4Routes (
|
|||||||
// the gateway address must be a unicast on the connected network if not zero.
|
// the gateway address must be a unicast on the connected network if not zero.
|
||||||
//
|
//
|
||||||
if ((Nexthop != IP4_ALLZERO_ADDRESS) &&
|
if ((Nexthop != IP4_ALLZERO_ADDRESS) &&
|
||||||
((IpIf->SubnetMask != IP4_ALLONE_ADDRESS && !IP4_NET_EQUAL (Nexthop, IpIf->Ip, IpIf->SubnetMask)) ||
|
(((IpIf->SubnetMask != IP4_ALLONE_ADDRESS) && !IP4_NET_EQUAL (Nexthop, IpIf->Ip, IpIf->SubnetMask)) ||
|
||||||
IP4_IS_BROADCAST (Ip4GetNetCast (Nexthop, IpIf)))) {
|
IP4_IS_BROADCAST (Ip4GetNetCast (Nexthop, IpIf))))
|
||||||
|
{
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
@ -1275,7 +1266,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether the user's token or event has already
|
Check whether the user's token or event has already
|
||||||
been enqueued on IP4's list.
|
been enqueued on IP4's list.
|
||||||
@ -1359,8 +1349,8 @@ Ip4TxTokenValid (
|
|||||||
|
|
||||||
for (Index = 0; Index < TxData->FragmentCount; Index++) {
|
for (Index = 0; Index < TxData->FragmentCount; Index++) {
|
||||||
if ((TxData->FragmentTable[Index].FragmentBuffer == NULL) ||
|
if ((TxData->FragmentTable[Index].FragmentBuffer == NULL) ||
|
||||||
(TxData->FragmentTable[Index].FragmentLength == 0)) {
|
(TxData->FragmentTable[Index].FragmentLength == 0))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1407,8 +1397,8 @@ Ip4TxTokenValid (
|
|||||||
|
|
||||||
if ((NetGetIpClass (Src) > IP4_ADDR_CLASSC) ||
|
if ((NetGetIpClass (Src) > IP4_ADDR_CLASSC) ||
|
||||||
(Src == IP4_ALLONE_ADDRESS) ||
|
(Src == IP4_ALLONE_ADDRESS) ||
|
||||||
IP4_IS_BROADCAST (Ip4GetNetCast (Src, IpIf))) {
|
IP4_IS_BROADCAST (Ip4GetNetCast (Src, IpIf)))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,8 +1409,8 @@ Ip4TxTokenValid (
|
|||||||
if ((Gateway != IP4_ALLZERO_ADDRESS) &&
|
if ((Gateway != IP4_ALLZERO_ADDRESS) &&
|
||||||
((NetGetIpClass (Gateway) > IP4_ADDR_CLASSC) ||
|
((NetGetIpClass (Gateway) > IP4_ADDR_CLASSC) ||
|
||||||
!IP4_NET_EQUAL (Gateway, IpIf->Ip, IpIf->SubnetMask) ||
|
!IP4_NET_EQUAL (Gateway, IpIf->Ip, IpIf->SubnetMask) ||
|
||||||
IP4_IS_BROADCAST (Ip4GetNetCast (Gateway, IpIf)))) {
|
IP4_IS_BROADCAST (Ip4GetNetCast (Gateway, IpIf))))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1431,15 +1421,14 @@ Ip4TxTokenValid (
|
|||||||
HeadLen = sizeof (IP4_HEAD) + ((TxData->OptionsLength + 3) &~0x03);
|
HeadLen = sizeof (IP4_HEAD) + ((TxData->OptionsLength + 3) &~0x03);
|
||||||
|
|
||||||
if ((HeadLen > IP4_MAX_HEADLEN) ||
|
if ((HeadLen > IP4_MAX_HEADLEN) ||
|
||||||
(TxData->TotalDataLength + HeadLen > IP4_MAX_PACKET_SIZE)) {
|
(TxData->TotalDataLength + HeadLen > IP4_MAX_PACKET_SIZE))
|
||||||
|
{
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
return EFI_BAD_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The callback function for the net buffer which wraps the user's
|
The callback function for the net buffer which wraps the user's
|
||||||
transmit token. Although it seems this function is pretty simple,
|
transmit token. Although it seems this function is pretty simple,
|
||||||
@ -1501,7 +1490,6 @@ Ip4FreeTxToken (
|
|||||||
FreePool (Wrap);
|
FreePool (Wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The callback function to Ip4Output to update the transmit status.
|
The callback function to Ip4Output to update the transmit status.
|
||||||
|
|
||||||
@ -1542,7 +1530,6 @@ Ip4OnPacketSent (
|
|||||||
NetbufFree (Wrap->Packet);
|
NetbufFree (Wrap->Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Places outgoing data packets into the transmit queue.
|
Places outgoing data packets into the transmit queue.
|
||||||
|
|
||||||
@ -1818,7 +1805,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Places a receiving request into the receiving queue.
|
Places a receiving request into the receiving queue.
|
||||||
|
|
||||||
@ -1910,7 +1896,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cancel the transmitted but not recycled packet. If a matching
|
Cancel the transmitted but not recycled packet. If a matching
|
||||||
token is found, it will call Ip4CancelPacket to cancel the
|
token is found, it will call Ip4CancelPacket to cancel the
|
||||||
@ -1969,7 +1954,6 @@ Ip4CancelTxTokens (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cancel the receive request. This is quiet simple, because
|
Cancel the receive request. This is quiet simple, because
|
||||||
it is only enqueued in our local receive map.
|
it is only enqueued in our local receive map.
|
||||||
@ -2015,7 +1999,6 @@ Ip4CancelRxTokens (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cancel the user's receive/transmit request.
|
Cancel the user's receive/transmit request.
|
||||||
|
|
||||||
@ -2083,15 +2066,14 @@ Ip4Cancel (
|
|||||||
// all of them are cancelled.
|
// all of them are cancelled.
|
||||||
//
|
//
|
||||||
if (!NetMapIsEmpty (&IpInstance->TxTokens) ||
|
if (!NetMapIsEmpty (&IpInstance->TxTokens) ||
|
||||||
!NetMapIsEmpty (&IpInstance->RxTokens)) {
|
!NetMapIsEmpty (&IpInstance->RxTokens))
|
||||||
|
{
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Abort an asynchronous transmit or receive request.
|
Abort an asynchronous transmit or receive request.
|
||||||
|
|
||||||
@ -2157,7 +2139,6 @@ ON_EXIT:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Polls for incoming data packets and processes outgoing data packets.
|
Polls for incoming data packets and processes outgoing data packets.
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#define IP4_SERVICE_CONFIGED 2
|
#define IP4_SERVICE_CONFIGED 2
|
||||||
#define IP4_SERVICE_DESTROY 3
|
#define IP4_SERVICE_DESTROY 3
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
|
/// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
|
||||||
/// The user's data is kept in the Packet. When fragment is
|
/// The user's data is kept in the Packet. When fragment is
|
||||||
@ -120,7 +119,6 @@ typedef struct {
|
|||||||
EFI_IP4_RECEIVE_DATA RxData;
|
EFI_IP4_RECEIVE_DATA RxData;
|
||||||
} IP4_RXDATA_WRAP;
|
} IP4_RXDATA_WRAP;
|
||||||
|
|
||||||
|
|
||||||
struct _IP4_PROTOCOL {
|
struct _IP4_PROTOCOL {
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
|
|
||||||
@ -161,7 +159,6 @@ struct _IP4_PROTOCOL {
|
|||||||
UINT32 GroupCount;
|
UINT32 GroupCount;
|
||||||
|
|
||||||
EFI_IP4_CONFIG_DATA ConfigData;
|
EFI_IP4_CONFIG_DATA ConfigData;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _IP4_SERVICE {
|
struct _IP4_SERVICE {
|
||||||
@ -230,7 +227,6 @@ struct _IP4_SERVICE {
|
|||||||
#define IP4_SERVICE_FROM_CONFIG2_INSTANCE(This) \
|
#define IP4_SERVICE_FROM_CONFIG2_INSTANCE(This) \
|
||||||
CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)
|
CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)
|
||||||
|
|
||||||
|
|
||||||
#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
|
#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
|
||||||
|
|
||||||
extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
|
extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
|
||||||
|
@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Ip4Impl.h"
|
#include "Ip4Impl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create an empty assemble entry for the packet identified by
|
Create an empty assemble entry for the packet identified by
|
||||||
(Dst, Src, Id, Protocol). The default life for the packet is
|
(Dst, Src, Id, Protocol). The default life for the packet is
|
||||||
@ -33,7 +32,6 @@ Ip4CreateAssembleEntry (
|
|||||||
IN UINT8 Protocol
|
IN UINT8 Protocol
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
IP4_ASSEMBLE_ENTRY *Assemble;
|
IP4_ASSEMBLE_ENTRY *Assemble;
|
||||||
|
|
||||||
Assemble = AllocatePool (sizeof (IP4_ASSEMBLE_ENTRY));
|
Assemble = AllocatePool (sizeof (IP4_ASSEMBLE_ENTRY));
|
||||||
@ -58,7 +56,6 @@ Ip4CreateAssembleEntry (
|
|||||||
return Assemble;
|
return Assemble;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release all the fragments of a packet, then free the assemble entry.
|
Release all the fragments of a packet, then free the assemble entry.
|
||||||
|
|
||||||
@ -84,7 +81,6 @@ Ip4FreeAssembleEntry (
|
|||||||
FreePool (Assemble);
|
FreePool (Assemble);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize an already allocated assemble table. This is generally
|
Initialize an already allocated assemble table. This is generally
|
||||||
the assemble table embedded in the IP4 service instance.
|
the assemble table embedded in the IP4 service instance.
|
||||||
@ -104,7 +100,6 @@ Ip4InitAssembleTable (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clean up the assemble table: remove all the fragments
|
Clean up the assemble table: remove all the fragments
|
||||||
and assemble entries.
|
and assemble entries.
|
||||||
@ -132,7 +127,6 @@ Ip4CleanAssembleTable (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Trim the packet to fit in [Start, End), and update the per
|
Trim the packet to fit in [Start, End), and update the per
|
||||||
packet information.
|
packet information.
|
||||||
@ -174,7 +168,6 @@ Ip4TrimPacket (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Release all the fragments of the packet. This is the callback for
|
Release all the fragments of the packet. This is the callback for
|
||||||
the assembled packet's OnFree. It will free the assemble entry,
|
the assembled packet's OnFree. It will free the assemble entry,
|
||||||
@ -192,7 +185,6 @@ Ip4OnFreeFragments (
|
|||||||
Ip4FreeAssembleEntry ((IP4_ASSEMBLE_ENTRY *)Arg);
|
Ip4FreeAssembleEntry ((IP4_ASSEMBLE_ENTRY *)Arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reassemble the IP fragments. If all the fragments of the packet
|
Reassemble the IP fragments. If all the fragments of the packet
|
||||||
have been received, it will wrap the packet in a net buffer then
|
have been received, it will wrap the packet in a net buffer then
|
||||||
@ -240,7 +232,8 @@ Ip4Reassemble (
|
|||||||
Assemble = NET_LIST_USER_STRUCT (Cur, IP4_ASSEMBLE_ENTRY, Link);
|
Assemble = NET_LIST_USER_STRUCT (Cur, IP4_ASSEMBLE_ENTRY, Link);
|
||||||
|
|
||||||
if ((Assemble->Dst == IpHead->Dst) && (Assemble->Src == IpHead->Src) &&
|
if ((Assemble->Dst == IpHead->Dst) && (Assemble->Src == IpHead->Src) &&
|
||||||
(Assemble->Id == IpHead->Id) && (Assemble->Protocol == IpHead->Protocol)) {
|
(Assemble->Id == IpHead->Id) && (Assemble->Protocol == IpHead->Protocol))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,6 +255,7 @@ Ip4Reassemble (
|
|||||||
|
|
||||||
InsertHeadList (&Table->Bucket[Index], &Assemble->Link);
|
InsertHeadList (&Table->Bucket[Index], &Assemble->Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assemble shouldn't be NULL here
|
// Assemble shouldn't be NULL here
|
||||||
//
|
//
|
||||||
@ -383,7 +377,6 @@ Ip4Reassemble (
|
|||||||
// queue ends at the total length, all data is received.
|
// queue ends at the total length, all data is received.
|
||||||
//
|
//
|
||||||
if ((Assemble->TotalLen != 0) && (Assemble->CurLen >= Assemble->TotalLen)) {
|
if ((Assemble->TotalLen != 0) && (Assemble->CurLen >= Assemble->TotalLen)) {
|
||||||
|
|
||||||
RemoveEntryList (&Assemble->Link);
|
RemoveEntryList (&Assemble->Link);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -512,6 +505,7 @@ Ip4IpSecProcessPacket (
|
|||||||
if (!mIpSec2Installed) {
|
if (!mIpSec2Installed) {
|
||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (mIpSec != NULL);
|
ASSERT (mIpSec != NULL);
|
||||||
|
|
||||||
Packet = *Netbuf;
|
Packet = *Netbuf;
|
||||||
@ -590,7 +584,7 @@ Ip4IpSecProcessPacket (
|
|||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OriginalFragmentTable == FragmentTable && OriginalFragmentCount == FragmentCount) {
|
if ((OriginalFragmentTable == FragmentTable) && (OriginalFragmentCount == FragmentCount)) {
|
||||||
//
|
//
|
||||||
// For ByPass Packet
|
// For ByPass Packet
|
||||||
//
|
//
|
||||||
@ -603,8 +597,7 @@ Ip4IpSecProcessPacket (
|
|||||||
FreePool (OriginalFragmentTable);
|
FreePool (OriginalFragmentTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Direction == EfiIPsecOutBound && TxWrap != NULL) {
|
if ((Direction == EfiIPsecOutBound) && (TxWrap != NULL)) {
|
||||||
|
|
||||||
TxWrap->IpSecRecycleSignal = RecycleEvent;
|
TxWrap->IpSecRecycleSignal = RecycleEvent;
|
||||||
TxWrap->Packet = NetbufFromExt (
|
TxWrap->Packet = NetbufFromExt (
|
||||||
FragmentTable,
|
FragmentTable,
|
||||||
@ -629,9 +622,7 @@ Ip4IpSecProcessPacket (
|
|||||||
//
|
//
|
||||||
NetIpSecNetbufFree (*Netbuf);
|
NetIpSecNetbufFree (*Netbuf);
|
||||||
*Netbuf = TxWrap->Packet;
|
*Netbuf = TxWrap->Packet;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
IpSecWrap = AllocateZeroPool (sizeof (IP4_IPSEC_WRAP));
|
IpSecWrap = AllocateZeroPool (sizeof (IP4_IPSEC_WRAP));
|
||||||
|
|
||||||
if (IpSecWrap == NULL) {
|
if (IpSecWrap == NULL) {
|
||||||
@ -659,7 +650,7 @@ Ip4IpSecProcessPacket (
|
|||||||
goto ON_EXIT;
|
goto ON_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Direction == EfiIPsecInBound && 0 != CompareMem (*Head, &ZeroHead, sizeof (IP4_HEAD))) {
|
if ((Direction == EfiIPsecInBound) && (0 != CompareMem (*Head, &ZeroHead, sizeof (IP4_HEAD)))) {
|
||||||
Ip4PrependHead (Packet, *Head, *Options, *OptionsLen);
|
Ip4PrependHead (Packet, *Head, *Options, *OptionsLen);
|
||||||
Ip4NtohHead (Packet->Ip.Ip4);
|
Ip4NtohHead (Packet->Ip.Ip4);
|
||||||
NetbufTrim (Packet, ((*Head)->HeadLen << 2), TRUE);
|
NetbufTrim (Packet, ((*Head)->HeadLen << 2), TRUE);
|
||||||
@ -670,6 +661,7 @@ Ip4IpSecProcessPacket (
|
|||||||
sizeof (IP4_CLIP_INFO)
|
sizeof (IP4_CLIP_INFO)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*Netbuf = Packet;
|
*Netbuf = Packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,7 +714,8 @@ Ip4PreProcessPacket (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((Head->Ver != 4) || (HeadLen < IP4_MIN_HEADLEN) ||
|
if ((Head->Ver != 4) || (HeadLen < IP4_MIN_HEADLEN) ||
|
||||||
(TotalLen < HeadLen) || (TotalLen != (*Packet)->TotalSize)) {
|
(TotalLen < HeadLen) || (TotalLen != (*Packet)->TotalSize))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,7 +966,6 @@ DROP:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether this IP child accepts the packet.
|
Check whether this IP child accepts the packet.
|
||||||
|
|
||||||
@ -1076,7 +1068,6 @@ Ip4InstanceFrameAcceptable (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enqueue a shared copy of the packet to the IP4 child if the
|
Enqueue a shared copy of the packet to the IP4 child if the
|
||||||
packet is acceptable to it. Here the data of the packet is
|
packet is acceptable to it. Here the data of the packet is
|
||||||
@ -1133,7 +1124,6 @@ Ip4InstanceEnquePacket (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The signal handle of IP4's recycle event. It is called back
|
The signal handle of IP4's recycle event. It is called back
|
||||||
when the upper layer release the packet.
|
when the upper layer release the packet.
|
||||||
@ -1165,7 +1155,6 @@ Ip4OnRecyclePacket (
|
|||||||
FreePool (Wrap);
|
FreePool (Wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Wrap the received packet to a IP4_RXDATA_WRAP, which will be
|
Wrap the received packet to a IP4_RXDATA_WRAP, which will be
|
||||||
delivered to the upper layer. Each IP4 child that accepts the
|
delivered to the upper layer. Each IP4 child that accepts the
|
||||||
@ -1249,7 +1238,6 @@ Ip4WrapRxData (
|
|||||||
return Wrap;
|
return Wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deliver the received packets to upper layer if there are both received
|
Deliver the received packets to upper layer if there are both received
|
||||||
requests and enqueued packets. If the enqueued packet is shared, it will
|
requests and enqueued packets. If the enqueued packet is shared, it will
|
||||||
@ -1280,8 +1268,8 @@ Ip4InstanceDeliverPacket (
|
|||||||
// Deliver a packet if there are both a packet and a receive token.
|
// Deliver a packet if there are both a packet and a receive token.
|
||||||
//
|
//
|
||||||
while (!IsListEmpty (&IpInstance->Received) &&
|
while (!IsListEmpty (&IpInstance->Received) &&
|
||||||
!NetMapIsEmpty (&IpInstance->RxTokens)) {
|
!NetMapIsEmpty (&IpInstance->RxTokens))
|
||||||
|
{
|
||||||
Packet = NET_LIST_HEAD (&IpInstance->Received, NET_BUF, List);
|
Packet = NET_LIST_HEAD (&IpInstance->Received, NET_BUF, List);
|
||||||
|
|
||||||
if (!NET_BUF_SHARED (Packet)) {
|
if (!NET_BUF_SHARED (Packet)) {
|
||||||
@ -1295,7 +1283,6 @@ Ip4InstanceDeliverPacket (
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryList (&Packet->List);
|
RemoveEntryList (&Packet->List);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Create a duplicated packet if this packet is shared
|
// Create a duplicated packet if this packet is shared
|
||||||
@ -1358,7 +1345,6 @@ Ip4InstanceDeliverPacket (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enqueue a received packet to all the IP children that share
|
Enqueue a received packet to all the IP children that share
|
||||||
the same interface.
|
the same interface.
|
||||||
@ -1406,7 +1392,6 @@ Ip4InterfaceEnquePacket (
|
|||||||
// that later.
|
// that later.
|
||||||
//
|
//
|
||||||
LocalType = Info->CastType;
|
LocalType = Info->CastType;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Check the destination against local IP. If the station
|
// Check the destination against local IP. If the station
|
||||||
@ -1416,7 +1401,6 @@ Ip4InterfaceEnquePacket (
|
|||||||
//
|
//
|
||||||
if (IpIf->Ip == IP4_ALLZERO_ADDRESS) {
|
if (IpIf->Ip == IP4_ALLZERO_ADDRESS) {
|
||||||
LocalType = IP4_LOCAL_HOST;
|
LocalType = IP4_LOCAL_HOST;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LocalType = Ip4GetNetCast (Head->Dst, IpIf);
|
LocalType = Ip4GetNetCast (Head->Dst, IpIf);
|
||||||
|
|
||||||
@ -1461,7 +1445,6 @@ Ip4InterfaceEnquePacket (
|
|||||||
return Enqueued;
|
return Enqueued;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deliver the packet for each IP4 child on the interface.
|
Deliver the packet for each IP4 child on the interface.
|
||||||
|
|
||||||
@ -1488,7 +1471,6 @@ Ip4InterfaceDeliverPacket (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Demultiple the packet. the packet delivery is processed in two
|
Demultiple the packet. the packet delivery is processed in two
|
||||||
passes. The first pass will enqueue a shared copy of the packet
|
passes. The first pass will enqueue a shared copy of the packet
|
||||||
@ -1565,7 +1547,6 @@ Ip4Demultiplex (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Timeout the fragment and enqueued packets.
|
Timeout the fragment and enqueued packets.
|
||||||
|
|
||||||
|
@ -42,4 +42,3 @@ typedef struct {
|
|||||||
} IP4_CONFIG2_IFR_NVDATA;
|
} IP4_CONFIG2_IFR_NVDATA;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Ip4Impl.h"
|
#include "Ip4Impl.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Validate the IP4 option format for both the packets we received
|
Validate the IP4 option format for both the packets we received
|
||||||
and will transmit.
|
and will transmit.
|
||||||
@ -68,8 +67,8 @@ Ip4OptionIsValid (
|
|||||||
// source route option.
|
// source route option.
|
||||||
//
|
//
|
||||||
if ((Option[Cur] != IP4_OPTION_RR) &&
|
if ((Option[Cur] != IP4_OPTION_RR) &&
|
||||||
((Rcvd && (Point != Len + 1)) || (!Rcvd && (Point != 4)))) {
|
((Rcvd && (Point != Len + 1)) || (!Rcvd && (Point != 4))))
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,13 +85,11 @@ Ip4OptionIsValid (
|
|||||||
Cur = Cur + Len;
|
Cur = Cur + Len;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Copy the option from the original option to buffer. It
|
Copy the option from the original option to buffer. It
|
||||||
handles the details such as:
|
handles the details such as:
|
||||||
@ -142,18 +139,16 @@ Ip4CopyOption (
|
|||||||
OptBuf[Next] = IP4_OPTION_NOP;
|
OptBuf[Next] = IP4_OPTION_NOP;
|
||||||
Next++;
|
Next++;
|
||||||
Cur++;
|
Cur++;
|
||||||
|
|
||||||
} else if (Type == IP4_OPTION_EOP) {
|
} else if (Type == IP4_OPTION_EOP) {
|
||||||
//
|
//
|
||||||
// Don't append the EOP to avoid including only a EOP option
|
// Don't append the EOP to avoid including only a EOP option
|
||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// don't copy options that is only valid for the first fragment
|
// don't copy options that is only valid for the first fragment
|
||||||
//
|
//
|
||||||
if (FirstFragment || (Type & IP4_OPTION_COPY_MASK) != 0) {
|
if (FirstFragment || ((Type & IP4_OPTION_COPY_MASK) != 0)) {
|
||||||
CopyMem (OptBuf + Next, Option + Cur, Len);
|
CopyMem (OptBuf + Next, Option + Cur, Len);
|
||||||
Next += Len;
|
Next += Len;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user