sync tracker:PXE misused the parameter of second since boot in DHCP header.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8496 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2009-06-08 02:13:36 +00:00
parent 84478dedd0
commit 434ce3feca
4 changed files with 97 additions and 81 deletions

View File

@@ -1,7 +1,7 @@
/** @file
EFI DHCP protocol implementation.
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
@@ -227,7 +227,7 @@ DhcpSetState (
DhcpSb->CurRetry = 0;
DhcpSb->PacketToLive = 0;
DhcpSb->LastTimeout = 0;
DhcpSb->DhcpState = State;
return EFI_SUCCESS;
}
@@ -260,6 +260,7 @@ DhcpSetTransmitTimer (
}
DhcpSb->PacketToLive = Times[DhcpSb->CurRetry];
DhcpSb->LastTimeout = DhcpSb->PacketToLive;
return;
}
@@ -470,11 +471,12 @@ DhcpCleanLease (
}
if (DhcpSb->LastPacket != NULL) {
NetbufFree (DhcpSb->LastPacket);
FreePool (DhcpSb->LastPacket);
DhcpSb->LastPacket = NULL;
}
DhcpSb->PacketToLive = 0;
DhcpSb->LastTimeout = 0;
DhcpSb->CurRetry = 0;
DhcpSb->MaxRetries = 0;
DhcpSb->LeaseLife = 0;
@@ -1353,11 +1355,10 @@ DhcpSendMessage (
// Save it as the last sent packet for retransmission
//
if (DhcpSb->LastPacket != NULL) {
NetbufFree (DhcpSb->LastPacket);
FreePool (DhcpSb->LastPacket);
}
NET_GET_REF (Wrap);
DhcpSb->LastPacket = Wrap;
DhcpSb->LastPacket = Packet;
DhcpSetTransmitTimer (DhcpSb);
//
@@ -1377,10 +1378,19 @@ DhcpSendMessage (
}
ASSERT (UdpIo != NULL);
Status = UdpIoSendDatagram (UdpIo, Wrap, &EndPoint, 0, DhcpOnPacketSent, DhcpSb);
NET_GET_REF (Wrap);
Status = UdpIoSendDatagram (
UdpIo,
Wrap,
&EndPoint,
0,
DhcpOnPacketSent,
DhcpSb
);
if (EFI_ERROR (Status)) {
NetbufFree (Wrap);
NET_PUT_REF (Wrap);
return EFI_ACCESS_DENIED;
}
@@ -1405,10 +1415,25 @@ DhcpRetransmit (
{
UDP_IO_PORT *UdpIo;
UDP_POINTS EndPoint;
NET_BUF *Wrap;
NET_FRAGMENT Frag;
EFI_STATUS Status;
ASSERT (DhcpSb->LastPacket != NULL);
DhcpSb->LastPacket->Dhcp4.Header.Seconds = HTONS (*(UINT16 *)(&DhcpSb->LastTimeout));
//
// Wrap it into a netbuf then send it.
//
Frag.Bulk = (UINT8 *) &DhcpSb->LastPacket->Dhcp4.Header;
Frag.Len = DhcpSb->LastPacket->Length;
Wrap = NetbufFromExt (&Frag, 1, 0, 0, DhcpReleasePacket, DhcpSb->LastPacket);
if (Wrap == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Broadcast the message, unless we know the server address.
//
@@ -1426,10 +1451,10 @@ DhcpRetransmit (
ASSERT (UdpIo != NULL);
NET_GET_REF (DhcpSb->LastPacket);
NET_GET_REF (Wrap);
Status = UdpIoSendDatagram (
UdpIo,
DhcpSb->LastPacket,
Wrap,
&EndPoint,
0,
DhcpOnPacketSent,
@@ -1437,7 +1462,7 @@ DhcpRetransmit (
);
if (EFI_ERROR (Status)) {
NET_PUT_REF (DhcpSb->LastPacket);
NET_PUT_REF (Wrap);
return EFI_ACCESS_DENIED;
}