if (SOCK_IS_CONFIGURED (Sock)) {\r
NetListRemoveEntry (&Tcb->List);\r
\r
+ //\r
+ // Uninstall the device path protocl.\r
+ //\r
+ gBS->UninstallProtocolInterface (\r
+ Sock->SockHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ Sock->DevicePath\r
+ );\r
+ NetFreePool (Sock->DevicePath);\r
+\r
TcpSetVariableData (TcpProto->TcpService);\r
}\r
\r
//\r
// Add Ip for send pkt to the peer\r
//\r
- CopyMem (&IpCfgData, &mIpIoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA));\r
+ CopyMem (&IpCfgData, &mIpIoDefaultIpConfigData, sizeof (IpCfgData));\r
IpCfgData.DefaultProtocol = EFI_IP_PROTO_TCP;\r
IpCfgData.UseDefaultAddress = CfgData->AccessPoint.UseDefaultAddress;\r
IpCfgData.StationAddress = CfgData->AccessPoint.StationAddress;\r
Tcb->TTL = CfgData->TimeToLive;\r
Tcb->TOS = CfgData->TypeOfService;\r
\r
+ Tcb->UseDefaultAddr = CfgData->AccessPoint.UseDefaultAddress;\r
+\r
NetCopyMem (&Tcb->LocalEnd.Ip, &CfgData->AccessPoint.StationAddress, sizeof (IP4_ADDR));\r
Tcb->LocalEnd.Port = HTONS (CfgData->AccessPoint.StationPort);\r
Tcb->SubnetMask = CfgData->AccessPoint.SubnetMask;\r
\r
- NetCopyMem (&Tcb->RemoteEnd.Ip, &CfgData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
- Tcb->RemoteEnd.Port = HTONS (CfgData->AccessPoint.RemotePort);\r
+ if (CfgData->AccessPoint.ActiveFlag) {\r
+ NetCopyMem (&Tcb->RemoteEnd.Ip, &CfgData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
+ Tcb->RemoteEnd.Port = HTONS (CfgData->AccessPoint.RemotePort);\r
+ } else {\r
+ Tcb->RemoteEnd.Ip = 0;\r
+ Tcb->RemoteEnd.Port = 0;\r
+ }\r
\r
Option = CfgData->ControlOption;\r
\r
}\r
}\r
\r
+ //\r
+ // The socket is bound, the <SrcIp, SrcPort, DstIp, DstPort> is\r
+ // determined, construct the IP device path and install it.\r
+ //\r
+ Status = TcpInstallDevicePath (Sk);\r
+ if (EFI_ERROR (Status)) {\r
+ goto OnExit;\r
+ }\r
+\r
//\r
// update state of Tcb and socket\r
//\r