Author: cgutman
Date: Sun Jun 5 17:08:37 2011
New Revision: 52092
URL:
http://svn.reactos.org/svn/reactos?rev=52092&view=rev
Log:
[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
Modified:
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/tdiconn.c
trunk/reactos/drivers/network/afd/include/tdiconn.h
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Sun Jun 5 17:08:37 2011
@@ -407,7 +407,7 @@
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 );
Modified: trunk/reactos/drivers/network/afd/afd/tdiconn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/td…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/tdiconn.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/tdiconn.c [iso-8859-1] Sun Jun 5 17:08:37 2011
@@ -38,7 +38,14 @@
}
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;
}
@@ -75,6 +82,25 @@
TaCopyTransportAddressInPlace( A, 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
Modified: trunk/reactos/drivers/network/afd/include/tdiconn.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/tdiconn.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/tdiconn.h [iso-8859-1] Sun Jun 5 17:08:37
2011
@@ -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 );