2004-11-16 Casper S. Hornstrup <chorns@users.sourceforge.net>

* drivers/lib/ip/network/arp.c: Assert certain conditions.
	* drivers/lib/ip/network/loopback.c: Ditto.
	* drivers/lib/ip/network/neighbor.c: Ditto.
	* drivers/lib/ip/transport/tcp/tcp.c: Ditto.
	* drivers/net/tcpip/datalink/lan.c: Ditto.
	* drivers/net/tcpip/datalink/loopback.c: Ditto.
	* drivers/net/tcpip/include/debug.h (ASSERT_KM_POINTER): Define.
	* drivers/lib/ip/transport/tcp/if.c: Remove disabled code.
	* drivers/net/afd/afd/main.c (AfdDispatch): Print known unimplemented
	IOCTLs.
	* drivers/net/tcpip/include/precomp.h: Include roscfg.h.
	* drivers/net/tcpip/tcpip/dispatch.c (DispTdiListen): Pass the right
	connection object to TCPListen.
	* drivers/net/tcpip/tcpip/mocklock.c: Fix some assertions.

svn path=/trunk/; revision=11680
This commit is contained in:
Casper Hornstrup 2004-11-16 18:07:58 +00:00
parent 845737a0c6
commit 59f81f9539
13 changed files with 115 additions and 32 deletions

View file

@ -1,3 +1,20 @@
2004-11-16 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/lib/ip/network/arp.c: Assert certain conditions.
* drivers/lib/ip/network/loopback.c: Ditto.
* drivers/lib/ip/network/neighbor.c: Ditto.
* drivers/lib/ip/transport/tcp/tcp.c: Ditto.
* drivers/net/tcpip/datalink/lan.c: Ditto.
* drivers/net/tcpip/datalink/loopback.c: Ditto.
* drivers/net/tcpip/include/debug.h (ASSERT_KM_POINTER): Define.
* drivers/lib/ip/transport/tcp/if.c: Remove disabled code.
* drivers/net/afd/afd/main.c (AfdDispatch): Print known unimplemented
IOCTLs.
* drivers/net/tcpip/include/precomp.h: Include roscfg.h.
* drivers/net/tcpip/tcpip/dispatch.c (DispTdiListen): Pass the right
connection object to TCPListen.
* drivers/net/tcpip/tcpip/mocklock.c: Fix some assertions.
2004-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* apps/utils/net/roshttpd/include/list.h (CList<Item>::Get): Declare i

View file

