Author: cgutman
Date: Sun Jul 3 02:13:57 2011
New Revision: 52511
URL: http://svn.reactos.org/svn/reactos?rev=52511&view=rev
Log:
[TCPIP]
- Only wait to bind to a port if INADDR_ANY is specified
- Fixes EADDRNOTAVAIL when running Firefox and ws2_32_winetest sock (which now gets further but still doesn't complete)
Modified:
trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
Modified: trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] Sun Jul 3 02:13:57 2011
@@ -295,9 +295,21 @@
/* Sanity check */
ASSERT(Address->Address[0].Address[0].sin_port == AddrFile->Port);
}
+ else if (!AddrIsUnspecified(&AddrFile->Address))
+ {
+ /* The client is trying to bind to a local address so allocate a port now too */
+ AddrFile->Port = TCPAllocatePort(0);
+
+ /* Check for bind success */
+ if (AddrFile->Port == 0xffff)
+ {
+ ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
+ return STATUS_ADDRESS_ALREADY_EXISTS;
+ }
+ }
else
{
- /* The client wants an unspecified port so we wait to see what the TCP library gives us */
+ /* The client wants an unspecified port with an unspecified address so we wait to see what the TCP library gives us */
AddrFile->Port = 0;
}
Author: cgutman
Date: Sun Jul 3 01:53:10 2011
New Revision: 52510
URL: http://svn.reactos.org/svn/reactos?rev=52510&view=rev
Log:
[AFD]
- We really do need to count the outstanding send IRP in our pending send count (with a detailed explanation of the reason included in the code)
- Wait on an outstanding send IRP to dispatch the disconnect
- When we receive a FIN from the other side and our receive comes back with 0 data, only close receiving on the socket because sending is still legal in this state
- Fixes many bugs on the ws2_32_winetest sock and likely lots of other partial disconnect related stuff
- Retest network related hanging bugs after this please (ftp dir hang is fixed)
Modified:
trunk/reactos/drivers/network/afd/afd/info.c
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/write.c
Modified: trunk/reactos/drivers/network/afd/afd/info.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/in…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/info.c [iso-8859-1] Sun Jul 3 01:53:10 2011
@@ -70,7 +70,18 @@
CurrentEntry = CurrentEntry->Flink;
}
- break;
+ /* This needs to count too because when this is dispatched
+ * the user-mode IRP has already been completed and therefore
+ * will NOT be in our pending IRP list. We count this as one send
+ * outstanding although it could be multiple since we batch sends
+ * when waiting for the in flight request to return, so this number
+ * may not be accurate but it really doesn't matter that much since
+ * it's more or less a zero/non-zero comparison to determine whether
+ * we can shutdown the socket
+ */
+ if (FCB->SendIrp.InFlightRequest)
+ InfoReq->Information.Ulong++;
+ break;
default:
AFD_DbgPrint(MID_TRACE,("Unknown info id %x\n",
Modified: trunk/reactos/drivers/network/afd/afd/main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Sun Jul 3 01:53:10 2011
@@ -553,7 +553,8 @@
FCB->DisconnectIrp.InFlightRequest = NULL;
ASSERT(FCB->DisconnectPending);
- //ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) || (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT));
+ ASSERT((IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest) ||
+ (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT));
if (NT_SUCCESS(Irp->IoStatus.Status) && (FCB->DisconnectFlags & TDI_DISCONNECT_RELEASE))
{
@@ -606,6 +607,8 @@
NTSTATUS Status;
ASSERT(FCB->DisconnectPending);
+ ASSERT((IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest) ||
+ (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT));
if (FCB->DisconnectIrp.InFlightRequest)
{
@@ -639,7 +642,7 @@
{
ASSERT(FCB->RemoteAddress);
- if (IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && FCB->DisconnectPending)
+ if (IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest && FCB->DisconnectPending)
{
/* Sends are done; fire off a TDI_DISCONNECT request */
DoDisconnect(FCB);
@@ -704,9 +707,10 @@
Status = QueueUserModeIrp(FCB, Irp, FUNCTION_DISCONNECT);
if (Status == STATUS_PENDING)
{
- if (IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) || (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT))
+ if ((IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest) ||
+ (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT))
{
- /* Go ahead an execute the disconnect because we're ready for it */
+ /* Go ahead and execute the disconnect because we're ready for it */
Status = DoDisconnect(FCB);
}
Modified: trunk/reactos/drivers/network/afd/afd/read.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Sun Jul 3 01:53:10 2011
@@ -31,8 +31,8 @@
if( ( Status == STATUS_SUCCESS && !Information ) ||
( !NT_SUCCESS( Status ) ) )
{
- /* The socket has been closed */
- FCB->PollState |= AFD_EVENT_CLOSE;
+ /* The socket has been closed by the remote side */
+ FCB->PollState |= AFD_EVENT_ABORT;
FCB->PollStatus[FD_CLOSE_BIT] = Status;
PollReeval( FCB->DeviceExt, FCB->FileObject );
Modified: trunk/reactos/drivers/network/afd/afd/write.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Sun Jul 3 01:53:10 2011
@@ -179,7 +179,10 @@
&FCB->SendIrp.Iosb,
SendComplete,
FCB );
-
+ }
+ else
+ {
+ /* Nothing is waiting so try to complete a pending disconnect */
RetryDisconnectCompletion(FCB);
}
@@ -300,6 +303,12 @@
return UnlockAndMaybeComplete( FCB, Status, Irp, Information );
}
+ if (FCB->DisconnectPending && (FCB->DisconnectFlags & TDI_DISCONNECT_RELEASE))
+ {
+ /* We're pending a send shutdown so don't accept anymore sends */
+ return UnlockAndMaybeComplete(FCB, STATUS_FILE_CLOSED, Irp, 0);
+ }
+
if (FCB->PollState & (AFD_EVENT_CLOSE | AFD_EVENT_DISCONNECT))
{
if (FCB->PollStatus[FD_CLOSE_BIT] == STATUS_SUCCESS)
@@ -435,8 +444,6 @@
FCB->PollState &= ~AFD_EVENT_SEND;
}
- RetryDisconnectCompletion(FCB);
-
return UnlockAndMaybeComplete
( FCB, Status, Irp, TotalBytesCopied );
}
Author: tkreuzer
Date: Sat Jul 2 23:11:06 2011
New Revision: 52507
URL: http://svn.reactos.org/svn/reactos?rev=52507&view=rev
Log:
[NTOSKNRL]
- Change an ASSERT to a KeBugCheck, since the assertion can fail for any invalid memory access and this is not an internal Mm failure.
- Remove 2 cases, that "Should NEVER happen on ARM3!!!", but can very well happen.
- Do NOT make the code cleaner, by releasing the PFN lock in the same function that acquires it, but keep it 2 functions down. This is because it *SHOULD* be that way, since some internal undocumented functions, that we do not implement but that are (theoretically) called from here, also do release the PFN lock. Thanks Alex for explaining this.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Sat Jul 2 23:11:06 2011
@@ -583,10 +583,19 @@
}
//
- // The PTE must be invalid, but not totally blank
+ // The PTE must be invalid
//
ASSERT(TempPte.u.Hard.Valid == 0);
- ASSERT(TempPte.u.Long != 0);
+
+ /* Check if the PTE is completely empty */
+ if (TempPte.u.Long == 0)
+ {
+ KeBugCheckEx(PAGE_FAULT_IN_NONPAGED_AREA,
+ (ULONG_PTR)Address,
+ StoreInstruction,
+ (ULONG_PTR)TrapInformation,
+ 2);
+ }
//
// No prototype, transition or page file software PTEs in ARM3 yet
@@ -727,11 +736,6 @@
// Writing to a read-only page (the stuff ARM3 works with is write,
// so again, moot point).
//
- if (StoreInstruction)
- {
- DPRINT1("Should NEVER happen on ARM3!!!\n");
- return STATUS_ACCESS_VIOLATION;
- }
//
// Otherwise, the PDE was probably invalid, and all is good now
@@ -776,11 +780,6 @@
// Writing to a read-only page (the stuff ARM3 works with is write,
// so again, moot point.
//
- if (StoreInstruction)
- {
- DPRINT1("Should NEVER happen on ARM3!!!\n");
- return STATUS_ACCESS_VIOLATION;
- }
/* Release the working set */
MiUnlockWorkingSet(CurrentThread, WorkingSet);
Author: cgutman
Date: Sat Jul 2 22:57:30 2011
New Revision: 52505
URL: http://svn.reactos.org/svn/reactos?rev=52505&view=rev
Log:
[OSKITTCP]
- Remove socket state checks from OskitTCPRecv and OskitTCPSend
- Oskit already returns ESHUTDOWN when sosend is called on a socket with SS_CANTSENDMORE so it is unnecessary
- The check in OskitTCPRecv broke returning success and 0 bytes on a graceful shutdown (We got the FIN, set SS_CANTRCVMORE, signaled the connection, tried to read and failed with ESHUTDOWN instead of succeeding with 0 bytes)
Modified:
trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] Sat Jul 2 22:57:30 2011
@@ -158,9 +158,6 @@
if (!connection)
return OSK_ESHUTDOWN;
-
- if (so->so_state & SS_CANTRCVMORE)
- return OSK_ESHUTDOWN;
OS_DbgPrint(OSK_MID_TRACE,
("so->so_state %x\n", so->so_state));
@@ -302,9 +299,6 @@
struct iovec iov;
if (!socket)
- return OSK_ESHUTDOWN;
-
- if (so->so_state & SS_CANTSENDMORE)
return OSK_ESHUTDOWN;
iov.iov_len = Len;