summaryrefslogtreecommitdiff
path: root/edk2/NetworkPkg
diff options
context:
space:
mode:
authorsfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-07 05:31:11 +0000
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-07 05:31:11 +0000
commitcdd4bd2de49e4569e28328e0ed67393aa2cf326c (patch)
treea453097f04faa00a5dffb9cdfa0477c78deca641 /edk2/NetworkPkg
parentfebc2989bbd79544ff965ec57f18287072e5d446 (diff)
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@12985 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'edk2/NetworkPkg')
-rw-r--r--edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c46
-rw-r--r--edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c10
2 files changed, 38 insertions, 18 deletions
diff --git a/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
index 871567547..0a2dd6d13 100644
--- a/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
+++ b/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
@@ -1,7 +1,7 @@
/** @file
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
are licensed and made available under the terms and conditions of the BSD License
@@ -15,6 +15,12 @@
#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.
@@ -788,7 +794,7 @@ PxeBcRequestBootService (
Status = PxeBc->UdpRead (
PxeBc,
- OpFlags,
+ EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP,
&Private->StationIp,
&SrcPort,
&Private->ServerIp,
@@ -844,19 +850,29 @@ PxeBcRetryDhcp6Binl (
Mode = Private->PxeBc.Mode;
Private->IsDoDiscover = FALSE;
Offer = &Private->OfferBuffer[Index].Dhcp6;
-
- ASSERT (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL] != NULL);
- //
- // 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;
+ if (Offer->OfferType == PxeOfferTypeDhcpBinl) {
+ //
+ // There is no BootFileUrl option in dhcp6 offer, so use servers multi-cast address instead.
+ //
+ CopyMem (
+ &Private->ServerIp.v6,
+ &mAllDhcpRelayAndServersAddress,
+ sizeof (EFI_IPv6_ADDRESS)
+ );
+ } else {
+ ASSERT (Offer->OptList[PXEBC_DHCP6_IDX_BOOT_FILE_URL] != NULL);
+ //
+ // 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;
+ }
}
//
diff --git a/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 67abd48f4..ba7f94859 100644
--- a/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/edk2/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
/** @file
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
are licensed and made available under the terms and conditions of the BSD License
@@ -1378,7 +1378,9 @@ EfiPxeBcUdpRead (
if (Udp6Rx->DataLength - HeaderLen > *BufferSize) {
Status = EFI_BUFFER_TOO_SMALL;
} else {
- *HeaderSize = HeaderLen;
+ if (HeaderSize != NULL) {
+ *HeaderSize = HeaderLen;
+ }
*BufferSize = Udp6Rx->DataLength - HeaderLen;
HeaderCopiedLen = 0;
@@ -1430,7 +1432,9 @@ EfiPxeBcUdpRead (
if (Udp4Rx->DataLength - HeaderLen > *BufferSize) {
Status = EFI_BUFFER_TOO_SMALL;
} else {
- *HeaderSize = HeaderLen;
+ if (HeaderSize != NULL) {
+ *HeaderSize = HeaderLen;
+ }
*BufferSize = Udp4Rx->DataLength - HeaderLen;
HeaderCopiedLen = 0;