DHCP4 service allows only one of its children to be configured
in the active state,If the DHCP4 D.O.R.A started by IP4 auto
configuration and has not been completed, the Dhcp4 state machine
will not be in the right state for the PXE to start a new round D.O.R.A.
so we need to switch it's policy to static.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18104
6f19259b-4bc3-4df7-8a09-
765794883524
return Status;\r
}\r
\r
+/**\r
+ Switch the Ip4 policy to static.\r
+\r
+ @param[in] Private The pointer to PXEBC_PRIVATE_DATA.\r
+\r
+ @retval EFI_SUCCESS The policy is already configured to static.\r
+ @retval Others Other error as indicated..\r
+\r
+**/\r
+EFI_STATUS\r
+PxeBcSetIp4Policy ( \r
+ IN PXEBC_PRIVATE_DATA *Private\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;\r
+ EFI_IP4_CONFIG2_POLICY Policy;\r
+ UINTN DataSize;\r
+\r
+ Ip4Config2 = Private->Ip4Config2;\r
+ DataSize = sizeof (EFI_IP4_CONFIG2_POLICY);\r
+ Status = Ip4Config2->GetData (\r
+ Ip4Config2,\r
+ Ip4Config2DataTypePolicy,\r
+ &DataSize,\r
+ &Policy\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ \r
+ if (Policy != Ip4Config2PolicyStatic) {\r
+ Policy = Ip4Config2PolicyStatic;\r
+ Status= Ip4Config2->SetData (\r
+ Ip4Config2,\r
+ Ip4Config2DataTypePolicy,\r
+ sizeof (EFI_IP4_CONFIG2_POLICY),\r
+ &Policy\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ } \r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
\r
/**\r
Start the D.O.R.A DHCPv4 process to acquire the IPv4 address and other PXE boot information.\r
/** @file\r
Functions declaration related with DHCPv4 for UefiPxeBc Driver.\r
\r
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2015, 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
IN EFI_PXE_BASE_CODE_SRVLIST *SrvList\r
);\r
\r
+/**\r
+ Switch the Ip4 policy to static.\r
+\r
+ @param[in] Private The pointer to PXEBC_PRIVATE_DATA.\r
+\r
+ @retval EFI_SUCCESS The policy is already configured to static.\r
+ @retval Others Other error as indicated..\r
+\r
+**/\r
+EFI_STATUS\r
+PxeBcSetIp4Policy ( \r
+ IN PXEBC_PRIVATE_DATA *Private\r
+ );\r
+\r
\r
/**\r
Start the D.O.R.A DHCPv4 process to acquire the IPv4 address and other PXE boot information.\r
Private->Ip4Nic->Private = Private;\r
Private->Ip4Nic->Signature = PXEBC_VIRTUAL_NIC_SIGNATURE;\r
\r
+ //\r
+ // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy.\r
+ //\r
+ Status = gBS->HandleProtocol (\r
+ ControllerHandle,\r
+ &gEfiIp4Config2ProtocolGuid,\r
+ (VOID **) &Private->Ip4Config2\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
+\r
//\r
// Create a device path node for Ipv4 virtual nic, and append it.\r
//\r
if (EFI_ERROR (Status)) {\r
goto ON_ERROR;\r
}\r
+\r
+ //\r
+ //DHCP4 service allows only one of its children to be configured in \r
+ //the active state, If the DHCP4 D.O.R.A started by IP4 auto \r
+ //configuration and has not been completed, the Dhcp4 state machine \r
+ //will not be in the right state for the PXE to start a new round D.O.R.A. \r
+ //so we need to switch it's policy to static.\r
+ //\r
+ Status = PxeBcSetIp4Policy (Private);\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
}\r
\r
//\r
#include <Protocol/NetworkInterfaceIdentifier.h>\r
#include <Protocol/Arp.h>\r
#include <Protocol/Ip4.h>\r
+#include <Protocol/Ip4Config2.h>\r
#include <Protocol/Ip6.h>\r
#include <Protocol/Ip6Config.h>\r
#include <Protocol/Udp4.h>\r
\r
EFI_ARP_PROTOCOL *Arp;\r
EFI_IP4_PROTOCOL *Ip4;\r
+ EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;\r
EFI_DHCP4_PROTOCOL *Dhcp4;\r
EFI_MTFTP4_PROTOCOL *Mtftp4;\r
EFI_UDP4_PROTOCOL *Udp4Read;\r
gEfiArpProtocolGuid ## TO_START\r
gEfiIp4ServiceBindingProtocolGuid ## TO_START\r
gEfiIp4ProtocolGuid ## TO_START\r
+ gEfiIp4Config2ProtocolGuid ## TO_START\r
gEfiIp6ServiceBindingProtocolGuid ## TO_START\r
gEfiIp6ProtocolGuid ## TO_START\r
gEfiIp6ConfigProtocolGuid ## TO_START\r