Author: cgutman
Date: Sat Dec 5 17:29:41 2009
New Revision: 44412
URL:
http://svn.reactos.org/svn/reactos?rev=44412&view=rev
Log:
[TCPIP]
- Implement TDI_QUERY_MAX_DATAGRAM_INFO
[AFD]
- Send TDI_QUERY_MAX_DATAGRAM_INFO to set our send/receive windows properly
- Don't create a send window for a datagram socket because it is never used
- Fixes dropping all packets with length > 16384
Modified:
branches/aicom-network-branch/drivers/network/afd/afd/bind.c
branches/aicom-network-branch/drivers/network/afd/afd/connect.c
branches/aicom-network-branch/drivers/network/afd/afd/main.c
branches/aicom-network-branch/drivers/network/afd/afd/tdi.c
branches/aicom-network-branch/drivers/network/afd/include/afd.h
branches/aicom-network-branch/drivers/network/tcpip/tcpip/dispatch.c
Modified: branches/aicom-network-branch/drivers/network/afd/afd/bind.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/afd/afd/bind.c [iso-8859-1] (original)
+++ branches/aicom-network-branch/drivers/network/afd/afd/bind.c [iso-8859-1] Sat Dec 5
17:29:41 2009
@@ -32,6 +32,20 @@
FCB->LocalAddress,
&FCB->AddressFile.Handle,
&FCB->AddressFile.Object );
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS)
+ {
+ Status = TdiQueryMaxDatagramLength(FCB->AddressFile.Object,
+ &FCB->Recv.Size);
+ if (NT_SUCCESS(Status))
+ {
+ FCB->Recv.Window = ExAllocatePool(PagedPool, FCB->Recv.Size);
+ if (!FCB->Recv.Window)
+ Status = STATUS_NO_MEMORY;
+ }
+ }
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
@@ -69,10 +83,6 @@
if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) {
AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n"));
- FCB->Recv.Window = ExAllocatePool(PagedPool, FCB->Recv.Size);
- if (!FCB->Recv.Window)
- return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0);
-
Status = TdiReceiveDatagram
( &FCB->ReceiveIrp.InFlightRequest,
FCB->AddressFile.Object,
Modified: branches/aicom-network-branch/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/afd/afd/connect.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/drivers/network/afd/afd/connect.c [iso-8859-1] Sat Dec
5 17:29:41 2009
@@ -211,6 +211,13 @@
ASSERT(!FCB->Recv.Window);
ASSERT(!FCB->Send.Window);
+ Status = TdiQueryMaxDatagramLength(FCB->Connection.Object,
+ &FCB->Send.Size);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ FCB->Recv.Size = FCB->Send.Size;
+
/* Allocate the receive area and start receiving */
FCB->Recv.Window =
ExAllocatePool( PagedPool, FCB->Recv.Size );
Modified: branches/aicom-network-branch/drivers/network/afd/afd/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ branches/aicom-network-branch/drivers/network/afd/afd/main.c [iso-8859-1] Sat Dec 5
17:29:41 2009
@@ -268,8 +268,6 @@
FCB->State = SOCKET_STATE_CREATED;
FCB->FileObject = FileObject;
FCB->DeviceExt = DeviceExt;
- FCB->Recv.Size = DEFAULT_RECEIVE_WINDOW_SIZE;
- FCB->Send.Size = DEFAULT_SEND_WINDOW_SIZE;
FCB->AddressFile.Handle = INVALID_HANDLE_VALUE;
FCB->Connection.Handle = INVALID_HANDLE_VALUE;
@@ -313,13 +311,10 @@
/* It seems that UDP sockets are writable from inception */
if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) {
AFD_DbgPrint(MID_TRACE,("Packet oriented socket\n"));
- FCB->Send.Window = ExAllocatePool( PagedPool, FCB->Send.Size );
- if (FCB->Send.Window)
- {
- /* A datagram socket is always sendable */
- FCB->PollState |= AFD_EVENT_SEND;
- PollReeval( FCB->DeviceExt, FCB->FileObject );
- } else Status = STATUS_NO_MEMORY;
+
+ /* A datagram socket is always sendable */
+ FCB->PollState |= AFD_EVENT_SEND;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
}
if( !NT_SUCCESS(Status) ) {
Modified: branches/aicom-network-branch/drivers/network/afd/afd/tdi.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/afd/afd/tdi.c [iso-8859-1] (original)
+++ branches/aicom-network-branch/drivers/network/afd/afd/tdi.c [iso-8859-1] Sat Dec 5
17:29:41 2009
@@ -206,6 +206,56 @@
return Status;
}
+NTSTATUS TdiQueryMaxDatagramLength(
+ PFILE_OBJECT FileObject,
+ PUINT MaxDatagramLength)
+{
+ PMDL Mdl;
+ PTDI_MAX_DATAGRAM_INFO Buffer;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ Buffer = ExAllocatePool(NonPagedPool, sizeof(TDI_MAX_DATAGRAM_INFO));
+ if (!Buffer) return STATUS_NO_MEMORY;
+
+ Mdl = IoAllocateMdl(Buffer, sizeof(TDI_MAX_DATAGRAM_INFO), FALSE, FALSE, NULL);
+ if (!Mdl)
+ {
+ ExFreePool(Buffer);
+ return STATUS_NO_MEMORY;
+ }
+
+ _SEH2_TRY
+ {
+ MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ if (!NT_SUCCESS(Status))
+ {
+ IoFreeMdl(Mdl);
+ ExFreePool(Buffer);
+ return Status;
+ }
+
+ Status = TdiQueryInformation(FileObject,
+ TDI_QUERY_MAX_DATAGRAM_INFO,
+ Mdl);
+ if (!NT_SUCCESS(Status))
+ {
+ ExFreePool(Buffer);
+ return Status;
+ }
+
+ *MaxDatagramLength = Buffer->MaxDatagramSize;
+
+ ExFreePool(Buffer);
+
+ return STATUS_SUCCESS;
+}
NTSTATUS TdiOpenConnectionEndpointFile(
PUNICODE_STRING DeviceName,
Modified: branches/aicom-network-branch/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/afd/include/afd.h [iso-8859-1]
(original)
+++ branches/aicom-network-branch/drivers/network/afd/include/afd.h [iso-8859-1] Sat Dec
5 17:29:41 2009
@@ -107,9 +107,6 @@
#define EXTRA_LOCK_BUFFERS 2 /* Number of extra buffers needed
* for ancillary data on packet
* requests. */
-
-#define DEFAULT_SEND_WINDOW_SIZE 16384
-#define DEFAULT_RECEIVE_WINDOW_SIZE 16384
/* XXX This is a hack we should clean up later
* We do this in order to get some storage for the locked handle table
@@ -412,6 +409,10 @@
PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID CompletionContext);
+NTSTATUS TdiQueryMaxDatagramLength(
+ PFILE_OBJECT FileObject,
+ PUINT MaxDatagramLength);
+
/* write.c */
NTSTATUS NTAPI
Modified: branches/aicom-network-branch/drivers/network/tcpip/tcpip/dispatch.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/drivers/network/tcpip/tcpip/dispatch.c [iso-8859-1] Sat
Dec 5 17:29:41 2009
@@ -761,6 +761,15 @@
return TCPGetSockAddress( Endpoint, AddressInfo->RemoteAddress, TRUE );
}
+
+ case TDI_QUERY_MAX_DATAGRAM_INFO:
+ {
+ PTDI_MAX_DATAGRAM_INFO MaxDatagramInfo =
MmGetSystemAddressForMdl(Irp->MdlAddress);
+
+ MaxDatagramInfo->MaxDatagramSize = 0xFFFF;
+
+ return STATUS_SUCCESS;
+ }
}
return STATUS_NOT_IMPLEMENTED;