diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-06-24 08:36:11 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-06-24 08:36:11 +0000 |
commit | e234f7c490800ae0a7ae9b5a5b88e8dff1dfafc9 (patch) | |
tree | beb521a5b5723eb23dd3a11d88e5d3cca60758ad /MdeModulePkg/Universal | |
parent | 7e388f859fee079f0c5eb035354b1f1bb79ea2fc (diff) | |
download | edk2-platforms-e234f7c490800ae0a7ae9b5a5b88e8dff1dfafc9.tar.xz |
[Description]:
Misuse of retransmisson of DHCPDISCOVER in Dhcp4 drive, the root cause is that DHCP doesn't retransmit discover message when timeout.
[Solution]:
Correct the mechanism for discover message.
[Impaction]:
Dhcp4Dxe.
[Reference Info]:
EDK tracker 1150 - Misuse of retransmisson of DHCPDISCOVER in Dhcp4 drive.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5366 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h | 4 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 56 |
2 files changed, 22 insertions, 38 deletions
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h index d7e41134af..bf401bda0d 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.h @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2008, Intel Corporation
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
@@ -136,8 +136,6 @@ struct _DHCP_SERVICE { UINT32 PacketToLive; // Retransmission timer for our packets
INTN CurRetry;
INTN MaxRetries;
-
- UINT32 WaitOffer; // Time to collect the offers
UINT32 LeaseLife;
};
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c index 9cead840bd..415ffa8ab7 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2008, Intel Corporation
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
@@ -272,9 +272,7 @@ DhcpSetTransmitTimer ( DhcpSb->PacketToLive = Times[DhcpSb->CurRetry];
- if (DhcpSb->DhcpState == Dhcp4Selecting) {
- DhcpSb->WaitOffer = DhcpSb->PacketToLive;
- }
+ return;
}
/**
@@ -497,7 +495,6 @@ DhcpCleanLease ( DhcpSb->PacketToLive = 0;
DhcpSb->CurRetry = 0;
DhcpSb->MaxRetries = 0;
- DhcpSb->WaitOffer = 0;
DhcpSb->LeaseLife = 0;
}
@@ -526,11 +523,6 @@ DhcpChooseOffer ( ASSERT (DhcpSb->LastOffer != NULL);
//
- // Stop waiting more offers
- //
- DhcpSb->WaitOffer = 0;
-
- //
// User will cache previous offers if he wants to select
// from multiple offers. If user provides an invalid packet,
// use the last offer, otherwise use the provided packet.
@@ -1501,30 +1493,27 @@ DhcpOnTimerTick ( DhcpSb = (DHCP_SERVICE *) Context;
Instance = DhcpSb->ActiveChild;
-
+
//
- // Check the time to wait offer
+ // Check the retransmit timer
//
- if ((DhcpSb->WaitOffer > 0) && (--DhcpSb->WaitOffer == 0)) {
+ if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {
+
//
- // OK, offer collection finished, select a offer
+ // Select offer at each timeout if any offer received.
//
- ASSERT (DhcpSb->DhcpState == Dhcp4Selecting);
+ if (DhcpSb->DhcpState == Dhcp4Selecting && DhcpSb->LastOffer != NULL) {
- if (DhcpSb->LastOffer == NULL) {
- goto END_SESSION;
- }
+ Status = DhcpChooseOffer (DhcpSb);
- if (EFI_ERROR (DhcpChooseOffer (DhcpSb))) {
- goto END_SESSION;
+ if (EFI_ERROR(Status)) {
+ FreePool (DhcpSb->LastOffer);
+ DhcpSb->LastOffer = NULL;
+ } else {
+ goto ON_EXIT;
+ }
}
- }
-
- //
- // Check the retransmit timer
- //
- if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {
-
+
if (++DhcpSb->CurRetry < DhcpSb->MaxRetries) {
//
// Still has another try
@@ -1532,10 +1521,7 @@ DhcpOnTimerTick ( DhcpRetransmit (DhcpSb);
DhcpSetTransmitTimer (DhcpSb);
- } else {
- if (!DHCP_CONNECTED (DhcpSb->DhcpState)) {
- goto END_SESSION;
- }
+ } else if (DHCP_CONNECTED (DhcpSb->DhcpState)) {
//
// Retransmission failed, if the DHCP request is initiated by
@@ -1562,9 +1548,11 @@ DhcpOnTimerTick ( DhcpSb->IoStatus = EFI_TIMEOUT;
DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_RENEWREBIND);
}
+ } else {
+ goto END_SESSION;
}
}
-
+
//
// If an address has been acquired, check whether need to
// refresh or whether it has expired.
@@ -1628,9 +1616,7 @@ DhcpOnTimerTick ( }
}
- //
- //
- //
+ON_EXIT:
if ((Instance != NULL) && (Instance->Token != NULL)) {
Instance->Timeout--;
if (Instance->Timeout == 0) {
|