]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
MdeModulePkg: Change the default IPv4 config policy
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Impl.c
index b9a294b19916dbf806469851400183bcce4e0e53..58adba7c8c158518dcaa5ff55d8378a46fc4dc28 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2016, 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\r
@@ -563,57 +563,6 @@ Ip4InitProtocol (
 }\r
 \r
 \r
-/**\r
-  The event handle for IP4 auto reconfiguration. The original default\r
-  interface and route table will be removed as the default.\r
-\r
-  @param[in]  Context                The IP4 service binding instance.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-Ip4AutoReconfigCallBackDpc (\r
-  IN VOID                   *Context\r
-  )\r
-{\r
-  IP4_SERVICE               *IpSb;\r
-\r
-  IpSb      = (IP4_SERVICE *) Context;\r
-  NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);\r
-\r
-  if (IpSb->State > IP4_SERVICE_UNSTARTED) {\r
-    IpSb->State = IP4_SERVICE_UNSTARTED;\r
-  }\r
-  \r
-  IpSb->Reconfig = TRUE;\r
-\r
-  Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);\r
-\r
-  return ;\r
-}\r
-\r
-\r
-/**\r
-  Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK.\r
-\r
-  @param Event     The event that is signalled.\r
-  @param Context   The IP4 service binding instance.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-Ip4AutoReconfigCallBack (\r
-  IN EFI_EVENT              Event,\r
-  IN VOID                   *Context\r
-  )\r
-{\r
-  //\r
-  // Request Ip4AutoReconfigCallBackDpc as a DPC at TPL_CALLBACK\r
-  //\r
-  QueueDpc (TPL_CALLBACK, Ip4AutoReconfigCallBackDpc, Context);\r
-}\r
-\r
-\r
 /**\r
   Configure the IP4 child. If the child is already configured,\r
   change the configuration parameter. Otherwise configure it\r
@@ -724,32 +673,11 @@ Ip4ConfigProtocol (
 \r
   } else {\r
     //\r
-    // Use the default address. If the default configuration hasn't\r
-    // been started, start it.\r
+    // Use the default address. Check the state.\r
     //\r
     if (IpSb->State == IP4_SERVICE_UNSTARTED) {\r
-      //\r
-      // Create the ReconfigEvent to start the new configuration.\r
-      //\r
-      if (IpSb->ReconfigEvent == NULL) {\r
-        Status = gBS->CreateEvent (\r
-                        EVT_NOTIFY_SIGNAL,\r
-                        TPL_NOTIFY,\r
-                        Ip4AutoReconfigCallBack,\r
-                        IpSb,\r
-                        &IpSb->ReconfigEvent\r
-                        );\r
-\r
-        if (EFI_ERROR (Status)) {\r
-          goto ON_ERROR;\r
-        }\r
-      }\r
-      \r
-      Status = Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);\r
-\r
-      if (EFI_ERROR (Status)) {\r
-        goto CLOSE_RECONFIG_EVENT;\r
-      }\r
+      Status = EFI_NO_MAPPING;\r
+      goto ON_ERROR;\r
     }\r
 \r
     IpIf = IpSb->DefaultInterface;\r
@@ -778,7 +706,7 @@ Ip4ConfigProtocol (
                     EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
                     );\r
     if (EFI_ERROR (Status)) {\r
-      goto CLOSE_RECONFIG_EVENT;\r
+      goto ON_ERROR;\r
     }\r
   }\r
   InsertTailList (&IpIf->IpInstances, &IpInstance->AddrLink);\r
@@ -797,12 +725,6 @@ Ip4ConfigProtocol (
 \r
   return EFI_SUCCESS;\r
 \r
-CLOSE_RECONFIG_EVENT:\r
-  if (IpSb->ReconfigEvent != NULL) {\r
-    gBS->CloseEvent (IpSb->ReconfigEvent);\r
-    IpSb->ReconfigEvent = NULL;\r
-  }\r
-\r
 ON_ERROR:\r
   Ip4FreeRouteTable (IpInstance->RouteTable);\r
   IpInstance->RouteTable = NULL;\r
@@ -2417,7 +2339,7 @@ Ip4TimerTicking (
   //\r
   // Media transimit Unpresent to Present means new link movement is detected.\r
   //\r
-  if (!OldMediaPresent && IpSb->MediaPresent) {\r
+  if (!OldMediaPresent && IpSb->MediaPresent && (IpSb->Ip4Config2Instance.Policy == Ip4Config2PolicyDhcp)) {\r
     //\r
     // Signal the IP4 to run the dhcp configuration again. IP4 driver will free\r
     // old IP address related resource, such as route table and Interface, then \r