Use Mde library and definition instead of some native definitions in NetLib, to simply network library.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4693 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -141,9 +141,9 @@ DhcpConfigUdpIo (
|
||||
UdpConfigData.StationPort = DHCP_CLIENT_PORT;
|
||||
UdpConfigData.RemotePort = DHCP_SERVER_PORT;
|
||||
|
||||
NetZeroMem (&UdpConfigData.StationAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
NetZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||
NetZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&UdpConfigData.StationAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&UdpConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
return UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ Dhcp4CreateService (
|
||||
EFI_STATUS Status;
|
||||
|
||||
*Service = NULL;
|
||||
DhcpSb = NetAllocateZeroPool (sizeof (DHCP_SERVICE));
|
||||
DhcpSb = AllocateZeroPool (sizeof (DHCP_SERVICE));
|
||||
|
||||
if (DhcpSb == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -220,7 +220,7 @@ Dhcp4CreateService (
|
||||
DhcpSb->InDestory = FALSE;
|
||||
DhcpSb->Controller = Controller;
|
||||
DhcpSb->Image = ImageHandle;
|
||||
NetListInit (&DhcpSb->Children);
|
||||
InitializeListHead (&DhcpSb->Children);
|
||||
DhcpSb->DhcpState = Dhcp4Stopped;
|
||||
DhcpSb->Xid = NET_RANDOM (NetRandomInitSeed ());
|
||||
|
||||
@@ -229,7 +229,7 @@ Dhcp4CreateService (
|
||||
//
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL | EVT_TIMER,
|
||||
NET_TPL_TIMER,
|
||||
TPL_CALLBACK,
|
||||
DhcpOnTimerTick,
|
||||
DhcpSb,
|
||||
&DhcpSb->Timer
|
||||
@@ -255,7 +255,7 @@ Dhcp4CreateService (
|
||||
|
||||
ON_ERROR:
|
||||
Dhcp4CloseService (DhcpSb);
|
||||
NetFreePool (DhcpSb);
|
||||
gBS->FreePool (DhcpSb);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ Dhcp4DriverBindingStart (
|
||||
|
||||
ON_ERROR:
|
||||
Dhcp4CloseService (DhcpSb);
|
||||
NetFreePool (DhcpSb);
|
||||
gBS->FreePool (DhcpSb);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ Dhcp4DriverBindingStop (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
if (NumberOfChildren == 0) {
|
||||
|
||||
@@ -409,13 +409,13 @@ Dhcp4DriverBindingStop (
|
||||
|
||||
Dhcp4CloseService (DhcpSb);
|
||||
|
||||
NetFreePool (DhcpSb);
|
||||
gBS->FreePool (DhcpSb);
|
||||
} else {
|
||||
//
|
||||
// Don't use NET_LIST_FOR_EACH_SAFE here, Dhcp4ServiceBindingDestoryChild
|
||||
// may cause other child to be deleted.
|
||||
//
|
||||
while (!NetListIsEmpty (&DhcpSb->Children)) {
|
||||
while (!IsListEmpty (&DhcpSb->Children)) {
|
||||
Instance = NET_LIST_HEAD (&DhcpSb->Children, DHCP_PROTOCOL, Link);
|
||||
ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
|
||||
}
|
||||
@@ -425,7 +425,7 @@ Dhcp4DriverBindingStop (
|
||||
}
|
||||
}
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -448,7 +448,7 @@ DhcpInitProtocol (
|
||||
{
|
||||
Instance->Signature = DHCP_PROTOCOL_SIGNATURE;
|
||||
CopyMem (&Instance->Dhcp4Protocol, &mDhcp4ProtocolTemplate, sizeof (Instance->Dhcp4Protocol));
|
||||
NetListInit (&Instance->Link);
|
||||
InitializeListHead (&Instance->Link);
|
||||
Instance->Handle = NULL;
|
||||
Instance->Service = DhcpSb;
|
||||
Instance->InDestory = FALSE;
|
||||
@@ -492,7 +492,7 @@ Dhcp4ServiceBindingCreateChild (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Instance = NetAllocatePool (sizeof (*Instance));
|
||||
Instance = AllocatePool (sizeof (*Instance));
|
||||
|
||||
if (Instance == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -512,7 +512,7 @@ Dhcp4ServiceBindingCreateChild (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
NetFreePool (Instance);
|
||||
gBS->FreePool (Instance);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -537,16 +537,16 @@ Dhcp4ServiceBindingCreateChild (
|
||||
NULL
|
||||
);
|
||||
|
||||
NetFreePool (Instance);
|
||||
gBS->FreePool (Instance);
|
||||
return Status;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
NetListInsertTail (&DhcpSb->Children, &Instance->Link);
|
||||
InsertTailList (&DhcpSb->Children, &Instance->Link);
|
||||
DhcpSb->NumChildren++;
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -617,7 +617,7 @@ Dhcp4ServiceBindingDestroyChild (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
Instance->InDestory = TRUE;
|
||||
|
||||
//
|
||||
@@ -642,7 +642,7 @@ Dhcp4ServiceBindingDestroyChild (
|
||||
if (EFI_ERROR (Status)) {
|
||||
Instance->InDestory = FALSE;
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -650,11 +650,11 @@ Dhcp4ServiceBindingDestroyChild (
|
||||
DhcpYieldControl (DhcpSb);
|
||||
}
|
||||
|
||||
NetListRemoveEntry (&Instance->Link);
|
||||
RemoveEntryList (&Instance->Link);
|
||||
DhcpSb->NumChildren--;
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
NetFreePool (Instance);
|
||||
gBS->FreePool (Instance);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ EfiDhcp4GetModeData (
|
||||
|
||||
Instance = DHCP_INSTANCE_FROM_THIS (This);
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
DhcpSb = Instance->Service;
|
||||
|
||||
//
|
||||
@@ -70,28 +70,28 @@ EfiDhcp4GetModeData (
|
||||
CopyMem (&Dhcp4ModeData->ClientMacAddress, &DhcpSb->Mac, sizeof (Dhcp4ModeData->ClientMacAddress));
|
||||
|
||||
Ip = HTONL (DhcpSb->ClientAddr);
|
||||
NetCopyMem (&Dhcp4ModeData->ClientAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Dhcp4ModeData->ClientAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Ip = HTONL (DhcpSb->Netmask);
|
||||
NetCopyMem (&Dhcp4ModeData->SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Dhcp4ModeData->SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Ip = HTONL (DhcpSb->ServerAddr);
|
||||
NetCopyMem (&Dhcp4ModeData->ServerAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Dhcp4ModeData->ServerAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Para = DhcpSb->Para;
|
||||
|
||||
if (Para != NULL) {
|
||||
Ip = HTONL (Para->Router);
|
||||
NetCopyMem (&Dhcp4ModeData->RouterAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Dhcp4ModeData->RouterAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
Dhcp4ModeData->LeaseTime = Para->Lease;
|
||||
} else {
|
||||
NetZeroMem (&Dhcp4ModeData->RouterAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&Dhcp4ModeData->RouterAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
Dhcp4ModeData->LeaseTime = 0xffffffff;
|
||||
}
|
||||
|
||||
Dhcp4ModeData->ReplyPacket = DhcpSb->Selected;
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -114,24 +114,24 @@ DhcpCleanConfigure (
|
||||
UINT32 Index;
|
||||
|
||||
if (Config->DiscoverTimeout != NULL) {
|
||||
NetFreePool (Config->DiscoverTimeout);
|
||||
gBS->FreePool (Config->DiscoverTimeout);
|
||||
}
|
||||
|
||||
if (Config->RequestTimeout != NULL) {
|
||||
NetFreePool (Config->RequestTimeout);
|
||||
gBS->FreePool (Config->RequestTimeout);
|
||||
}
|
||||
|
||||
if (Config->OptionList != NULL) {
|
||||
for (Index = 0; Index < Config->OptionCount; Index++) {
|
||||
if (Config->OptionList[Index] != NULL) {
|
||||
NetFreePool (Config->OptionList[Index]);
|
||||
gBS->FreePool (Config->OptionList[Index]);
|
||||
}
|
||||
}
|
||||
|
||||
NetFreePool (Config->OptionList);
|
||||
gBS->FreePool (Config->OptionList);
|
||||
}
|
||||
|
||||
NetZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
|
||||
ZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ DhcpCopyConfigure (
|
||||
//
|
||||
if (Src->DiscoverTimeout != NULL) {
|
||||
Len = Src->DiscoverTryCount * sizeof (UINT32);
|
||||
Dst->DiscoverTimeout = NetAllocatePool (Len);
|
||||
Dst->DiscoverTimeout = AllocatePool (Len);
|
||||
|
||||
if (Dst->DiscoverTimeout == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -183,7 +183,7 @@ DhcpCopyConfigure (
|
||||
//
|
||||
if (Src->RequestTimeout != NULL) {
|
||||
Len = Src->RequestTryCount * sizeof (UINT32);
|
||||
Dst->RequestTimeout = NetAllocatePool (Len);
|
||||
Dst->RequestTimeout = AllocatePool (Len);
|
||||
|
||||
if (Dst->RequestTimeout == NULL) {
|
||||
goto ON_ERROR;
|
||||
@@ -200,7 +200,7 @@ DhcpCopyConfigure (
|
||||
//
|
||||
if (Src->OptionList != NULL) {
|
||||
Len = Src->OptionCount * sizeof (EFI_DHCP4_PACKET_OPTION *);
|
||||
Dst->OptionList = NetAllocateZeroPool (Len);
|
||||
Dst->OptionList = AllocateZeroPool (Len);
|
||||
|
||||
if (Dst->OptionList == NULL) {
|
||||
goto ON_ERROR;
|
||||
@@ -212,13 +212,13 @@ DhcpCopyConfigure (
|
||||
for (Index = 0; Index < Src->OptionCount; Index++) {
|
||||
Len = sizeof (EFI_DHCP4_PACKET_OPTION) + MAX (SrcOptions[Index]->Length - 1, 0);
|
||||
|
||||
DstOptions[Index] = NetAllocatePool (Len);
|
||||
DstOptions[Index] = AllocatePool (Len);
|
||||
|
||||
if (DstOptions[Index] == NULL) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
|
||||
NetCopyMem (DstOptions[Index], SrcOptions[Index], Len);
|
||||
CopyMem (DstOptions[Index], SrcOptions[Index], Len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ DhcpYieldControl (
|
||||
DhcpSb->ActiveChild = NULL;
|
||||
|
||||
if (Config->DiscoverTimeout != NULL) {
|
||||
NetFreePool (Config->DiscoverTimeout);
|
||||
gBS->FreePool (Config->DiscoverTimeout);
|
||||
|
||||
Config->DiscoverTryCount = 0;
|
||||
Config->DiscoverTimeout = NULL;
|
||||
}
|
||||
|
||||
if (Config->RequestTimeout != NULL) {
|
||||
NetFreePool (Config->RequestTimeout);
|
||||
gBS->FreePool (Config->RequestTimeout);
|
||||
|
||||
Config->RequestTryCount = 0;
|
||||
Config->RequestTimeout = NULL;
|
||||
@@ -322,7 +322,7 @@ EfiDhcp4Configure (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
NetCopyMem (&Ip, &Dhcp4CfgData->ClientAddress, sizeof (IP4_ADDR));
|
||||
CopyMem (&Ip, &Dhcp4CfgData->ClientAddress, sizeof (IP4_ADDR));
|
||||
|
||||
if ((Ip != 0) && !Ip4IsUnicast (NTOHL (Ip), 0)) {
|
||||
|
||||
@@ -336,7 +336,7 @@ EfiDhcp4Configure (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
DhcpSb = Instance->Service;
|
||||
Config = &DhcpSb->ActiveConfig;
|
||||
@@ -390,7 +390,7 @@ EfiDhcp4Configure (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ EfiDhcp4Start (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
DhcpSb = Instance->Service;
|
||||
|
||||
if (DhcpSb->DhcpState == Dhcp4Stopped) {
|
||||
@@ -464,9 +464,9 @@ EfiDhcp4Start (
|
||||
Instance->CompletionEvent = CompletionEvent;
|
||||
|
||||
//
|
||||
// Restore the TPL now, don't call poll function at NET_TPL_LOCK.
|
||||
// Restore the TPL now, don't call poll function at TPL_CALLBACK.
|
||||
//
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (CompletionEvent == NULL) {
|
||||
while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {
|
||||
@@ -479,7 +479,7 @@ EfiDhcp4Start (
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_ERROR:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ EfiDhcp4RenewRebind (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
DhcpSb = Instance->Service;
|
||||
|
||||
if (DhcpSb->DhcpState == Dhcp4Stopped) {
|
||||
@@ -567,7 +567,7 @@ EfiDhcp4RenewRebind (
|
||||
DhcpSb->IoStatus = EFI_ALREADY_STARTED;
|
||||
Instance->RenewRebindEvent = CompletionEvent;
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (CompletionEvent == NULL) {
|
||||
while (DhcpSb->IoStatus == EFI_ALREADY_STARTED) {
|
||||
@@ -580,7 +580,7 @@ EfiDhcp4RenewRebind (
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_ERROR:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ EfiDhcp4Release (
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
DhcpSb = Instance->Service;
|
||||
|
||||
if ((DhcpSb->DhcpState != Dhcp4InitReboot) && (DhcpSb->DhcpState != Dhcp4Bound)) {
|
||||
@@ -649,7 +649,7 @@ EfiDhcp4Release (
|
||||
DhcpCleanLease (DhcpSb);
|
||||
|
||||
ON_EXIT:
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ EfiDhcp4Stop (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
DhcpSb = Instance->Service;
|
||||
|
||||
DhcpCleanLease (DhcpSb);
|
||||
@@ -696,7 +696,7 @@ EfiDhcp4Stop (
|
||||
DhcpSb->DhcpState = Dhcp4Stopped;
|
||||
DhcpSb->ServiceState = DHCP_UNCONFIGED;
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ Dhcp4InstanceConfigUdpIo (
|
||||
DhcpSb = Instance->Service;
|
||||
Token = Instance->Token;
|
||||
|
||||
NetZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA));
|
||||
ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA));
|
||||
|
||||
UdpConfigData.AcceptBroadcast = TRUE;
|
||||
UdpConfigData.AllowDuplicatePort = TRUE;
|
||||
@@ -787,10 +787,10 @@ Dhcp4InstanceConfigUdpIo (
|
||||
UdpConfigData.DoNotFragment = TRUE;
|
||||
|
||||
Ip = HTONL (DhcpSb->ClientAddr);
|
||||
NetCopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Ip = HTONL (DhcpSb->Netmask);
|
||||
NetCopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
if ((Token->ListenPointCount == 0) || (Token->ListenPoints[0].ListenPort == 0)) {
|
||||
UdpConfigData.StationPort = DHCP_CLIENT_PORT;
|
||||
@@ -951,7 +951,7 @@ PxeDhcpDone (
|
||||
|
||||
Token->ResponseCount = Instance->ResponseQueue.BufNum;
|
||||
if (Token->ResponseCount != 0) {
|
||||
Token->ResponseList = (EFI_DHCP4_PACKET *) NetAllocatePool (Instance->ResponseQueue.BufSize);
|
||||
Token->ResponseList = (EFI_DHCP4_PACKET *) AllocatePool (Instance->ResponseQueue.BufSize);
|
||||
if (Token->ResponseList == NULL) {
|
||||
Token->Status = EFI_OUT_OF_RESOURCES;
|
||||
goto SIGNAL_USER;
|
||||
@@ -1045,7 +1045,7 @@ EfiDhcp4TransmitReceive (
|
||||
return EFI_NO_MAPPING;
|
||||
}
|
||||
|
||||
OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
//
|
||||
// Save the token and the timeout value.
|
||||
@@ -1081,7 +1081,7 @@ EfiDhcp4TransmitReceive (
|
||||
//
|
||||
// Set the destination address and destination port.
|
||||
//
|
||||
NetCopyMem (&Ip, &Token->RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Ip, &Token->RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
EndPoint.RemoteAddr = NTOHL (Ip);
|
||||
|
||||
if (Token->RemotePort == 0) {
|
||||
@@ -1096,7 +1096,7 @@ EfiDhcp4TransmitReceive (
|
||||
SubnetMask = DhcpSb->Netmask;
|
||||
Gateway = 0;
|
||||
if (!IP4_NET_EQUAL (DhcpSb->ClientAddr, EndPoint.RemoteAddr, SubnetMask)) {
|
||||
NetCopyMem (&Gateway, &Token->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Gateway, &Token->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
Gateway = NTOHL (Gateway);
|
||||
}
|
||||
|
||||
@@ -1126,7 +1126,7 @@ ON_ERROR:
|
||||
Instance->Token = NULL;
|
||||
}
|
||||
|
||||
NET_RESTORE_TPL (OldTpl);
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (!EFI_ERROR (Status) && (Token->CompletionEvent == NULL)) {
|
||||
//
|
||||
@@ -1228,7 +1228,7 @@ EfiDhcp4Parse (
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
NetZeroMem (PacketOptionList, *OptionCount * sizeof (EFI_DHCP4_PACKET_OPTION *));
|
||||
ZeroMem (PacketOptionList, *OptionCount * sizeof (EFI_DHCP4_PACKET_OPTION *));
|
||||
|
||||
Context.Option = PacketOptionList;
|
||||
Context.OptionCount = *OptionCount;
|
||||
|
@@ -67,7 +67,7 @@ enum {
|
||||
struct _DHCP_PROTOCOL {
|
||||
UINT32 Signature;
|
||||
EFI_DHCP4_PROTOCOL Dhcp4Protocol;
|
||||
NET_LIST_ENTRY Link;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HANDLE Handle;
|
||||
DHCP_SERVICE *Service;
|
||||
|
||||
@@ -96,7 +96,7 @@ struct _DHCP_SERVICE {
|
||||
EFI_HANDLE Controller;
|
||||
EFI_HANDLE Image;
|
||||
|
||||
NET_LIST_ENTRY Children;
|
||||
LIST_ENTRY Children;
|
||||
UINTN NumChildren;
|
||||
|
||||
INTN DhcpState;
|
||||
|
@@ -358,12 +358,12 @@ DhcpConfigLeaseIoPort (
|
||||
UdpConfigData.RemotePort = DHCP_SERVER_PORT;
|
||||
|
||||
Ip = HTONL (DhcpSb->ClientAddr);
|
||||
NetCopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Ip = HTONL (DhcpSb->Netmask);
|
||||
NetCopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
NetZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&UdpConfigData.RemoteAddress, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Status = UdpIo->Udp->Configure (UdpIo->Udp, &UdpConfigData);
|
||||
|
||||
@@ -375,10 +375,10 @@ DhcpConfigLeaseIoPort (
|
||||
// Add a default route if received from the server.
|
||||
//
|
||||
if ((DhcpSb->Para != NULL) && (DhcpSb->Para->Router != 0)) {
|
||||
NetZeroMem (&Subnet, sizeof (EFI_IPv4_ADDRESS));
|
||||
ZeroMem (&Subnet, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
Ip = HTONL (DhcpSb->Para->Router);
|
||||
NetCopyMem (&Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
CopyMem (&Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));
|
||||
|
||||
UdpIo->Udp->Routes (UdpIo->Udp, FALSE, &Subnet, &Subnet, &Gateway);
|
||||
}
|
||||
@@ -465,17 +465,17 @@ DhcpCleanLease (
|
||||
DhcpSb->ServerAddr = 0;
|
||||
|
||||
if (DhcpSb->LastOffer != NULL) {
|
||||
NetFreePool (DhcpSb->LastOffer);
|
||||
gBS->FreePool (DhcpSb->LastOffer);
|
||||
DhcpSb->LastOffer = NULL;
|
||||
}
|
||||
|
||||
if (DhcpSb->Selected != NULL) {
|
||||
NetFreePool (DhcpSb->Selected);
|
||||
gBS->FreePool (DhcpSb->Selected);
|
||||
DhcpSb->Selected = NULL;
|
||||
}
|
||||
|
||||
if (DhcpSb->Para != NULL) {
|
||||
NetFreePool (DhcpSb->Para);
|
||||
gBS->FreePool (DhcpSb->Para);
|
||||
DhcpSb->Para = NULL;
|
||||
}
|
||||
|
||||
@@ -545,10 +545,10 @@ DhcpChooseOffer (
|
||||
Selected = DhcpSb->LastOffer;
|
||||
|
||||
if ((NewPacket != NULL) && !EFI_ERROR (DhcpValidateOptions (NewPacket, NULL))) {
|
||||
TempPacket = (EFI_DHCP4_PACKET *) NetAllocatePool (NewPacket->Size);
|
||||
TempPacket = (EFI_DHCP4_PACKET *) AllocatePool (NewPacket->Size);
|
||||
if (TempPacket != NULL) {
|
||||
NetCopyMem (TempPacket, NewPacket, NewPacket->Size);
|
||||
NetFreePool (Selected);
|
||||
CopyMem (TempPacket, NewPacket, NewPacket->Size);
|
||||
gBS->FreePool (Selected);
|
||||
Selected = TempPacket;
|
||||
}
|
||||
}
|
||||
@@ -664,7 +664,7 @@ DhcpHandleSelect (
|
||||
|
||||
if (Status == EFI_SUCCESS) {
|
||||
if (DhcpSb->LastOffer != NULL) {
|
||||
NetFreePool (DhcpSb->LastOffer);
|
||||
gBS->FreePool (DhcpSb->LastOffer);
|
||||
}
|
||||
|
||||
DhcpSb->LastOffer = Packet;
|
||||
@@ -673,7 +673,7 @@ DhcpHandleSelect (
|
||||
|
||||
} else if (Status == EFI_NOT_READY) {
|
||||
if (DhcpSb->LastOffer != NULL) {
|
||||
NetFreePool (DhcpSb->LastOffer);
|
||||
gBS->FreePool (DhcpSb->LastOffer);
|
||||
}
|
||||
|
||||
DhcpSb->LastOffer = Packet;
|
||||
@@ -689,7 +689,7 @@ DhcpHandleSelect (
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -775,14 +775,14 @@ DhcpHandleRequest (
|
||||
DhcpSb->IoStatus = EFI_SUCCESS;
|
||||
DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_COMPLETION);
|
||||
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return EFI_SUCCESS;
|
||||
|
||||
REJECT:
|
||||
DhcpSendMessage (DhcpSb, DhcpSb->Selected, DhcpSb->Para, DHCP_MSG_DECLINE, Message);
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ DhcpHandleRenewRebind (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ DhcpHandleReboot (
|
||||
//
|
||||
// OK, get the parameter from server, record the lease
|
||||
//
|
||||
DhcpSb->Para = NetAllocatePool (sizeof (DHCP_PARAMETER));
|
||||
DhcpSb->Para = AllocatePool (sizeof (DHCP_PARAMETER));
|
||||
|
||||
if (DhcpSb->Para == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -956,7 +956,7 @@ DhcpHandleReboot (
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1018,7 @@ DhcpInput (
|
||||
// Copy the DHCP message to a continuous memory block
|
||||
//
|
||||
Len = sizeof (EFI_DHCP4_PACKET) + UdpPacket->TotalSize - sizeof (EFI_DHCP4_HEADER);
|
||||
Packet = (EFI_DHCP4_PACKET *) NetAllocatePool (Len);
|
||||
Packet = (EFI_DHCP4_PACKET *) AllocatePool (Len);
|
||||
|
||||
if (Packet == NULL) {
|
||||
goto RESTART;
|
||||
@@ -1078,7 +1078,7 @@ DhcpInput (
|
||||
//
|
||||
// Ignore the packet in INITREBOOT, INIT and BOUND states
|
||||
//
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
|
||||
@@ -1093,7 +1093,7 @@ DhcpInput (
|
||||
}
|
||||
|
||||
if (Para != NULL) {
|
||||
NetFreePool (Para);
|
||||
gBS->FreePool (Para);
|
||||
}
|
||||
|
||||
Packet = NULL;
|
||||
@@ -1108,7 +1108,7 @@ RESTART:
|
||||
NetbufFree (UdpPacket);
|
||||
|
||||
if (Packet != NULL) {
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
}
|
||||
|
||||
Status = UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);
|
||||
@@ -1132,7 +1132,7 @@ DhcpReleasePacket (
|
||||
IN VOID *Arg
|
||||
)
|
||||
{
|
||||
NetFreePool (Arg);
|
||||
gBS->FreePool (Arg);
|
||||
}
|
||||
|
||||
|
||||
@@ -1212,7 +1212,7 @@ DhcpSendMessage (
|
||||
Len += (UINT32)AsciiStrLen ((CHAR8 *) Msg);
|
||||
}
|
||||
|
||||
Packet = NetAllocatePool (Len);
|
||||
Packet = AllocatePool (Len);
|
||||
|
||||
if (Packet == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -1232,7 +1232,7 @@ DhcpSendMessage (
|
||||
}
|
||||
|
||||
Head = &Packet->Dhcp4.Header;
|
||||
NetZeroMem (Head, sizeof (EFI_DHCP4_HEADER));
|
||||
ZeroMem (Head, sizeof (EFI_DHCP4_HEADER));
|
||||
|
||||
Head->OpCode = BOOTP_REQUEST;
|
||||
Head->HwType = DhcpSb->HwType;
|
||||
@@ -1241,7 +1241,7 @@ DhcpSendMessage (
|
||||
Head->Reserved = HTONS (0x8000); //Server, broadcast the message please.
|
||||
|
||||
EFI_IP4 (Head->ClientAddr) = HTONL (DhcpSb->ClientAddr);
|
||||
NetCopyMem (Head->ClientHwAddr, DhcpSb->Mac.Addr, DhcpSb->HwLen);
|
||||
CopyMem (Head->ClientHwAddr, DhcpSb->Mac.Addr, DhcpSb->HwLen);
|
||||
|
||||
//
|
||||
// Append the DHCP message type
|
||||
@@ -1352,12 +1352,12 @@ DhcpSendMessage (
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (NewPacket != NULL) {
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
Packet = NewPacket;
|
||||
}
|
||||
|
||||
@@ -1369,7 +1369,7 @@ DhcpSendMessage (
|
||||
Wrap = NetbufFromExt (&Frag, 1, 0, 0, DhcpReleasePacket, Packet);
|
||||
|
||||
if (Wrap == NULL) {
|
||||
NetFreePool (Packet);
|
||||
gBS->FreePool (Packet);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
@@ -526,7 +526,7 @@ DhcpFillOption (
|
||||
Options[Index].Data = Buf + OptCount[Tag].Offset;
|
||||
}
|
||||
|
||||
NetCopyMem (Buf + OptCount[Tag].Offset, Data, Len);
|
||||
CopyMem (Buf + OptCount[Tag].Offset, Data, Len);
|
||||
|
||||
OptCount[Tag].Offset = (UINT16) (OptCount[Tag].Offset + Len);
|
||||
Options[Index].Len = (UINT16) (Options[Index].Len + Len);
|
||||
@@ -582,7 +582,7 @@ DhcpParseOption (
|
||||
// First compute how many options and how long each option is
|
||||
// with the "Key indexed counting" algorithms.
|
||||
//
|
||||
OptCount = NetAllocateZeroPool (DHCP_MAX_OPTIONS * sizeof (DHCP_OPTION_COUNT));
|
||||
OptCount = AllocateZeroPool (DHCP_MAX_OPTIONS * sizeof (DHCP_OPTION_COUNT));
|
||||
|
||||
if (OptCount == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -624,7 +624,7 @@ DhcpParseOption (
|
||||
// Allocate a buffer to hold the DHCP options, and after that, a
|
||||
// continuous buffer to put all the options' data.
|
||||
//
|
||||
Options = NetAllocateZeroPool (OptNum * sizeof (DHCP_OPTION) + TotalLen);
|
||||
Options = AllocateZeroPool (OptNum * sizeof (DHCP_OPTION) + TotalLen);
|
||||
|
||||
if (Options == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -638,14 +638,14 @@ DhcpParseOption (
|
||||
Status = DhcpIterateOptions (Packet, DhcpFillOption, &Context);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
NetFreePool (Options);
|
||||
gBS->FreePool (Options);
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
*OptionPoint = Options;
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (OptCount);
|
||||
gBS->FreePool (OptCount);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -689,7 +689,7 @@ DhcpValidateOptions (
|
||||
}
|
||||
|
||||
Updated = FALSE;
|
||||
NetZeroMem (&Parameter, sizeof (Parameter));
|
||||
ZeroMem (&Parameter, sizeof (Parameter));
|
||||
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
Option = &AllOption[Index];
|
||||
@@ -722,7 +722,7 @@ DhcpValidateOptions (
|
||||
}
|
||||
|
||||
if (Updated && (Para != NULL)) {
|
||||
if ((*Para = NetAllocatePool (sizeof (DHCP_PARAMETER))) == NULL) {
|
||||
if ((*Para = AllocatePool (sizeof (DHCP_PARAMETER))) == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
@@ -731,7 +731,7 @@ DhcpValidateOptions (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
NetFreePool (AllOption);
|
||||
gBS->FreePool (AllOption);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ DhcpAppendOption (
|
||||
|
||||
*(Buf++) = Tag;
|
||||
*(Buf++) = (UINT8) Len;
|
||||
NetCopyMem (Buf, Data + Index * 255, Len);
|
||||
CopyMem (Buf, Data + Index * 255, Len);
|
||||
|
||||
Buf += Len;
|
||||
}
|
||||
@@ -815,7 +815,7 @@ DhcpBuild (
|
||||
// Use an array of DHCP_OPTION to mark the existance
|
||||
// and position of each valid options.
|
||||
//
|
||||
Mark = NetAllocatePool (sizeof (DHCP_OPTION) * DHCP_MAX_OPTIONS);
|
||||
Mark = AllocatePool (sizeof (DHCP_OPTION) * DHCP_MAX_OPTIONS);
|
||||
|
||||
if (Mark == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -871,7 +871,7 @@ DhcpBuild (
|
||||
}
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
Packet = (EFI_DHCP4_PACKET *) NetAllocatePool (Len);
|
||||
Packet = (EFI_DHCP4_PACKET *) AllocatePool (Len);
|
||||
|
||||
if (Packet == NULL) {
|
||||
goto ON_ERROR;
|
||||
@@ -898,9 +898,9 @@ DhcpBuild (
|
||||
|
||||
ON_ERROR:
|
||||
if (SeedOptions != NULL) {
|
||||
NetFreePool (SeedOptions);
|
||||
gBS->FreePool (SeedOptions);
|
||||
}
|
||||
|
||||
NetFreePool (Mark);
|
||||
gBS->FreePool (Mark);
|
||||
return Status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user