]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c
SourceLevelDebugPkg/SecPeiDebugAgentLib: Restore CPU interrupt state
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4ConfigDxe / Ip4Config.c
index 937da41f2c7a6c5976ead45d84f2d21996f18727..3d2f0a4f9b240e443f4991790029f7cdefd95ac0 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   This code implements the IP4Config and NicIp4Config protocols.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at<BR>\r
@@ -125,10 +126,22 @@ EfiNicIp4ConfigSetInfo (
   // Signal the IP4 to run the auto configuration again\r
   //\r
   if (Reconfig && (Instance->ReconfigEvent != NULL)) {\r
+    //\r
+    // When NicConfig is NULL, NIC IP4 configuration parameter is removed,\r
+    // the auto configuration process should stop running the configuration\r
+    // policy for the EFI IPv4 Protocol driver.\r
+    //\r
+    if (NicConfig == NULL) {\r
+      Instance->DoNotStart = TRUE;\r
+    }\r
+\r
     Status = gBS->SignalEvent (Instance->ReconfigEvent);\r
     DispatchDpc ();\r
   }\r
 \r
+  if (NicConfig == NULL) {\r
+    return Status;\r
+  }\r
   //\r
   // A dedicated timer is used to poll underlying media status.In case of\r
   // cable swap, a new round auto configuration will be initiated. The timer\r
@@ -164,7 +177,7 @@ Ip4ConfigOnDhcp4Complete (
   EFI_DHCP4_MODE_DATA       Dhcp4Mode;\r
   EFI_IP4_IPCONFIG_DATA     *Ip4Config;\r
   EFI_STATUS                Status;\r
-  BOOLEAN                   Perment;\r
+  BOOLEAN                   Permanent;\r
   IP4_ADDR                  Subnet;\r
   IP4_ADDR                  Ip1;\r
   IP4_ADDR                  Ip2;\r
@@ -190,11 +203,11 @@ Ip4ConfigOnDhcp4Complete (
     // the instance and to NVRam. So, both the IP4 driver and\r
     // other user can get that address.\r
     //\r
-    Perment = FALSE;\r
+    Permanent = FALSE;\r
 \r
     if (Instance->NicConfig != NULL) {\r
       ASSERT (Instance->NicConfig->Source == IP4_CONFIG_SOURCE_DHCP);\r
-      Perment = Instance->NicConfig->Perment;\r
+      Permanent = Instance->NicConfig->Permanent;\r
       FreePool (Instance->NicConfig);\r
     }\r
 \r
@@ -209,7 +222,7 @@ Ip4ConfigOnDhcp4Complete (
 \r
     CopyMem (&Instance->NicConfig->NicAddr, &Instance->NicAddr, sizeof (Instance->NicConfig->NicAddr));\r
     Instance->NicConfig->Source  = IP4_CONFIG_SOURCE_DHCP;\r
-    Instance->NicConfig->Perment = Perment;\r
+    Instance->NicConfig->Permanent = Permanent;\r
 \r
     Ip4Config                    = &Instance->NicConfig->Ip4Info;\r
     Ip4Config->StationAddress    = Dhcp4Mode.ClientAddress;\r
@@ -341,6 +354,12 @@ EfiIp4ConfigStart (
   Instance->NicConfig     = EfiNicIp4ConfigGetInfo (Instance);\r
 \r
   if (Instance->NicConfig == NULL) {\r
+    if (Instance->DoNotStart) {\r
+      Instance->DoNotStart = FALSE;\r
+      Status = EFI_SUCCESS;\r
+      goto ON_EXIT;\r
+    }\r
+\r
     Source = IP4_CONFIG_SOURCE_DHCP;\r
   } else {\r
     Source = Instance->NicConfig->Source;\r
@@ -638,7 +657,7 @@ Ip4ConfigCleanDhcp4 (
     This->Dhcp4Handle = NULL;\r
   }\r
 \r
-  if (This->Dhcp4Event == NULL) {\r
+  if (This->Dhcp4Event != NULL) {\r
     gBS->CloseEvent (This->Dhcp4Event);\r
     This->Dhcp4Event = NULL;\r
   }\r