1. Sync the latest network stack. Add NetLibCreateIPv4DPathNode () in netlib library.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Driver.c
index 3ae8a20..1eefb38 100644 (file)
@@ -586,6 +586,28 @@ Tcp4ServiceBindingCreateChild (
                   );\r
   if (EFI_ERROR (Status)) {\r
     SockDestroyChild (Sock);\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     SockDestroyChild (Sock);\r
+    goto ON_EXIT;\r
+  }\r
+\r
+  //\r
+  // Open the device path on the handle where service binding resides on.\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  TcpServiceData->ControllerHandle,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  (VOID **) &Sock->ParentDevicePath,\r
+                  TcpServiceData->DriverBindingHandle,\r
+                  Sock->SockHandle,\r
+                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->CloseProtocol (\r
+           TcpServiceData->IpIo->ChildHandle,\r
+           &gEfiIp4ProtocolGuid,\r
+           TcpServiceData->DriverBindingHandle,\r
+           Sock->SockHandle\r
+           );\r
+    SockDestroyChild (Sock);\r
   }\r
 \r
 ON_EXIT:\r
   }\r
 \r
 ON_EXIT:\r
@@ -652,6 +674,16 @@ Tcp4ServiceBindingDestroyChild (
 \r
   Status = SockDestroyChild (Sock);\r
 \r
 \r
   Status = SockDestroyChild (Sock);\r
 \r
+  //\r
+  // Close the device path protocol\r
+  //\r
+  gBS->CloseProtocol (\r
+         TcpServiceData->ControllerHandle,\r
+         &gEfiDevicePathProtocolGuid,\r
+         TcpServiceData->DriverBindingHandle,\r
+         ChildHandle\r
+         );\r
+\r
   //\r
   // Close the Ip4 protocol.\r
   //\r
   //\r
   // Close the Ip4 protocol.\r
   //\r