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
/** @file\r
\r
-Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
+Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
return Status;\r
}\r
\r
+ //\r
+ // Start the receiving\r
+ //\r
+ Status = UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
Status = gBS->SetTimer (DhcpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);\r
\r
if (EFI_ERROR (Status)) {\r
goto ON_ERROR;\r
}\r
\r
- //\r
- // Start/Restart the receiving.\r
- //\r
- Status = UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);\r
-\r
- if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {\r
- goto ON_ERROR;\r
- }\r
\r
Instance->CompletionEvent = CompletionEvent;\r
\r
// Keep polling until timeout if no error happens and the CompletionEvent\r
// is NULL.\r
//\r
- while (Instance->Timeout != 0) {\r
- Instance->UdpIo->Udp->Poll (Instance->UdpIo->Udp);\r
+ while (TRUE) {\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
+ //\r
+ // Raise TPL to protect the UDPIO in instance, in case that DhcpOnTimerTick\r
+ // free it when timeout.\r
+ //\r
+ if (Instance->Timeout > 0) {\r
+ Instance->UdpIo->Udp->Poll (Instance->UdpIo->Udp);\r
+ gBS->RestoreTPL (OldTpl);\r
+ } else {\r
+ gBS->RestoreTPL (OldTpl);\r
+ break;\r
+ }\r
}\r
}\r
\r
DhcpSb->DhcpState = Dhcp4Init;\r
DhcpSb->Xid = DhcpSb->Xid + 1;\r
DhcpSb->ClientAddr = 0;\r
+ DhcpSb->Netmask = 0;\r
DhcpSb->ServerAddr = 0;\r
\r
if (DhcpSb->LastOffer != NULL) {\r
\r
if (EFI_ERROR (Status)) {\r
NetbufFree (UdpPacket);\r
+ UdpIoRecvDatagram (DhcpSb->UdpIo, DhcpInput, DhcpSb, 0);\r
DhcpEndSession (DhcpSb, Status);\r
return ;\r
}\r