Commit in reactos on MAIN
ChangeLog+171.272 -> 1.273
drivers/lib/ip/network/arp.c+4-11.3 -> 1.4
                      /loopback.c+41.3 -> 1.4
                      /neighbor.c+8-11.3 -> 1.4
drivers/lib/ip/transport/tcp/tcp.c+27-11.8 -> 1.9
                            /if.c-71.2 -> 1.3
drivers/net/tcpip/datalink/lan.c+31.25 -> 1.26
                          /loopback.c+31.11 -> 1.12
drivers/net/tcpip/include/debug.h+4-171.10 -> 1.11
                         /precomp.h+11.7 -> 1.8
drivers/net/afd/afd/main.c+41-11.10 -> 1.11
drivers/net/tcpip/tcpip/dispatch.c+1-21.24 -> 1.25
                       /mocklock.c+2-21.1 -> 1.2
+115-32
13 modified files
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.

reactos
ChangeLog 1.272 -> 1.273
diff -u -r1.272 -r1.273
--- ChangeLog	13 Nov 2004 17:20:28 -0000	1.272
+++ ChangeLog	16 Nov 2004 18:07:51 -0000	1.273
@@ -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

reactos/drivers/lib/ip/network
arp.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- arp.c	9 Nov 2004 09:39:37 -0000	1.3
+++ arp.c	16 Nov 2004 18:07:56 -0000	1.4
@@ -46,7 +46,7 @@
 
     /* 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 @@
     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 @@
         &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"));

reactos/drivers/lib/ip/network
loopback.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- loopback.c	7 Nov 2004 20:37:20 -0000	1.3
+++ loopback.c	16 Nov 2004 18:07:56 -0000	1.4
@@ -30,6 +30,10 @@
 {
   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;

reactos/drivers/lib/ip/network
neighbor.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- neighbor.c	7 Nov 2004 20:37:20 -0000	1.3
+++ neighbor.c	16 Nov 2004 18:07:56 -0000	1.4
@@ -17,6 +17,8 @@
 		     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 @@
 	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 );
     }

reactos/drivers/lib/ip/transport/tcp
tcp.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- tcp.c	13 Nov 2004 00:06:33 -0000	1.8
+++ tcp.c	16 Nov 2004 18:07:57 -0000	1.9
@@ -43,6 +43,7 @@
 }
 
 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 @@
 						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 @@
   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 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 @@
 
     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 @@
   ULONG Flags) {
     NTSTATUS Status;
 
+    ASSERT_KM_POINTER(Connection->SocketContext);
+
     TcpipRecursiveMutexEnter( &TCPLock, TRUE );
 
     TI_DbgPrint(MID_TRACE,("Connection = %x\n", Connection));

reactos/drivers/lib/ip/transport/tcp
if.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- if.c	7 Nov 2004 20:37:21 -0000	1.2
+++ if.c	16 Nov 2004 18:07:57 -0000	1.3
@@ -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;
 

reactos/drivers/net/tcpip/datalink
lan.c 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- lan.c	14 Nov 2004 10:13:17 -0000	1.25
+++ lan.c	16 Nov 2004 18:07:57 -0000	1.26
@@ -181,6 +181,9 @@
  */
 {
     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"));
 }

reactos/drivers/net/tcpip/datalink
loopback.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- loopback.c	7 Nov 2004 20:37:19 -0000	1.11
+++ loopback.c	16 Nov 2004 18:07:57 -0000	1.12
@@ -34,6 +34,9 @@
   
   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"));
 }

reactos/drivers/net/tcpip/include
debug.h 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- debug.h	19 Aug 2004 21:38:58 -0000	1.10
+++ debug.h	16 Nov 2004 18:07:57 -0000	1.11
@@ -57,29 +57,12 @@
 
 #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 @@
 
 #include <memtrack.h>
 
+#define ASSERT_KM_POINTER(_x) \
+   ASSERT(((PVOID)_x) != (PVOID)0xcccccccc); \
+   ASSERT(((PVOID)_x) >= (PVOID)0x80000000);
+
 #endif /* __DEBUG_H */
 
 /* EOF */

reactos/drivers/net/tcpip/include
precomp.h 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- precomp.h	14 Nov 2004 19:45:16 -0000	1.7
+++ precomp.h	16 Nov 2004 18:07:57 -0000	1.8
@@ -1,3 +1,4 @@
+#include <roscfg.h>
 #include <limits.h>
 #include <ddk/ntddk.h>
 #include <rosrtl/string.h>

reactos/drivers/net/afd/afd
main.c 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- main.c	14 Nov 2004 19:45:16 -0000	1.10
+++ main.c	16 Nov 2004 18:07:57 -0000	1.11
@@ -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 @@
 	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;

reactos/drivers/net/tcpip/tcpip
dispatch.c 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- dispatch.c	15 Nov 2004 18:24:57 -0000	1.24
+++ dispatch.c	16 Nov 2004 18:07:58 -0000	1.25
@@ -496,7 +496,6 @@
   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 @@
 
   Parameters = (PTDI_REQUEST_KERNEL)&IrpSp->Parameters;
 
-  Status = TCPListen( Request->Handle.ConnectionContext, 1024 /* BACKLOG */,
+  Status = TCPListen( Connection, 1024 /* BACKLOG */,
 		      DispDataRequestComplete,
 		      Irp );
 

reactos/drivers/net/tcpip/tcpip
mocklock.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- mocklock.c	7 Nov 2004 20:37:19 -0000	1.1
+++ mocklock.c	16 Nov 2004 18:07:58 -0000	1.2
@@ -21,7 +21,7 @@
 }
 
 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 TcpipReleaseSpinLockFromDpcLevel( PKSPIN_LOCK SpinLock ) {
-    ASSERT(KernelIrql == DPC_LEVEL);
+    ASSERT(KernelIrql == DISPATCH_LEVEL);
 }
 
 VOID TcpipInterlockedInsertTailList( PLIST_ENTRY ListHead,
CVSspam 0.2.8