1. Fix a bug for PXEv6 when Proxy PXE server and DHCP server are located at the same server.

Signed-off-by: sfu5
Reviewed-by: tye
Reviewed-by: qianouyang

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12985 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
sfu5 2012-02-07 05:31:11 +00:00
parent b4ebbafff6
commit d40002bab9
2 changed files with 38 additions and 18 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Functions implementation related with DHCPv6 for UefiPxeBc Driver. Functions implementation related with DHCPv6 for UefiPxeBc Driver.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -15,6 +15,12 @@
#include "PxeBcImpl.h" #include "PxeBcImpl.h"
//
// Well-known multi-cast address defined in section-24.1 of rfc-3315
//
// ALL_DHCP_Relay_Agents_and_Servers address: FF02::1:2
//
EFI_IPv6_ADDRESS mAllDhcpRelayAndServersAddress = {{0xFF, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2}};
/** /**
Parse out a DHCPv6 option by OptTag, and find the position in buffer. Parse out a DHCPv6 option by OptTag, and find the position in buffer.
@ -788,7 +794,7 @@ PxeBcRequestBootService (
Status = PxeBc->UdpRead ( Status = PxeBc->UdpRead (
PxeBc, PxeBc,
OpFlags, EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP,
&Private->StationIp, &Private->StationIp,
&SrcPort, &SrcPort,
&Private->ServerIp, &Private->ServerIp,
@ -844,19 +850,29 @@ PxeBcRetryDhcp6Binl (
Mode = Private->PxeBc.Mode; Mode = Private->PxeBc.Mode;
Private->IsDoDiscover = FALSE; Private->IsDoDiscover = FALSE;
Offer = &Private->OfferBuffer[Index].Dhcp6; Offer = &Private->OfferBuffer[Index].Dhcp6;
if (Offer->OfferType == PxeOfferTypeDhcpBinl) {
ASSERT (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL] != NULL); //
// // There is no BootFileUrl option in dhcp6 offer, so use servers multi-cast address instead.
// Parse out the next server address from the last offer, and store it //
// CopyMem (
Status = PxeBcExtractBootFileUrl ( &Private->ServerIp.v6,
&Private->BootFileName, &mAllDhcpRelayAndServersAddress,
&Private->ServerIp.v6, sizeof (EFI_IPv6_ADDRESS)
(CHAR8 *) (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]->Data), );
NTOHS (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]->OpLen) } else {
); ASSERT (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL] != NULL);
if (EFI_ERROR (Status)) { //
return Status; // Parse out the next server address from the last offer, and store it
//
Status = PxeBcExtractBootFileUrl (
&Private->BootFileName,
&Private->ServerIp.v6,
(CHAR8 *) (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]->Data),
NTOHS (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL]->OpLen)
);
if (EFI_ERROR (Status)) {
return Status;
}
} }
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL. This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -1378,7 +1378,9 @@ EfiPxeBcUdpRead (
if (Udp6Rx->DataLength - HeaderLen > *BufferSize) { if (Udp6Rx->DataLength - HeaderLen > *BufferSize) {
Status = EFI_BUFFER_TOO_SMALL; Status = EFI_BUFFER_TOO_SMALL;
} else { } else {
*HeaderSize = HeaderLen; if (HeaderSize != NULL) {
*HeaderSize = HeaderLen;
}
*BufferSize = Udp6Rx->DataLength - HeaderLen; *BufferSize = Udp6Rx->DataLength - HeaderLen;
HeaderCopiedLen = 0; HeaderCopiedLen = 0;
@ -1430,7 +1432,9 @@ EfiPxeBcUdpRead (
if (Udp4Rx->DataLength - HeaderLen > *BufferSize) { if (Udp4Rx->DataLength - HeaderLen > *BufferSize) {
Status = EFI_BUFFER_TOO_SMALL; Status = EFI_BUFFER_TOO_SMALL;
} else { } else {
*HeaderSize = HeaderLen; if (HeaderSize != NULL) {
*HeaderSize = HeaderLen;
}
*BufferSize = Udp4Rx->DataLength - HeaderLen; *BufferSize = Udp4Rx->DataLength - HeaderLen;
HeaderCopiedLen = 0; HeaderCopiedLen = 0;