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