summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authortye <tye@6f19259b-4bc3-4df7-8a09-765794883524>2009-10-21 09:37:10 +0000
committertye <tye@6f19259b-4bc3-4df7-8a09-765794883524>2009-10-21 09:37:10 +0000
commitc5bcc2e2abf1190632aad8b1979c84ffc1c17d98 (patch)
tree2a7b2816ef6ff08f1ef4daf37ad34b568fb6f114 /MdeModulePkg
parent39ef213c856c61e860a1d69028be218cdb73ae6f (diff)
downloadedk2-c5bcc2e2abf1190632aad8b1979c84ffc1c17d98.zip
edk2-c5bcc2e2abf1190632aad8b1979c84ffc1c17d98.tar.gz
edk2-c5bcc2e2abf1190632aad8b1979c84ffc1c17d98.tar.bz2
1. Fix a bug in Dhcp4 to prevent unexpected broadcast DHCP packets be queued up in the system: these packets will never be freed and will cumulate as time goes on, and then it will cause the system becomes very slow. This issue is reported by HP.
2. Sync HSD #210249 patch: Fix bug in handling certain network errors in EfiDhcp4TransmitReceive() for DHCP4 driver 3. Enhance DhcpCleanLease to clear Netmask as well, so that Dhcp4->GetModeData() could return clean data in Dhcp4Stopped state. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9354 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c10
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c23
-rw-r--r--MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c2
3 files changed, 24 insertions, 11 deletions
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
index 5ccbefd..1ca0589 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006 - 2008, Intel Corporation.<BR>
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -310,6 +310,14 @@ Dhcp4DriverBindingStart (
return Status;
}
+ //
+ // Start the receiving
+ //
+ Status = UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);
+
+ if (EFI_ERROR (Status)) {
+ goto ON_ERROR;
+ }
Status = gBS->SetTimer (DhcpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);
if (EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
index 9003190..a4b8fa8 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
@@ -816,14 +816,6 @@ EfiDhcp4Start (
goto ON_ERROR;
}
- //
- // Start/Restart the receiving.
- //
- Status = UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);
-
- if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
- goto ON_ERROR;
- }
Instance->CompletionEvent = CompletionEvent;
@@ -1584,8 +1576,19 @@ ON_ERROR:
// Keep polling until timeout if no error happens and the CompletionEvent
// is NULL.
//
- while (Instance->Timeout != 0) {
- Instance->UdpIo->Udp->Poll (Instance->UdpIo->Udp);
+ while (TRUE) {
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ //
+ // Raise TPL to protect the UDPIO in instance, in case that DhcpOnTimerTick
+ // free it when timeout.
+ //
+ if (Instance->Timeout > 0) {
+ Instance->UdpIo->Udp->Poll (Instance->UdpIo->Udp);
+ gBS->RestoreTPL (OldTpl);
+ } else {
+ gBS->RestoreTPL (OldTpl);
+ break;
+ }
}
}
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 1b3afa3..be8ceb0 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -443,6 +443,7 @@ DhcpCleanLease (
DhcpSb->DhcpState = Dhcp4Init;
DhcpSb->Xid = DhcpSb->Xid + 1;
DhcpSb->ClientAddr = 0;
+ DhcpSb->Netmask = 0;
DhcpSb->ServerAddr = 0;
if (DhcpSb->LastOffer != NULL) {
@@ -1066,6 +1067,7 @@ DhcpInput (
if (EFI_ERROR (Status)) {
NetbufFree (UdpPacket);
+ UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);
DhcpEndSession (DhcpSb, Status);
return ;
}