Author: cgutman
Date: Mon Oct 26 04:11:44 2009
New Revision: 43767
URL:
http://svn.reactos.org/svn/reactos?rev=43767&view=rev
Log:
- Update AFD's shared header
- Add entity type check for IF_MIB_STATS_ID
- Sort out some confusion with TDI entities
- Implement IOCTL_AFD_GET_CONTEXT_SIZE
- Enable debug prints for unimplemented ioctls
- Add kernel-mode support for setting TTL
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
trunk/reactos/dll/win32/msafd/misc/sndrcv.c
trunk/reactos/drivers/network/afd/afd/context.c
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/write.c
trunk/reactos/drivers/network/afd/include/afd.h
trunk/reactos/drivers/network/tcpip/include/info.h
trunk/reactos/drivers/network/tcpip/include/rawip.h
trunk/reactos/drivers/network/tcpip/include/titypes.h
trunk/reactos/drivers/network/tcpip/tcpip.rbuild
trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
trunk/reactos/drivers/network/tcpip/tcpip/info.c
trunk/reactos/include/reactos/drivers/afd/shared.h
trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c
trunk/reactos/lib/drivers/ip/transport/udp/udp.c
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Mon Oct 26 04:11:44 2009
@@ -1230,7 +1230,7 @@
NULL);
/* Set up the Accept Structure */
- AcceptData.ListenHandle = AcceptSocket;
+ AcceptData.ListenHandle = (HANDLE)AcceptSocket;
AcceptData.SequenceNumber = ListenReceiveData->SequenceNumber;
/* Send IOCTL to Accept */
Modified: trunk/reactos/dll/win32/msafd/misc/sndrcv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/sndrc…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] Mon Oct 26 04:11:44 2009
@@ -561,8 +561,8 @@
SendInfo.BufferArray = (PAFD_WSABUF)lpBuffers;
SendInfo.AfdFlags = Socket->SharedData.NonBlocking ? AFD_IMMEDIATE : 0;
SendInfo.BufferCount = dwBufferCount;
- SendInfo.RemoteAddress = RemoteAddress;
- SendInfo.SizeOfRemoteAddress = Socket->HelperData->MaxTDIAddressLength;
+ SendInfo.TdiConnection.RemoteAddress = RemoteAddress;
+ SendInfo.TdiConnection.RemoteAddressLength =
Socket->HelperData->MaxTDIAddressLength;
/* Verifiy if we should use APC */
if (lpOverlapped == NULL)
Modified: trunk/reactos/drivers/network/afd/afd/context.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/context.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/context.c [iso-8859-1] Mon Oct 26 04:11:44 2009
@@ -33,9 +33,28 @@
AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status));
- return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
+ return UnlockAndMaybeComplete( FCB, Status, Irp, ContextSize );
}
+NTSTATUS NTAPI
+AfdGetContextSize( PDEVICE_OBJECT DeviceObject, PIRP Irp,
+ PIO_STACK_LOCATION IrpSp )
+{
+ PFILE_OBJECT FileObject = IrpSp->FileObject;
+ PAFD_FCB FCB = FileObject->FsContext;
+
+ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
+
+ if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG))
+ return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, sizeof(ULONG));
+
+ RtlCopyMemory(Irp->UserBuffer,
+ &FCB->ContextSize,
+ sizeof(ULONG));
+
+ return UnlockAndMaybeComplete(FCB, STATUS_SUCCESS, Irp, sizeof(ULONG));
+}
+
NTSTATUS NTAPI
AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp ) {
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Mon Oct 26 04:11:44 2009
@@ -392,7 +392,7 @@
RemoveEntryList( PendingConn );
Status = ObReferenceObjectByHandle
- ( (HANDLE)AcceptData->ListenHandle,
+ ( AcceptData->ListenHandle,
FILE_ALL_ACCESS,
NULL,
KernelMode,
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] Mon Oct 26 04:11:44 2009
@@ -354,7 +354,7 @@
AfdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
#if DBG
PFILE_OBJECT FileObject = IrpSp->FileObject;
#endif
@@ -431,6 +431,9 @@
case IOCTL_AFD_SET_INFO:
return AfdSetInfo( DeviceObject, Irp, IrpSp );
+ case IOCTL_AFD_GET_CONTEXT_SIZE:
+ return AfdGetContextSize( DeviceObject, Irp, IrpSp );
+
case IOCTL_AFD_GET_CONTEXT:
return AfdGetContext( DeviceObject, Irp, IrpSp );
@@ -453,70 +456,73 @@
return AfdGetPeerName( DeviceObject, Irp, IrpSp );
case IOCTL_AFD_GET_TDI_HANDLES:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_TDI_HANDLES\n"));
+ DbgPrint("IOCTL_AFD_GET_TDI_HANDLES is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_CONNECT_DATA:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_DATA\n"));
+ DbgPrint("IOCTL_AFD_SET_CONNECT_DATA is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_CONNECT_OPTIONS:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_OPTIONS\n"));
+ DbgPrint("IOCTL_AFD_SET_CONNECT_OPTIONS is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_DISCONNECT_DATA:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_DATA\n"));
+ DbgPrint("IOCTL_AFD_SET_DISCONNECT_DATA is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_DISCONNECT_OPTIONS:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_OPTIONS\n"));
+ DbgPrint("IOCTL_AFD_SET_DISCONNECT_OPTIONS is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_GET_CONNECT_DATA:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_CONNECT_DATA\n"));
+ DbgPrint("IOCTL_AFD_GET_CONNECT_DATA is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_GET_CONNECT_OPTIONS:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_CONNECT_OPTIONS\n"));
+ DbgPrint("IOCTL_AFD_GET_CONNECT_OPTIONS is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_GET_DISCONNECT_DATA:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_DISCONNECT_DATA\n"));
+ DbgPrint("IOCTL_AFD_GET_DISCONNECT_DATA is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_GET_DISCONNECT_OPTIONS:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_DISCONNECT_OPTIONS\n"));
+ DbgPrint("IOCTL_AFD_GET_DISCONNECT_OPTIONS is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_CONNECT_DATA_SIZE:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_DATA_SIZE\n"));
+ DbgPrint("IOCTL_AFD_SET_CONNECT_DATA_SIZE is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE\n"));
+ DbgPrint("IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_DISCONNECT_DATA_SIZE:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_DATA_SIZE\n"));
+ DbgPrint("IOCTL_AFD_SET_DISCONNECT_DATA_SIZE is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE\n"));
+ DbgPrint("IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_DEFER_ACCEPT:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_DEFER_ACCEPT\n"));
+ DbgPrint("IOCTL_AFD_DEFER_ACCEPT is UNIMPLEMENTED!\n");
break;
case IOCTL_AFD_GET_PENDING_CONNECT_DATA:
- AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_PENDING_CONNECT_DATA\n"));
+ DbgPrint("IOCTL_AFD_GET_PENDING_CONNECT_DATA is UNIMPLEMENTED!\n");
+ break;
+
+ case IOCTL_AFD_VALIDATE_GROUP:
+ DbgPrint("IOCTL_AFD_VALIDATE_GROUP is UNIMPLEMENTED!\n");
break;
default:
- Status = STATUS_NOT_IMPLEMENTED;
- AFD_DbgPrint(MIN_TRACE, ("Unknown IOCTL (0x%x)\n",
- IrpSp->Parameters.DeviceIoControl.
- IoControlCode));
+ Status = STATUS_NOT_SUPPORTED;
+ DbgPrint("Unknown IOCTL (0x%x)\n",
+ IrpSp->Parameters.DeviceIoControl.IoControlCode);
break;
}
break;
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] Mon Oct 26 04:11:44 2009
@@ -416,13 +416,13 @@
AFD_DbgPrint
(MID_TRACE,("RemoteAddress #%d Type %d\n",
- ((PTRANSPORT_ADDRESS)SendReq->RemoteAddress)->
+ ((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
TAAddressCount,
- ((PTRANSPORT_ADDRESS)SendReq->RemoteAddress)->
+ ((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)->
Address[0].AddressType));
TdiBuildConnectionInfo( &TargetAddress,
- ((PTRANSPORT_ADDRESS)SendReq->RemoteAddress) );
+ ((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress) );
/* Check the size of the Address given ... */
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Mon Oct 26 04:11:44 2009
@@ -226,6 +226,9 @@
AfdGetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp );
NTSTATUS NTAPI
+AfdGetContextSize( PDEVICE_OBJECT DeviceObject, PIRP Irp,
+ PIO_STACK_LOCATION IrpSp );
+NTSTATUS NTAPI
AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp,
PIO_STACK_LOCATION IrpSp );
Modified: trunk/reactos/drivers/network/tcpip/include/info.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -173,9 +173,26 @@
PNDIS_BUFFER Buffer,
PUINT BufferSize);
-/* Insert and remove interface entities */
+TDI_STATUS SetAddressFileInfo(TDIObjectID *ID,
+ PADDRESS_FILE AddrFile,
+ PVOID Buffer,
+ UINT BufferSize);
+
+TDI_STATUS GetAddressFileInfo(TDIObjectID *ID,
+ PADDRESS_FILE AddrFile,
+ PVOID Buffer,
+ PUINT BufferSize);
+
+/* Insert and remove entities */
VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface );
+
VOID RemoveTDIInterfaceEntity( PIP_INTERFACE Interface );
+
+VOID AddEntity(ULONG EntityType,
+ PVOID Context,
+ ULONG Flags);
+
+VOID RemoveEntityByContext(PVOID Context);
#endif /* __INFO_H */
Modified: trunk/reactos/drivers/network/tcpip/include/rawip.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/rawip.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/rawip.h [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -25,6 +25,7 @@
VOID);
NTSTATUS AddGenericHeaderIPv4(
+ PADDRESS_FILE AddrFile,
PIP_ADDRESS RemoteAddress,
USHORT RemotePort,
PIP_ADDRESS LocalAddress,
Modified: trunk/reactos/drivers/network/tcpip/include/titypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/titypes.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/titypes.h [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -158,6 +158,7 @@
USHORT Family; /* Address family */
USHORT Protocol; /* Protocol number */
USHORT Port; /* Network port (network byte order) */
+ UCHAR TTL; /* Time to live stored in packets sent from
this address file */
WORK_QUEUE_ITEM WorkItem; /* Work queue item handle */
DATAGRAM_COMPLETION_ROUTINE Complete; /* Completion routine for delete request */
PVOID Context; /* Delete request context */
Modified: trunk/reactos/drivers/network/tcpip/tcpip.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip.rbuild [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip.rbuild [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -25,6 +25,7 @@
<file>recmutex.c</file>
</directory>
<directory name="tcpip">
+ <file>ainfo.c</file>
<file>buffer.c</file>
<file>dispatch.c</file>
<file>fileobjs.c</file>
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] Mon Oct 26 04:11:44
2009
@@ -201,6 +201,9 @@
AddrFile->Free = AddrFileFree;
+ /* Set our default TTL */
+ AddrFile->TTL = 128;
+
/* Make sure address is a local unicast address or 0 */
/* FIXME: IPv4 only */
AddrFile->Family = Address->Address[0].AddressType;
@@ -231,6 +234,8 @@
return STATUS_INVALID_PARAMETER;
}
+ AddEntity(CO_TL_ENTITY, AddrFile, CO_TL_TCP);
+
AddrFile->Send = NULL; /* TCPSendData */
break;
@@ -250,18 +255,27 @@
TI_DbgPrint(MID_TRACE,("Setting port %d (wanted %d)\n",
AddrFile->Port,
Address->Address[0].Address[0].sin_port));
+
+ AddEntity(CL_TL_ENTITY, AddrFile, CL_TL_UDP);
+
AddrFile->Send = UDPSendDatagram;
break;
case IPPROTO_ICMP:
AddrFile->Port = 0;
AddrFile->Send = ICMPSendDatagram;
+
+ /* FIXME: Verify this */
+ AddEntity(ER_ENTITY, AddrFile, ER_ICMP);
break;
default:
/* Use raw IP for all other protocols */
AddrFile->Port = 0;
AddrFile->Send = RawIPSendDatagram;
+
+ /* FIXME: Verify this */
+ AddEntity(CL_TL_ENTITY, AddrFile, 0);
break;
}
@@ -380,6 +394,8 @@
break;
}
+ RemoveEntityByContext(AddrFile);
+
(*AddrFile->Free)(AddrFile);
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
Modified: trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -160,105 +160,17 @@
}
VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ) {
- KIRQL OldIrql;
- UINT IFCount = 0, CLNLCount = 0, CLTLCount = 0, COTLCount = 0, ATCount = 0, ERCount =
0, i;
+ AddEntity(IF_ENTITY, Interface, IF_MIB);
- TI_DbgPrint(DEBUG_INFO,
- ("Inserting interface %08x (%d entities already)\n",
- Interface, EntityCount));
+ AddEntity(AT_ENTITY, Interface,
+ (Interface != Loopback) ? AT_ARP : AT_NULL);
- TcpipAcquireSpinLock( &EntityListLock, &OldIrql );
-
- /* Count IP Entities */
- for( i = 0; i < EntityCount; i++ )
- switch( EntityList[i].tei_entity )
- {
- case IF_ENTITY:
- IFCount++;
- break;
-
- case CL_NL_ENTITY:
- CLNLCount++;
- break;
-
- case CL_TL_ENTITY:
- CLTLCount++;
- break;
-
- case CO_TL_ENTITY:
- COTLCount++;
- break;
-
- case AT_ENTITY:
- ATCount++;
- break;
-
- case ER_ENTITY:
- ERCount++;
- break;
-
- default:
- break;
- }
-
- EntityList[EntityCount].tei_entity = IF_ENTITY;
- EntityList[EntityCount].tei_instance = IFCount;
- EntityList[EntityCount].context = Interface;
- EntityList[EntityCount].flags = IF_MIB;
- EntityCount++;
- EntityList[EntityCount].tei_entity = CL_NL_ENTITY;
- EntityList[EntityCount].tei_instance = CLNLCount;
- EntityList[EntityCount].context = Interface;
- EntityList[EntityCount].flags = CL_NL_IP;
- EntityCount++;
- EntityList[EntityCount].tei_entity = CL_TL_ENTITY;
- EntityList[EntityCount].tei_instance = CLTLCount;
- EntityList[EntityCount].context = Interface;
- EntityList[EntityCount].flags = CL_TL_UDP;
- EntityCount++;
- EntityList[EntityCount].tei_entity = CO_TL_ENTITY;
- EntityList[EntityCount].tei_instance = COTLCount;
- EntityList[EntityCount].context = Interface;
- EntityList[EntityCount].flags = CO_TL_TCP;
- EntityCount++;
- EntityList[EntityCount].tei_entity = ER_ENTITY;
- EntityList[EntityCount].tei_instance = ERCount;
- EntityList[EntityCount].context = Interface;
- EntityList[EntityCount].flags = ER_ICMP;
- EntityCount++;
- EntityList[EntityCount].tei_entity = AT_ENTITY;
- EntityList[EntityCount].tei_instance = ATCount;
- EntityList[EntityCount].context = Interface;
- EntityList[EntityCount].flags = (Interface != Loopback) ? AT_ARP : AT_NULL;
- EntityCount++;
-
- TcpipReleaseSpinLock( &EntityListLock, OldIrql );
+ /* FIXME: This is probably wrong */
+ AddEntity(CL_NL_ENTITY, Interface, CL_NL_IP);
}
VOID RemoveTDIInterfaceEntity( PIP_INTERFACE Interface ) {
- KIRQL OldIrql;
- UINT i;
-
- TI_DbgPrint(DEBUG_INFO,("Removing TDI entry 0x%x\n", Interface));
-
- TcpipAcquireSpinLock( &EntityListLock, &OldIrql );
-
- /* Remove entities that have this interface as context
- * In the future, this might include AT_ENTITY types, too
- */
- for( i = 0; i < EntityCount; i++ ) {
- TI_DbgPrint(DEBUG_INFO,("--> examining TDI entry 0x%x\n",
EntityList[i].context));
- if( EntityList[i].context == Interface ) {
- if( i != EntityCount-1 ) {
- memcpy( &EntityList[i],
- &EntityList[--EntityCount],
- sizeof(EntityList[i]) );
- } else {
- EntityCount--;
- }
- }
- }
-
- TcpipReleaseSpinLock( &EntityListLock, OldIrql );
+ /* This removes all of them */
+ RemoveEntityByContext(Interface);
}
Modified: trunk/reactos/drivers/network/tcpip/tcpip/info.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -11,6 +11,48 @@
#include "precomp.h"
#include <debug.h>
#include <route.h>
+
+VOID AddEntity(ULONG EntityType, PVOID Context, ULONG Flags)
+{
+ KIRQL OldIrql;
+ ULONG i, Count = 0;
+
+ TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
+
+ for (i = 0; i < EntityCount; i++)
+ if (EntityList[i].tei_entity == EntityType)
+ Count++;
+
+ EntityList[EntityCount].tei_entity = EntityType;
+ EntityList[EntityCount].tei_instance = Count;
+ EntityList[EntityCount].context = Context;
+ EntityList[EntityCount].flags = Flags;
+ EntityCount++;
+
+ TcpipReleaseSpinLock(&EntityListLock, OldIrql);
+}
+
+VOID RemoveEntityByContext(PVOID Context)
+{
+ ULONG i;
+ KIRQL OldIrql;
+
+ TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
+
+ for (i = 0; i < EntityCount; i++) {
+ if( EntityList[i].context == Context ) {
+ if( i != EntityCount - 1 ) {
+ memcpy( &EntityList[i],
+ &EntityList[--EntityCount],
+ sizeof(EntityList[i]) );
+ } else {
+ EntityCount--;
+ }
+ }
+ }
+
+ TcpipReleaseSpinLock(&EntityListLock, OldIrql);
+}
PVOID GetContext(TDIEntityID ID)
{
@@ -178,9 +220,20 @@
}
case INFO_CLASS_PROTOCOL:
+ if (ID->toi_type == INFO_TYPE_ADDRESS_OBJECT)
+ {
+ if ((EntityListContext = GetContext(ID->toi_entity)))
+ return GetAddressFileInfo(ID, EntityListContext, Buffer,
BufferSize);
+ else
+ return TDI_INVALID_PARAMETER;
+ }
+
switch (ID->toi_id)
{
case IF_MIB_STATS_ID:
+ if (ID->toi_type != INFO_TYPE_PROVIDER)
+ return TDI_INVALID_PARAMETER;
+
if (ID->toi_entity.tei_entity == IF_ENTITY)
if ((EntityListContext = GetContext(ID->toi_entity)))
return InfoTdiQueryGetInterfaceMIB(ID->toi_entity,
EntityListContext, Buffer, BufferSize);
@@ -262,6 +315,14 @@
switch (ID->toi_class)
{
case INFO_CLASS_PROTOCOL:
+ if (ID->toi_type == INFO_TYPE_ADDRESS_OBJECT)
+ {
+ if ((EntityListContext = GetContext(ID->toi_entity)))
+ return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize);
+ else
+ return TDI_INVALID_PARAMETER;
+ }
+
switch (ID->toi_id)
{
case IP_MIB_ARPTABLE_ENTRY_ID:
Modified: trunk/reactos/include/reactos/drivers/afd/shared.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/drivers/af…
==============================================================================
--- trunk/reactos/include/reactos/drivers/afd/shared.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/drivers/afd/shared.h [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -30,6 +30,7 @@
union {
ULONG Ulong;
LARGE_INTEGER LargeInteger;
+ BOOLEAN Boolean;
} Information;
ULONG Padding;
} AFD_INFO, *PAFD_INFO;
@@ -61,7 +62,7 @@
typedef struct _AFD_ACCEPT_DATA {
ULONG UseSAN;
ULONG SequenceNumber;
- ULONG ListenHandle;
+ HANDLE ListenHandle;
} AFD_ACCEPT_DATA, *PAFD_ACCEPT_DATA;
typedef struct _AFD_RECEIVED_ACCEPT_DATA {
@@ -107,9 +108,8 @@
PAFD_WSABUF BufferArray;
ULONG BufferCount;
ULONG AfdFlags;
- ULONG Padding[9];
- ULONG SizeOfRemoteAddress;
- PVOID RemoteAddress;
+ TDI_REQUEST_SEND_DATAGRAM TdiRequest;
+ TDI_CONNECTION_INFORMATION TdiConnection;
} AFD_SEND_INFO_UDP, *PAFD_SEND_INFO_UDP;
typedef struct _AFD_CONNECT_INFO {
@@ -134,6 +134,18 @@
ULONG DisconnectType;
LARGE_INTEGER Timeout;
} AFD_DISCONNECT_INFO, *PAFD_DISCONNECT_INFO;
+
+typedef struct _AFD_VALIDATE_GROUP_DATA
+{
+ LONG GroupId;
+ TRANSPORT_ADDRESS Address;
+} AFD_VALIDATE_GROUP_DATA, *PAFD_VALIDATE_GROUP_DATA;
+
+typedef struct _AFD_TDI_HANDLE_DATA
+{
+ HANDLE TdiAddressHandle;
+ HANDLE TdiConnectionHandle;
+} AFD_TDI_HANDLE_DATA, *PAFD_TDI_HANDLE_DATA;
/* AFD Packet Endpoint Flags */
#define AFD_ENDPOINT_CONNECTIONLESS 0x1
@@ -143,9 +155,31 @@
#define AFD_ENDPOINT_C_ROOT 0x10000
#define AFD_ENDPOINT_D_ROOT 0x100000
+/* AFD TDI Query Flags */
+#define AFD_ADDRESS_HANDLE 0x1L
+#define AFD_CONNECTION_HANDLE 0x2L
+
+/* AFD event bits */
+#define AFD_EVENT_RECEIVE_BIT 0
+#define AFD_EVENT_OOB_RECEIVE_BIT 1
+#define AFD_EVENT_SEND_BIT 2
+#define AFD_EVENT_DISCONNECT_BIT 3
+#define AFD_EVENT_ABORT_BIT 4
+#define AFD_EVENT_CLOSE_BIT 5
+#define AFD_EVENT_CONNECT_BIT 6
+#define AFD_EVENT_ACCEPT_BIT 7
+#define AFD_EVENT_CONNECT_FAIL_BIT 8
+#define AFD_EVENT_QOS_BIT 9
+#define AFD_EVENT_GROUP_QOS_BIT 10
+#define AFD_EVENT_ROUTING_INTERFACE_CHANGE_BIT 11
+#define AFD_EVENT_ADDRESS_LIST_CHANGE_BIT 12
+#define AFD_MAX_EVENT 13
+#define AFD_ALL_EVENTS ((1 << AFD_MAX_EVENT) - 1)
+
/* AFD Info Flags */
+#define AFD_INFO_INLINING_MODE 0x01L
#define AFD_INFO_BLOCKING_MODE 0x02L
-#define AFD_INFO_SENDS_IN_PROGRESS 0x04L
+#define AFD_INFO_SENDS_IN_PROGRESS 0x04L
#define AFD_INFO_RECEIVE_WINDOW_SIZE 0x06L
#define AFD_INFO_SEND_WINDOW_SIZE 0x07L
#define AFD_INFO_GROUP_ID_TYPE 0x10L
@@ -160,20 +194,23 @@
/* AFD Disconnect Flags */
#define AFD_DISCONNECT_SEND 0x01L
#define AFD_DISCONNECT_RECV 0x02L
-#define AFD_DISCONNECT_ABORT 0x04L
+#define AFD_DISCONNECT_ABORT 0x04L
+#define AFD_DISCONNECT_DATAGRAM 0x08L
/* AFD Event Flags */
-#define AFD_EVENT_RECEIVE 0x1L
-#define AFD_EVENT_OOB_RECEIVE 0x2L
-#define AFD_EVENT_SEND 0x4L
-#define AFD_EVENT_DISCONNECT 0x8L
-#define AFD_EVENT_ABORT 0x10L
-#define AFD_EVENT_CLOSE 0x20L
-#define AFD_EVENT_CONNECT 0x40L
-#define AFD_EVENT_ACCEPT 0x80L
-#define AFD_EVENT_CONNECT_FAIL 0x100L
-#define AFD_EVENT_QOS 0x200L
-#define AFD_EVENT_GROUP_QOS 0x400L
+#define AFD_EVENT_RECEIVE (1 << AFD_EVENT_RECEIVE_BIT)
+#define AFD_EVENT_OOB_RECEIVE (1 << AFD_EVENT_OOB_RECEIVE_BIT)
+#define AFD_EVENT_SEND (1 << AFD_EVENT_SEND_BIT)
+#define AFD_EVENT_DISCONNECT (1 << AFD_EVENT_DISCONNECT_BIT)
+#define AFD_EVENT_ABORT (1 << AFD_EVENT_ABORT_BIT)
+#define AFD_EVENT_CLOSE (1 << AFD_EVENT_CLOSE_BIT)
+#define AFD_EVENT_CONNECT (1 << AFD_EVENT_CONNECT_BIT)
+#define AFD_EVENT_ACCEPT (1 << AFD_EVENT_ACCEPT_BIT)
+#define AFD_EVENT_CONNECT_FAIL (1 << AFD_EVENT_CONNECT_FAIL_BIT)
+#define AFD_EVENT_QOS (1 << AFD_EVENT_QOS_BIT)
+#define AFD_EVENT_GROUP_QOS (1 << AFD_EVENT_GROUP_QOS_BIT)
+#define AFD_EVENT_ROUTING_INTERFACE_CHANGE (1 <<
AFD_EVENT_ROUTING_INTERFACE_CHANGE_BIT)
+#define AFD_EVENT_ADDRESS_LIST_CHANGE (1 <<
AFD_EVENT_ADDRESS_LIST_CHANGE_BIT)
/* AFD SEND/RECV Flags */
#define AFD_SKIP_FIO 0x1L
@@ -201,6 +238,7 @@
#define AFD_GET_PEER_NAME 12
#define AFD_GET_TDI_HANDLES 13
#define AFD_SET_INFO 14
+#define AFD_GET_CONTEXT_SIZE 15
#define AFD_GET_CONTEXT 16
#define AFD_SET_CONTEXT 17
#define AFD_SET_CONNECT_DATA 18
@@ -220,6 +258,7 @@
#define AFD_ENUM_NETWORK_EVENTS 34
#define AFD_DEFER_ACCEPT 35
#define AFD_GET_PENDING_CONNECT_DATA 41
+#define AFD_VALIDATE_GROUP 42
/* AFD IOCTLs */
@@ -253,6 +292,8 @@
_AFD_CONTROL_CODE(AFD_GET_TDI_HANDLES, METHOD_NEITHER)
#define IOCTL_AFD_SET_INFO \
_AFD_CONTROL_CODE(AFD_SET_INFO, METHOD_NEITHER)
+#define IOCTL_AFD_GET_CONTEXT_SIZE \
+ _AFD_CONTROL_CODE(AFD_GET_CONTEXT_SIZE, METHOD_NEITHER)
#define IOCTL_AFD_GET_CONTEXT \
_AFD_CONTROL_CODE(AFD_GET_CONTEXT, METHOD_NEITHER)
#define IOCTL_AFD_SET_CONTEXT \
@@ -291,6 +332,8 @@
_AFD_CONTROL_CODE(AFD_GET_PENDING_CONNECT_DATA, METHOD_NEITHER)
#define IOCTL_AFD_ENUM_NETWORK_EVENTS \
_AFD_CONTROL_CODE(AFD_ENUM_NETWORK_EVENTS, METHOD_NEITHER)
+#define IOCTL_AFD_VALIDATE_GROUP \
+ _AFD_CONTROL_CODE(AFD_VALIDATE_GROUP, METHOD_NEITHER)
typedef struct _AFD_SOCKET_INFORMATION {
BOOL CommandChannel;
Modified: trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/r…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/rawip/rawip.c [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -11,6 +11,7 @@
#include "precomp.h"
NTSTATUS AddGenericHeaderIPv4(
+ PADDRESS_FILE AddrFile,
PIP_ADDRESS RemoteAddress,
USHORT RemotePort,
PIP_ADDRESS LocalAddress,
@@ -62,9 +63,9 @@
IPHeader->Id = (USHORT)Random();
/* One fragment at offset 0 */
IPHeader->FlagsFragOfs = 0;
- /* Time-to-Live is 128 */
- IPHeader->Ttl = 128;
- /* User Datagram Protocol */
+ /* Time-to-Live */
+ IPHeader->Ttl = AddrFile->TTL;
+ /* Protocol */
IPHeader->Protocol = Protocol;
/* Checksum is 0 (for later calculation of this) */
IPHeader->Checksum = 0;
@@ -82,6 +83,7 @@
NTSTATUS BuildRawIpPacket(
+ PADDRESS_FILE AddrFile,
PIP_PACKET Packet,
PIP_ADDRESS RemoteAddress,
USHORT RemotePort,
@@ -124,9 +126,9 @@
switch (RemoteAddress->Type) {
case IP_ADDRESS_V4:
Status = AddGenericHeaderIPv4
- (RemoteAddress, RemotePort,
+ (AddrFile, RemoteAddress, RemotePort,
LocalAddress, LocalPort, Packet, DataLen,
- IPPROTO_RAW,
+ AddrFile->Protocol,
0, (PVOID *)&Payload );
break;
case IP_ADDRESS_V6:
@@ -225,7 +227,8 @@
LocalAddress = NCE->Interface->Unicast;
}
- Status = BuildRawIpPacket( &Packet,
+ Status = BuildRawIpPacket( AddrFile,
+ &Packet,
&RemoteAddress,
RemotePort,
&LocalAddress,
Modified: trunk/reactos/lib/drivers/ip/transport/udp/udp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/u…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] Mon Oct 26 04:11:44
2009
@@ -14,6 +14,7 @@
PORT_SET UDPPorts;
NTSTATUS AddUDPHeaderIPv4(
+ PADDRESS_FILE AddrFile,
PIP_ADDRESS RemoteAddress,
USHORT RemotePort,
PIP_ADDRESS LocalAddress,
@@ -39,7 +40,7 @@
IPPacket, IPPacket->NdisPacket));
Status = AddGenericHeaderIPv4
- ( RemoteAddress, RemotePort,
+ ( AddrFile, RemoteAddress, RemotePort,
LocalAddress, LocalPort,
IPPacket, DataLength, IPPROTO_UDP,
sizeof(UDP_HEADER), (PVOID *)&UDPHeader );
@@ -75,6 +76,7 @@
NTSTATUS BuildUDPPacket(
+ PADDRESS_FILE AddrFile,
PIP_PACKET Packet,
PIP_ADDRESS RemoteAddress,
USHORT RemotePort,
@@ -115,7 +117,7 @@
switch (RemoteAddress->Type) {
case IP_ADDRESS_V4:
- Status = AddUDPHeaderIPv4(RemoteAddress, RemotePort,
+ Status = AddUDPHeaderIPv4(AddrFile, RemoteAddress, RemotePort,
LocalAddress, LocalPort, Packet, DataBuffer, DataLen);
break;
case IP_ADDRESS_V6:
@@ -201,7 +203,8 @@
LocalAddress = NCE->Interface->Unicast;
}
- Status = BuildUDPPacket( &Packet,
+ Status = BuildUDPPacket( AddrFile,
+ &Packet,
&RemoteAddress,
RemotePort,
&LocalAddress,