mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[AFD]
- Create an empty TRANSPORT_ADDRESS for the local address when doing an implicit bind so TCP/IP can choose its own local port and address instead of trying to bind the remote address and port - Fixes another critical networking bug svn path=/trunk/; revision=52092
This commit is contained in:
parent
a0f9149ce9
commit
768cc14b79
3 changed files with 29 additions and 2 deletions
|
@ -407,7 +407,7 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
case SOCKET_STATE_CREATED:
|
||||
if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress );
|
||||
FCB->LocalAddress =
|
||||
TaCopyTransportAddress( &ConnectReq->RemoteAddress );
|
||||
TaBuildNullTransportAddress( ConnectReq->RemoteAddress.Address[0].AddressType );
|
||||
|
||||
if( FCB->LocalAddress ) {
|
||||
Status = WarmSocketForBind( FCB );
|
||||
|
|
|
@ -38,7 +38,14 @@ UINT TaLengthOfAddress( PTA_ADDRESS Addr ) {
|
|||
}
|
||||
|
||||
UINT TaLengthOfTransportAddress( PTRANSPORT_ADDRESS Addr ) {
|
||||
UINT AddrLen = 2 * sizeof( ULONG ) + Addr->Address[0].AddressLength;
|
||||
UINT AddrLen = sizeof(ULONG) + TaLengthOfAddress(&Addr->Address[0]);
|
||||
AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen));
|
||||
return AddrLen;
|
||||
}
|
||||
|
||||
UINT TaLengthOfTransportAddressByType(UINT AddressType)
|
||||
{
|
||||
UINT AddrLen = sizeof(ULONG) + 2 * sizeof(USHORT) + TdiAddressSizeFromType(AddressType);
|
||||
AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen));
|
||||
return AddrLen;
|
||||
}
|
||||
|
@ -77,6 +84,25 @@ PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress ) {
|
|||
return A;
|
||||
}
|
||||
|
||||
PTRANSPORT_ADDRESS TaBuildNullTransportAddress(UINT AddressType)
|
||||
{
|
||||
UINT AddrLen;
|
||||
PTRANSPORT_ADDRESS A;
|
||||
|
||||
AddrLen = TaLengthOfTransportAddressByType(AddressType);
|
||||
A = ExAllocatePool(NonPagedPool, AddrLen);
|
||||
|
||||
if (A)
|
||||
{
|
||||
A->TAAddressCount = 1;
|
||||
A->Address[0].AddressLength = TdiAddressSizeFromType(AddressType);
|
||||
A->Address[0].AddressType = AddressType;
|
||||
RtlZeroMemory(A->Address[0].Address, A->Address[0].AddressLength);
|
||||
}
|
||||
|
||||
return A;
|
||||
}
|
||||
|
||||
NTSTATUS TdiBuildNullConnectionInfoInPlace
|
||||
( PTDI_CONNECTION_INFORMATION ConnInfo,
|
||||
ULONG Type )
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
typedef VOID *PTDI_CONNECTION_INFO_PAIR;
|
||||
|
||||
PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress );
|
||||
PTRANSPORT_ADDRESS TaBuildNullTransportAddress(UINT AddressType);
|
||||
UINT TaLengthOfAddress( PTA_ADDRESS Addr );
|
||||
UINT TaLengthOfTransportAddress( PTRANSPORT_ADDRESS Addr );
|
||||
VOID TaCopyAddressInPlace( PTA_ADDRESS Target, PTA_ADDRESS Source );
|
||||
|
|
Loading…
Reference in a new issue