]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
1. Add EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName() support.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Dispatcher.c
index 688f9a7e99c9a01e97acef292e4456a275c8dcbf..93d10c9eb283ac2b6416412096a274b2e6186506 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Tcp request dispatcher implementation.\r
 \r
-Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 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
@@ -263,6 +263,8 @@ Tcp4AttachPcb (
   TCP_CB            *Tcb;\r
   TCP4_PROTO_DATA   *ProtoData;\r
   IP_IO             *IpIo;\r
+  EFI_STATUS        Status;\r
+  VOID              *Ip;\r
 \r
   Tcb = AllocateZeroPool (sizeof (TCP_CB));\r
 \r
@@ -286,6 +288,22 @@ Tcp4AttachPcb (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
+  //\r
+  // Open the new created IP instance BY_CHILD.\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  Tcb->IpInfo->ChildHandle,\r
+                  &gEfiIp4ProtocolGuid,\r
+                  &Ip,\r
+                  IpIo->Image,\r
+                  Sk->SockHandle,\r
+                  EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    IpIoRemoveIp (IpIo, Tcb->IpInfo);\r
+    return Status;\r
+  }\r
+\r
   InitializeListHead (&Tcb->List);\r
   InitializeListHead (&Tcb->SndQue);\r
   InitializeListHead (&Tcb->RcvQue);\r
@@ -318,6 +336,16 @@ Tcp4DetachPcb (
 \r
   Tcp4FlushPcb (Tcb);\r
 \r
+  //\r
+  // Close the IP protocol.\r
+  //\r
+  gBS->CloseProtocol (\r
+         Tcb->IpInfo->ChildHandle,\r
+         &gEfiIp4ProtocolGuid,\r
+         ProtoData->TcpService->IpIo->Image,\r
+         Sk->SockHandle\r
+         );\r
+  \r
   IpIoRemoveIp (ProtoData->TcpService->IpIo, Tcb->IpInfo);\r
 \r
   FreePool (Tcb);\r