From 4837e387d00af7b13326ef33da95e2117e1cbc77 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 7 Jul 2009 05:29:37 +0000 Subject: [PATCH] - Recommit r41782 now that DHCP is ready for the fix - Start the indexes at 0 (Software loopback will take index 0) svn path=/trunk/; revision=41797 --- reactos/drivers/network/tcpip/tcpip/main.c | 91 +++++++++++----------- reactos/lib/drivers/ip/network/ip.c | 2 +- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/reactos/drivers/network/tcpip/tcpip/main.c b/reactos/drivers/network/tcpip/tcpip/main.c index fae68ad89f3..e92bcd9351e 100644 --- a/reactos/drivers/network/tcpip/tcpip/main.c +++ b/reactos/drivers/network/tcpip/tcpip/main.c @@ -885,6 +885,51 @@ DriverEntry( return Status; } + /* Use direct I/O */ + IPDeviceObject->Flags |= DO_DIRECT_IO; + RawIPDeviceObject->Flags |= DO_DIRECT_IO; + UDPDeviceObject->Flags |= DO_DIRECT_IO; + TCPDeviceObject->Flags |= DO_DIRECT_IO; + + /* Initialize the driver object with this driver's entry points */ + DriverObject->MajorFunction[IRP_MJ_CREATE] = TiDispatchOpenClose; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = TiDispatchOpenClose; + DriverObject->MajorFunction[IRP_MJ_CLEANUP] = TiDispatchOpenClose; + DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = TiDispatchInternal; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = TiDispatch; + + DriverObject->DriverUnload = TiUnload; + + /* Initialize our periodic timer and its associated DPC object. When the + timer expires, the IPTimeout deferred procedure call (DPC) is queued */ + ExInitializeWorkItem( &IpWorkItem, IPTimeout, NULL ); + KeInitializeDpc(&IPTimeoutDpc, IPTimeoutDpcFn, NULL); + KeInitializeTimer(&IPTimer); + + /* Start the periodic timer with an initial and periodic + relative expiration time of IP_TIMEOUT milliseconds */ + DueTime.QuadPart = -(LONGLONG)IP_TIMEOUT * 10000; + KeSetTimerEx(&IPTimer, DueTime, IP_TIMEOUT, &IPTimeoutDpc); + + /* Open loopback adapter */ + Status = LoopRegisterAdapter(NULL, NULL); + if (!NT_SUCCESS(Status)) { + TI_DbgPrint(MIN_TRACE, ("Failed to create loopback adapter. Status (0x%X).\n", Status)); + TCPShutdown(); + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); + ChewShutdown(); + IoDeleteDevice(IPDeviceObject); + IoDeleteDevice(RawIPDeviceObject); + IoDeleteDevice(UDPDeviceObject); + IoDeleteDevice(TCPDeviceObject); + exFreePool(EntityList); + NdisFreePacketPool(GlobalPacketPool); + NdisFreeBufferPool(GlobalBufferPool); + return Status; + } + /* Register protocol with NDIS */ /* This used to be IP_DEVICE_NAME but the DDK says it has to match your entry in the SCM */ Status = LANRegisterProtocol(&strNdisDeviceName); @@ -913,52 +958,6 @@ DriverEntry( return Status; } - /* Open loopback adapter */ - Status = LoopRegisterAdapter(NULL, NULL); - if (!NT_SUCCESS(Status)) { - TI_DbgPrint(MIN_TRACE, ("Failed to create loopback adapter. Status (0x%X).\n", Status)); - TCPShutdown(); - UDPShutdown(); - RawIPShutdown(); - IPShutdown(); - ChewShutdown(); - IoDeleteDevice(IPDeviceObject); - IoDeleteDevice(RawIPDeviceObject); - IoDeleteDevice(UDPDeviceObject); - IoDeleteDevice(TCPDeviceObject); - exFreePool(EntityList); - NdisFreePacketPool(GlobalPacketPool); - NdisFreeBufferPool(GlobalBufferPool); - LANUnregisterProtocol(); - return Status; - } - - /* Use direct I/O */ - IPDeviceObject->Flags |= DO_DIRECT_IO; - RawIPDeviceObject->Flags |= DO_DIRECT_IO; - UDPDeviceObject->Flags |= DO_DIRECT_IO; - TCPDeviceObject->Flags |= DO_DIRECT_IO; - - /* Initialize the driver object with this driver's entry points */ - DriverObject->MajorFunction[IRP_MJ_CREATE] = TiDispatchOpenClose; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = TiDispatchOpenClose; - DriverObject->MajorFunction[IRP_MJ_CLEANUP] = TiDispatchOpenClose; - DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = TiDispatchInternal; - DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = TiDispatch; - - DriverObject->DriverUnload = TiUnload; - - /* Initialize our periodic timer and its associated DPC object. When the - timer expires, the IPTimeout deferred procedure call (DPC) is queued */ - ExInitializeWorkItem( &IpWorkItem, IPTimeout, NULL ); - KeInitializeDpc(&IPTimeoutDpc, IPTimeoutDpcFn, NULL); - KeInitializeTimer(&IPTimer); - - /* Start the periodic timer with an initial and periodic - relative expiration time of IP_TIMEOUT milliseconds */ - DueTime.QuadPart = -(LONGLONG)IP_TIMEOUT * 10000; - KeSetTimerEx(&IPTimer, DueTime, IP_TIMEOUT, &IPTimeoutDpc); - return STATUS_SUCCESS; } diff --git a/reactos/lib/drivers/ip/network/ip.c b/reactos/lib/drivers/ip/network/ip.c index ae930975bb5..2046e35be77 100644 --- a/reactos/lib/drivers/ip/network/ip.c +++ b/reactos/lib/drivers/ip/network/ip.c @@ -242,7 +242,7 @@ BOOLEAN IPRegisterInterface( */ { KIRQL OldIrql; - UINT ChosenIndex = 1; + UINT ChosenIndex = 0; BOOLEAN IndexHasBeenChosen; IF_LIST_ITER(Interface);