]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Fix issue about current Ip4Dxe implementation for DHCP DORA process
authorJiaxin Wu <jiaxin.wu@intel.com>
Tue, 11 Aug 2015 11:07:17 +0000 (11:07 +0000)
committerjiaxinwu <jiaxinwu@Edk2>
Tue, 11 Aug 2015 11:07:17 +0000 (11:07 +0000)
DHCP policy is applied as default at boot time on all NICs in the system, which results
in all NIC ports attempting DHCP and trying to acquire IP addresses during boot.
Ip4 driver should only set dhcp as default policy, and not trigger DORA at driver binding
start(). We should start DORA until one IP child is configured to use default address.

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18201 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c

index 2da4a513495e138512d5f7c440ca73279edb593b..fcb2bdd56270287a414d5805147926333d8f0ba8 100644 (file)
@@ -84,22 +84,6 @@ Ip4Config2DestroyDhcp4 (
   return Status;  \r
 }\r
 \r
   return Status;  \r
 }\r
 \r
-/**\r
-  Start the DHCP configuration for this IP service instance.\r
-  It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the\r
-  DHCP configuration.\r
-\r
-  @param[in]  Instance           The IP4 config2 instance to configure.\r
-\r
-  @retval EFI_SUCCESS            The auto configuration is successfull started.\r
-  @retval Others                 Failed to start auto configuration.\r
-\r
-**/\r
-EFI_STATUS\r
-Ip4StartAutoConfig (\r
-  IN IP4_CONFIG2_INSTANCE   *Instance\r
-  );\r
-\r
 /**\r
   Update the current policy to NewPolicy. During the transition\r
   period, the default router list\r
 /**\r
   Update the current policy to NewPolicy. During the transition\r
   period, the default router list\r
@@ -992,10 +976,7 @@ Ip4Config2SetPolicy (
   }\r
 \r
   if (NewPolicy == Instance->Policy) {\r
   }\r
 \r
   if (NewPolicy == Instance->Policy) {\r
-    if (NewPolicy != Ip4Config2PolicyDhcp || Instance->DhcpSuccess) {\r
-      return EFI_ABORTED;\r
-    }\r
-    \r
+     return EFI_ABORTED;\r
   } else {\r
     if (NewPolicy == Ip4Config2PolicyDhcp) {\r
       //\r
   } else {\r
     if (NewPolicy == Ip4Config2PolicyDhcp) {\r
       //\r
index 26e16a261787aee1473e4e060e32d0397d060508..e74b9ae407440e35739ae90ab8e78c7cbef19fdb 100644 (file)
@@ -210,6 +210,22 @@ typedef struct {
 } IP4_CONFIG2_DHCP4_OPTION;\r
 #pragma pack()\r
 \r
 } IP4_CONFIG2_DHCP4_OPTION;\r
 #pragma pack()\r
 \r
+/**\r
+  Start the DHCP configuration for this IP service instance.\r
+  It will locates the EFI_IP4_CONFIG2_PROTOCOL, then start the\r
+  DHCP configuration.\r
+\r
+  @param[in]  Instance           The IP4 config2 instance to configure.\r
+\r
+  @retval EFI_SUCCESS            The auto configuration is successfull started.\r
+  @retval Others                 Failed to start auto configuration.\r
+\r
+**/\r
+EFI_STATUS\r
+Ip4StartAutoConfig (\r
+  IN IP4_CONFIG2_INSTANCE   *Instance\r
+  );\r
+\r
 /**\r
   Initialize an IP4_CONFIG2_INSTANCE.\r
 \r
 /**\r
   Initialize an IP4_CONFIG2_INSTANCE.\r
 \r
index b0f597fc9754c13d550d6243adf8259089c0f69a..2fb4f4c1ca2abd3d7dc820fc5798445cc44abf4a 100644 (file)
@@ -678,8 +678,11 @@ Ip4ConfigProtocol (
     // been started, start it.\r
     //\r
     if (IpSb->State == IP4_SERVICE_UNSTARTED) {\r
     // been started, start it.\r
     //\r
     if (IpSb->State == IP4_SERVICE_UNSTARTED) {\r
-      Status = EFI_NO_MAPPING;\r
-      goto ON_ERROR;\r
+      Status = Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);\r
+\r
+      if (EFI_ERROR (Status)) {\r
+        goto ON_ERROR;\r
+      }\r
     }\r
 \r
     IpIf = IpSb->DefaultInterface;\r
     }\r
 \r
     IpIf = IpSb->DefaultInterface;\r