]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Dhcp6Dxe/Dhcp6Driver.c
1. Fix a bug in PXE driver that the PXE boot do not restart if a new boot option...
[mirror_edk2.git] / NetworkPkg / Dhcp6Dxe / Dhcp6Driver.c
index d14f169f07807b78664a698fdd5f23c628a2fa25..346986bd159cebb0d22fb3b9ee0db997ed4c1c62 100644 (file)
@@ -2,7 +2,7 @@
   Driver Binding functions and Service Binding functions\r
   implementationfor for Dhcp6 Driver.\r
 \r
-  Copyright (c) 2009 - 2010, 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
@@ -82,7 +82,7 @@ Dhcp6ConfigureUdpIo (
 \r
 \r
 /**\r
-  Destory the Dhcp6 service. The Dhcp6 service may be partly initialized,\r
+  Destroy the Dhcp6 service. The Dhcp6 service may be partly initialized,\r
   or partly destroyed. If a resource is destroyed, it is marked as such in\r
   case the destroy failed and being called again later.\r
 \r
@@ -95,7 +95,7 @@ Dhcp6DestroyService (
   )\r
 {\r
   //\r
-  // All children instances should have been already destoryed here.\r
+  // All children instances should have been already destroyed here.\r
   //\r
   ASSERT (Service->NumOfChild == 0);\r
 \r
@@ -132,6 +132,7 @@ Dhcp6CreateService (
   )\r
 {\r
   DHCP6_SERVICE             *Dhcp6Srv;\r
+  EFI_STATUS                Status;\r
 \r
   *Service = NULL;\r
   Dhcp6Srv = AllocateZeroPool (sizeof (DHCP6_SERVICE));\r
@@ -154,7 +155,7 @@ Dhcp6CreateService (
   // Initialize the fields of the new Dhcp6 service.\r
   //\r
   Dhcp6Srv->Signature       = DHCP6_SERVICE_SIGNATURE;\r
-  Dhcp6Srv->InDestory       = FALSE;\r
+  Dhcp6Srv->InDestroy       = FALSE;\r
   Dhcp6Srv->Controller      = Controller;\r
   Dhcp6Srv->Image           = ImageHandle;\r
   Dhcp6Srv->Xid             = (0xffffff & NET_RANDOM (NetRandomInitSeed ()));\r
@@ -166,7 +167,21 @@ Dhcp6CreateService (
     );\r
 \r
   //\r
-  // Generate client Duid in the format of Duid-llt.\r
+  // Locate Ip6->Ip6Config and store it for get IP6 Duplicate Address Detection transmits.\r
+  //\r
+  Status = gBS->HandleProtocol (\r
+                  Controller,\r
+                  &gEfiIp6ConfigProtocolGuid,\r
+                  (VOID **) &Dhcp6Srv->Ip6Cfg\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (Dhcp6Srv);\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Generate client Duid: If SMBIOS system UUID is located, generate DUID in DUID-UUID format.\r
+  // Otherwise, in DUID-LLT format.\r
   //\r
   Dhcp6Srv->ClientId        = Dhcp6GenerateClientId (Dhcp6Srv->Snp->Mode);\r
 \r
@@ -279,7 +294,7 @@ Dhcp6CreateInstance (
   Dhcp6Ins->Signature       = DHCP6_INSTANCE_SIGNATURE;\r
   Dhcp6Ins->UdpSts          = EFI_ALREADY_STARTED;\r
   Dhcp6Ins->Service         = Service;\r
-  Dhcp6Ins->InDestory       = FALSE;\r
+  Dhcp6Ins->InDestroy       = FALSE;\r
   Dhcp6Ins->MediaPresent    = TRUE;\r
 \r
   CopyMem (\r
@@ -513,7 +528,7 @@ Dhcp6DriverBindingStop (
 \r
   Service = DHCP6_SERVICE_FROM_THIS (ServiceBinding);\r
 \r
-  if (Service->InDestory) {\r
+  if (Service->InDestroy) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
@@ -521,9 +536,9 @@ Dhcp6DriverBindingStop (
 \r
   if (NumberOfChildren == 0) {\r
     //\r
-    // Destory the service itself if no child instance left.\r
+    // Destroy the service itself if no child instance left.\r
     //\r
-    Service->InDestory = TRUE;\r
+    Service->InDestroy = TRUE;\r
 \r
     Status = gBS->UninstallProtocolInterface (\r
                     NicHandle,\r
@@ -532,7 +547,7 @@ Dhcp6DriverBindingStop (
                     );\r
 \r
     if (EFI_ERROR (Status)) {\r
-      Service->InDestory = FALSE;\r
+      Service->InDestroy = FALSE;\r
       goto ON_EXIT;\r
     }\r
 \r
@@ -540,7 +555,7 @@ Dhcp6DriverBindingStop (
 \r
   } else {\r
     //\r
-    // Destory all the children instances before destory the service.\r
+    // Destroy all the children instances before destroy the service.\r
     //\r
     while (!IsListEmpty (&Service->Child)) {\r
       Instance = NET_LIST_HEAD (&Service->Child, DHCP6_INSTANCE, Link);\r
@@ -686,7 +701,7 @@ ON_ERROR:
 \r
   @retval EFI_SUCCES            The protocol was removed from ChildHandle.\r
   @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is being removed.\r
-  @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r
+  @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
   @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle\r
                                 because its services are being used.\r
   @retval other                 The child handle was not destroyed\r
@@ -732,13 +747,13 @@ Dhcp6ServiceBindingDestroyChild (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (Instance->InDestory) {\r
+  if (Instance->InDestroy) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
   OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
-  Instance->InDestory = TRUE;\r
+  Instance->InDestroy = TRUE;\r
 \r
   Status = gBS->CloseProtocol (\r
                   Service->UdpIo->UdpHandle,\r
@@ -748,7 +763,7 @@ Dhcp6ServiceBindingDestroyChild (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    Instance->InDestory = FALSE;\r
+    Instance->InDestroy = FALSE;\r
     gBS->RestoreTPL (OldTpl);\r
     return Status;\r
   }\r
@@ -763,7 +778,7 @@ Dhcp6ServiceBindingDestroyChild (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    Instance->InDestory = FALSE;\r
+    Instance->InDestroy = FALSE;\r
     gBS->RestoreTPL (OldTpl);\r
     return Status;\r
   }\r