]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
1. Add EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName() support.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Impl.c
index b9a85f2333e3c525004b646b8350d3c75c6f9df4..41b5e9599775c54c6db7e71d0a3356c978fdc475 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This file implement the EFI_DHCP4_PROTOCOL interface.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<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\r
@@ -1234,6 +1234,8 @@ Dhcp4InstanceCreateUdpIo (
   )\r
 {\r
   DHCP_SERVICE  *DhcpSb;\r
+  EFI_STATUS    Status;\r
+  VOID          *Udp4;\r
 \r
   ASSERT (Instance->Token != NULL);\r
 \r
@@ -1248,7 +1250,19 @@ Dhcp4InstanceCreateUdpIo (
   if (Instance->UdpIo == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   } else {\r
-    return EFI_SUCCESS;\r
+    Status = gBS->OpenProtocol (\r
+                    Instance->UdpIo->UdpHandle,\r
+                    &gEfiUdp4ProtocolGuid,\r
+                    (VOID **) &Udp4,\r
+                    Instance->Service->Image,\r
+                    Instance->Handle,\r
+                    EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      UdpIoFreeIo (Instance->UdpIo);\r
+      Instance->UdpIo = NULL;\r
+    }\r
+    return Status;\r
   }\r
 }\r
 \r
@@ -1416,6 +1430,12 @@ SIGNAL_USER:
   //\r
   NetbufQueFlush (&Instance->ResponseQueue);\r
   UdpIoCleanIo (Instance->UdpIo);\r
+  gBS->CloseProtocol (\r
+         Instance->UdpIo->UdpHandle,\r
+         &gEfiUdp4ProtocolGuid,\r
+         Instance->Service->Image,\r
+         Instance->Handle\r
+         );\r
   UdpIoFreeIo (Instance->UdpIo);\r
   Instance->UdpIo = NULL;\r
   Instance->Token = NULL;\r
@@ -1581,6 +1601,12 @@ ON_ERROR:
 \r
   if (EFI_ERROR (Status) && (Instance->UdpIo != NULL)) {\r
     UdpIoCleanIo (Instance->UdpIo);\r
+    gBS->CloseProtocol (\r
+           Instance->UdpIo->UdpHandle,\r
+           &gEfiUdp4ProtocolGuid,\r
+           Instance->Service->Image,\r
+           Instance->Handle\r
+           );\r
     UdpIoFreeIo (Instance->UdpIo);\r
     Instance->UdpIo = NULL;\r
     Instance->Token = NULL;\r