@ -46,7 +46,7 @@ PNDIS_PACKET PrepareARPPacket(
/* Prepare ARP packet */
Size = MaxLLHeaderSize +
sizeof(ARP_HEADER) +
sizeof(ARP_HEADER) +
2 * LinkAddressLength + /* Hardware address length */
2 * ProtoAddressLength; /* Protocol address length */
Size = MAX(Size, MinLLFrameSize);
@ -55,6 +55,7 @@ PNDIS_PACKET PrepareARPPacket(
if( !NT_SUCCESS(NdisStatus) ) return NULL;
GetDataPtr( NdisPacket, 0, (PCHAR *)&DataBuffer, (PUINT)&Contig );
ASSERT(DataBuffer);
RtlZeroMemory(DataBuffer, Size);
Header = (PARP_HEADER)((ULONG_PTR)DataBuffer + MaxLLHeaderSize);
@ -155,6 +156,8 @@ BOOLEAN ARPTransmit(
&Address->Address, /* Target's (remote) protocol address */
ARP_OPCODE_REQUEST); /* ARP request */
ASSERT_KM_POINTER(NdisPacket);
ASSERT_KM_POINTER(PC(NdisPacket));
PC(NdisPacket)->DLComplete = ARPTransmitComplete;
TI_DbgPrint(DEBUG_ARP,("Sending ARP Packet\n"));

View file

@ -30,6 +30,10 @@ VOID LoopTransmit(
{
IP_PACKET IPPacket;
ASSERT_KM_POINTER(NdisPacket);
ASSERT_KM_POINTER(PC(NdisPacket));
ASSERT_KM_POINTER(PC(NdisPacket)->DLComplete);
TI_DbgPrint(MAX_TRACE, ("Called (NdisPacket = %x)\n", NdisPacket));
IPPacket.NdisPacket = NdisPacket;

View file

@ -17,6 +17,8 @@ VOID NBCompleteSend( PVOID Context,
NDIS_STATUS Status ) {
PNEIGHBOR_PACKET Packet = (PNEIGHBOR_PACKET)Context;
TI_DbgPrint(MID_TRACE, ("Called\n"));
ASSERT_KM_POINTER(Packet);
ASSERT_KM_POINTER(Packet->Complete);
Packet->Complete( Packet->Context, Packet->Packet, STATUS_SUCCESS );
TI_DbgPrint(MID_TRACE, ("Completed\n"));
PoolFreeBuffer( Packet );
@ -59,16 +61,21 @@ VOID NBFlushPacketQueue( PNEIGHBOR_CACHE_ENTRY NCE,
PacketEntry = RemoveHeadList( &NCE->PacketQueue );
Packet = CONTAINING_RECORD
( PacketEntry, NEIGHBOR_PACKET, Next );
ASSERT_KM_POINTER(Packet);
TI_DbgPrint
(MID_TRACE,
("PacketEntry: %x, NdisPacket %x\n",
PacketEntry, Packet->Packet));
if( CallComplete )
if( CallComplete )
{
ASSERT_KM_POINTER(Packet->Complete);
Packet->Complete( Packet->Context,
Packet->Packet,
NDIS_STATUS_REQUEST_ABORTED );
}
PoolFreeBuffer( Packet );
}

View file

@ -17,13 +17,6 @@
#include "precomp.h"
#if 0
#include <sys/param.h>
#include <sys/kernel.h>
#include <oskit/c/assert.h>
#include <net/if.h>
#endif
int if_index = 0;
struct ifaddr **ifnet_addrs;

View file

@ -43,6 +43,7 @@ PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) {
}
VOID TCPFreeConnectionEndpoint( PCONNECTION_ENDPOINT Connection ) {
TI_DbgPrint(MAX_TRACE,("FIXME: Cancel all pending requests\n"));
/* XXX Cancel all pending requests */
ExFreePool( Connection );
}
@ -61,6 +62,12 @@ NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection,
Family,
Type,
Proto ) );
ASSERT_KM_POINTER(Connection->SocketContext);
TI_DbgPrint(MID_TRACE,("Connection->SocketContext %x\n",
Connection->SocketContext));
TcpipRecursiveMutexLeave( &TCPLock );
return Status;
@ -319,12 +326,22 @@ NTSTATUS TCPListen
PVOID Context) {
NTSTATUS Status;
TI_DbgPrint(MID_TRACE,("TCPListen started\n"));
TI_DbgPrint(MID_TRACE,("Connection->SocketContext %x\n",
Connection->SocketContext));
ASSERT(Connection);
ASSERT_KM_POINTER(Connection->SocketContext);
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext,
Backlog ) );
TcpipRecursiveMutexLeave( &TCPLock );
TI_DbgPrint(MID_TRACE,("TCPListen finished %x\n", Status));
return Status;
}
@ -332,7 +349,12 @@ NTSTATUS TCPListen
NTSTATUS TCPAccept
( PTDI_REQUEST Request,
VOID **NewSocketContext ) {
return STATUS_UNSUCCESSFUL;
NTSTATUS Status;
TI_DbgPrint(MID_TRACE,("TCPAccept started\n"));
Status = STATUS_UNSUCCESSFUL;
TI_DbgPrint(MID_TRACE,("TCPAccept finished %x\n", Status));
return Status;
}
NTSTATUS TCPReceiveData
@ -350,6 +372,8 @@ NTSTATUS TCPReceiveData
TI_DbgPrint(MID_TRACE,("Called for %d bytes\n", ReceiveLength));
ASSERT_KM_POINTER(Connection->SocketContext);
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
NdisQueryBuffer( Buffer, &DataBuffer, &DataLen );
@ -403,6 +427,8 @@ NTSTATUS TCPSendData
ULONG Flags) {
NTSTATUS Status;
ASSERT_KM_POINTER(Connection->SocketContext);
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
TI_DbgPrint(MID_TRACE,("Connection = %x\n", Connection));

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.10 2004/11/14 19:45:16 arty Exp $
/* $Id: main.c,v 1.11 2004/11/16 18:07:57 chorns Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: drivers/net/afd/afd/main.c
@ -296,6 +296,46 @@ AfdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
case IOCTL_AFD_SET_CONTEXT:
return AfdSetContext( DeviceObject, Irp, IrpSp );
case IOCTL_AFD_WAIT_FOR_LISTEN:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_WAIT_FOR_LISTEN\n"));
case IOCTL_AFD_ACCEPT:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_ACCEPT\n"));
case IOCTL_AFD_DISCONNECT:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_DISCONNECT\n"));
case IOCTL_AFD_GET_TDI_HANDLES:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_TDI_HANDLES\n"));
case IOCTL_AFD_SET_INFO:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_INFO\n"));
case IOCTL_AFD_SET_CONNECT_DATA:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_DATA\n"));
case IOCTL_AFD_SET_CONNECT_OPTIONS:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_OPTIONS\n"));
case IOCTL_AFD_SET_DISCONNECT_DATA:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_DATA\n"));
case IOCTL_AFD_SET_DISCONNECT_OPTIONS:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_OPTIONS\n"));
case IOCTL_AFD_GET_CONNECT_DATA:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_CONNECT_DATA\n"));
case IOCTL_AFD_GET_CONNECT_OPTIONS:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_CONNECT_OPTIONS\n"));
case IOCTL_AFD_GET_DISCONNECT_DATA:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_DISCONNECT_DATA\n"));
case IOCTL_AFD_GET_DISCONNECT_OPTIONS:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_DISCONNECT_OPTIONS\n"));
case IOCTL_AFD_SET_CONNECT_DATA_SIZE:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_DATA_SIZE\n"));
case IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_CONNECT_OPTIONS_SIZE\n"));
case IOCTL_AFD_SET_DISCONNECT_DATA_SIZE:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_DATA_SIZE\n"));
case IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_SET_DISCONNECT_OPTIONS_SIZE\n"));
case IOCTL_AFD_EVENT_SELECT:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_EVENT_SELECT\n"));
case IOCTL_AFD_DEFER_ACCEPT:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_DEFER_ACCEPT\n"));
case IOCTL_AFD_GET_PENDING_CONNECT_DATA:
AFD_DbgPrint(MIN_TRACE, ("IOCTL_AFD_GET_PENDING_CONNECT_DATA\n"));
default:
Status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Information = 0;

View file

@ -181,6 +181,9 @@ VOID STDCALL ProtocolSendComplete(
*/
{
TI_DbgPrint(DEBUG_DATALINK, ("Calling completion routine\n"));
ASSERT_KM_POINTER(Packet);
ASSERT_KM_POINTER(PC(Packet));
ASSERT_KM_POINTER(PC(Packet)->DLComplete);
(*PC(Packet)->DLComplete)( PC(Packet)->Context, Packet, Status);
TI_DbgPrint(DEBUG_DATALINK, ("Finished\n"));
}

View file

@ -34,6 +34,9 @@ VOID LoopTransmit(
IPReceive(Context, &IPPacket);
TI_DbgPrint(MAX_TRACE, ("Finished receive\n"));
ASSERT_KM_POINTER(Packet);
ASSERT_KM_POINTER(PC(Packet));
ASSERT_KM_POINTER(PC(Packet)->DLComplete);
PC(NdisPacket)->DLComplete(Context, NdisPacket, NDIS_STATUS_SUCCESS);
TI_DbgPrint(MAX_TRACE, ("Done\n"));
}

View file

@ -57,29 +57,12 @@ extern DWORD DebugTraceLevel;
#endif /* _MSC_VER */
#if 0
#ifdef ASSERT
#undef ASSERT
#endif
#ifdef NASSERT
#define ASSERT(x)
#else /* NASSERT */
#define ASSERT(x) if (!(x)) { TI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
#endif /* NASSERT */
#endif
#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
#else /* DBG */
#define TI_DbgPrint(_t_, _x_)
#if 0
#define ASSERT_IRQL(x)
#define ASSERT(x)
#endif
#endif /* DBG */
@ -109,6 +92,10 @@ extern DWORD DebugTraceLevel;
#include <memtrack.h>
#define ASSERT_KM_POINTER(_x) \
ASSERT(((PVOID)_x) != (PVOID)0xcccccccc); \
ASSERT(((PVOID)_x) >= (PVOID)0x80000000);
#endif /* __DEBUG_H */
/* EOF */

View file

@ -1,3 +1,4 @@
#include <roscfg.h>
#include <limits.h>
#include <ddk/ntddk.h>
#include <rosrtl/string.h>

View file

@ -496,7 +496,6 @@ NTSTATUS DispTdiListen(
PTDI_REQUEST_KERNEL Parameters;
PTRANSPORT_CONTEXT TranContext;
PIO_STACK_LOCATION IrpSp;
PTDI_REQUEST Request;
NTSTATUS Status;
TI_DbgPrint(DEBUG_IRP, ("Called.\n"));
@ -521,7 +520,7 @@ NTSTATUS DispTdiListen(
Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
Status = TCPListen( Request->Handle.ConnectionContext, 1024 /* BACKLOG */,
Status = TCPListen( Connection, 1024 /* BACKLOG */,
DispDataRequestComplete,
Irp );

View file

@ -21,7 +21,7 @@ VOID TcpipAcquireSpinLock( PKSPIN_LOCK SpinLock, PKIRQL Irql ) {
}
VOID TcpipAcquireSpinLockAtDpcLevel( PKSPIN_LOCK SpinLock ) {
ASSERT(KernelIrql == DPC_LEVEL);
ASSERT(KernelIrql == DISPATCH_LEVEL);
}
VOID TcpipReleaseSpinLock( PKSPIN_LOCK SpinLock, KIRQL Irql ) {
@ -30,7 +30,7 @@ VOID TcpipReleaseSpinLock( PKSPIN_LOCK SpinLock, KIRQL Irql ) {
}
VOID TcpipReleaseSpinLockFromDpcLevel( PKSPIN_LOCK SpinLock ) {
ASSERT(KernelIrql == DPC_LEVEL);
ASSERT(KernelIrql == DISPATCH_LEVEL);
}
VOID TcpipInterlockedInsertTailList( PLIST_ENTRY ListHead,