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
This commit is contained in:
tye 2009-10-21 09:37:10 +00:00
parent 39ef213c85
commit c5bcc2e2ab
3 changed files with 24 additions and 11 deletions

View File

@ -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)) {

View File

@ -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) {
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;
}
}
}

View File

@ -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 ;
}