summaryrefslogtreecommitdiff
path: root/NetworkPkg/UefiPxeBcDxe
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
commitd40002bab9958da3439a2548aa3003d8d68672ff (patch)
treeea0b8de01b0f93833687be089c0700ee3c565745 /NetworkPkg/UefiPxeBcDxe
parentb4ebbafff696b02c69ee3a6d293a39f9a7c2f58d (diff)
downloadedk2-platforms-d40002bab9958da3439a2548aa3003d8d68672ff.tar.xz
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
Diffstat (limited to 'NetworkPkg/UefiPxeBcDxe')
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c46
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c10
2 files changed, 38 insertions, 18 deletions
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
index 8715675472..0a2dd6d13e 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
+++ b/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/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 67abd48f4c..ba7f948594 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/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;