mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
msafd + afd: Changed type of PVOID args to PAFD_WSABUF, avoiding some casts.
Added some tracing. Converted afd.sys to use METHOD_NEITHER in the correct places. oskittcp: Added some tracking in tcp_input and tcp_output to help look for the ack bug. tcpip: some cleaning. Realized that an NTE was getting sent to IPReceive as the Context parameter, but was later treated as IP_INTERFACE. Changed prototypes to keep this from happening again. svn path=/trunk/; revision=10207
This commit is contained in:
parent
430efd137f
commit
6ac4bce416
14 changed files with 88 additions and 108 deletions
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
# $Id: makefile,v 1.1 2004/05/29 00:15:44 sedwards Exp $
|
# $Id: makefile,v 1.2 2004/07/18 22:03:48 arty Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@ TARGET_TYPE = library
|
||||||
|
|
||||||
TARGET_NAME = oskittcp
|
TARGET_NAME = oskittcp
|
||||||
|
|
||||||
TARGET_CFLAGS = -g -D__REACTOS__=1 -DKERNEL -Iinclude/freebsd -Iinclude/freebsd/sys/include -Iinclude/freebsd/src/sys -Iinclude/freebsd/dev/include -Iinclude/freebsd/net/include -Iinclude -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include -DMEMTRACK
|
#-DMEMTRACK
|
||||||
|
TARGET_CFLAGS = -g -D__REACTOS__=1 -DKERNEL -Iinclude/freebsd -Iinclude/freebsd/sys/include -Iinclude/freebsd/src/sys -Iinclude/freebsd/dev/include -Iinclude/freebsd/net/include -Iinclude -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include
|
||||||
|
|
||||||
# require os code to explicitly request A/W version of structs/functions
|
# require os code to explicitly request A/W version of structs/functions
|
||||||
TARGET_CFLAGS += -D_DISABLE_TIDENTS
|
TARGET_CFLAGS += -D_DISABLE_TIDENTS
|
||||||
|
|
|
@ -195,9 +195,9 @@ present:
|
||||||
if (ti == (struct tcpiphdr *)tp || ti->ti_seq != tp->rcv_nxt)
|
if (ti == (struct tcpiphdr *)tp || ti->ti_seq != tp->rcv_nxt)
|
||||||
return (0);
|
return (0);
|
||||||
do {
|
do {
|
||||||
tp->rcv_nxt += ti->ti_len;
|
tp->rcv_nxt += ti->ti_len - sizeof( struct ip );
|
||||||
OS_DbgPrint(OSK_MID_TRACE,("Added %d to rcv_nxt\n",
|
OS_DbgPrint(OSK_MID_TRACE,("Added %d to rcv_nxt (result %d)\n",
|
||||||
ti->ti_len));
|
ti->ti_len - sizeof(struct ip), tp->rcv_nxt));
|
||||||
flags = ti->ti_flags & TH_FIN;
|
flags = ti->ti_flags & TH_FIN;
|
||||||
remque(ti);
|
remque(ti);
|
||||||
m = REASS_MBUF(ti);
|
m = REASS_MBUF(ti);
|
||||||
|
@ -598,7 +598,8 @@ findpcb:
|
||||||
* we have enough buffer space to take it.
|
* we have enough buffer space to take it.
|
||||||
*/
|
*/
|
||||||
++tcpstat.tcps_preddat;
|
++tcpstat.tcps_preddat;
|
||||||
tp->rcv_nxt += ti->ti_len;
|
tp->rcv_nxt += ti->ti_len - sizeof(struct ip);
|
||||||
|
OS_DbgPrint(OSK_MID_TRACE,("Added %d to rcv_nxt\n", ti->ti_len - sizeof(struct ip)));
|
||||||
tcpstat.tcps_rcvpack++;
|
tcpstat.tcps_rcvpack++;
|
||||||
tcpstat.tcps_rcvbyte += ti->ti_len;
|
tcpstat.tcps_rcvbyte += ti->ti_len;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -570,6 +570,7 @@ send:
|
||||||
ti->ti_seq = htonl(tp->snd_max);
|
ti->ti_seq = htonl(tp->snd_max);
|
||||||
|
|
||||||
ti->ti_ack = htonl(tp->rcv_nxt);
|
ti->ti_ack = htonl(tp->rcv_nxt);
|
||||||
|
printf("ti->ti_ack = %d\n", ti->ti_ack);
|
||||||
|
|
||||||
if (optlen) {
|
if (optlen) {
|
||||||
(void)memcpy(ti + 1, opt, optlen);
|
(void)memcpy(ti + 1, opt, optlen);
|
||||||
|
|
|
@ -148,12 +148,12 @@ typedef struct _LLIP_BIND_INFO {
|
||||||
/* Information about an IP interface */
|
/* Information about an IP interface */
|
||||||
typedef struct _IP_INTERFACE {
|
typedef struct _IP_INTERFACE {
|
||||||
DEFINE_TAG
|
DEFINE_TAG
|
||||||
|
LIST_ENTRY NTEListHead; /* List of NTEs on this interface */
|
||||||
|
LIST_ENTRY ADEListHead; /* List of ADEs on this interface */
|
||||||
LIST_ENTRY ListEntry; /* Entry on list */
|
LIST_ENTRY ListEntry; /* Entry on list */
|
||||||
ULONG RefCount; /* Reference count */
|
ULONG RefCount; /* Reference count */
|
||||||
OBJECT_FREE_ROUTINE Free; /* Routine used to free resources used by the object */
|
OBJECT_FREE_ROUTINE Free; /* Routine used to free resources used by the object */
|
||||||
KSPIN_LOCK Lock; /* Spin lock for this object */
|
KSPIN_LOCK Lock; /* Spin lock for this object */
|
||||||
LIST_ENTRY NTEListHead; /* List of NTEs on this interface */
|
|
||||||
LIST_ENTRY ADEListHead; /* List of ADEs on this interface */
|
|
||||||
PVOID Context; /* Pointer to link layer context information */
|
PVOID Context; /* Pointer to link layer context information */
|
||||||
UINT HeaderSize; /* Size of link level header */
|
UINT HeaderSize; /* Size of link level header */
|
||||||
UINT MinFrameSize; /* Minimum frame size in bytes */
|
UINT MinFrameSize; /* Minimum frame size in bytes */
|
||||||
|
@ -239,7 +239,7 @@ VOID STDCALL IPTimeout(
|
||||||
PVOID SystemArgument2);
|
PVOID SystemArgument2);
|
||||||
|
|
||||||
VOID IPDispatchProtocol(
|
VOID IPDispatchProtocol(
|
||||||
PNET_TABLE_ENTRY NTE,
|
PIP_INTERFACE IF,
|
||||||
PIP_PACKET IPPacket);
|
PIP_PACKET IPPacket);
|
||||||
|
|
||||||
VOID IPRegisterProtocol(
|
VOID IPRegisterProtocol(
|
||||||
|
|
|
@ -69,6 +69,11 @@ static inline VOID ExFreePoolX( PVOID Data, PCHAR File, ULONG Line ) {
|
||||||
#define TrackDump()
|
#define TrackDump()
|
||||||
#define Untrack(x)
|
#define Untrack(x)
|
||||||
#define TrackTag(x)
|
#define TrackTag(x)
|
||||||
|
#define exAllocatePoolWithTag(x,y,z) ExAllocatePoolWithTag(x,y,z)
|
||||||
|
#define exAllocatePool(x,y) ExAllocatePool(x,y)
|
||||||
|
#define exFreePool(x) ExFreePool(x)
|
||||||
|
#define TrackWithTag(w,x,y,z)
|
||||||
|
#define UntrackFL(x,y,z)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif/*MEMMTRAC_H*/
|
#endif/*MEMMTRAC_H*/
|
||||||
|
|
|
@ -56,7 +56,7 @@ VOID IPDatagramReassemblyTimeout(
|
||||||
VOID);
|
VOID);
|
||||||
|
|
||||||
VOID IPReceive(
|
VOID IPReceive(
|
||||||
PVOID Context,
|
PIP_INTERFACE IF,
|
||||||
PIP_PACKET IPPacket);
|
PIP_PACKET IPPacket);
|
||||||
|
|
||||||
#endif /* __RECEIVE_H */
|
#endif /* __RECEIVE_H */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.17 2004/06/09 18:11:37 arty Exp $
|
# $Id: makefile,v 1.18 2004/07/18 22:03:49 arty Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@ TARGET_TYPE = export_driver
|
||||||
|
|
||||||
TARGET_NAME = tcpip
|
TARGET_NAME = tcpip
|
||||||
|
|
||||||
|
# -DMEMTRACK
|
||||||
TARGET_CFLAGS = \
|
TARGET_CFLAGS = \
|
||||||
-D__USE_W32API \
|
-D__USE_W32API \
|
||||||
-DNDIS40 \
|
-DNDIS40 \
|
||||||
-DMEMTRACK \
|
|
||||||
-I./include \
|
-I./include \
|
||||||
-I$(PATH_TO_TOP)/drivers/lib/oskittcp/include \
|
-I$(PATH_TO_TOP)/drivers/lib/oskittcp/include \
|
||||||
-I$(PATH_TO_TOP)/w32api/include \
|
-I$(PATH_TO_TOP)/w32api/include \
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <route.h>
|
#include <route.h>
|
||||||
#include <icmp.h>
|
#include <icmp.h>
|
||||||
#include <pool.h>
|
#include <pool.h>
|
||||||
|
#include <tilists.h>
|
||||||
|
|
||||||
KTIMER IPTimer;
|
KTIMER IPTimer;
|
||||||
KDPC IPTimeoutDpc;
|
KDPC IPTimeoutDpc;
|
||||||
|
@ -534,10 +534,8 @@ PADDRESS_ENTRY IPLocateADE(
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PLIST_ENTRY CurrentIFEntry;
|
IF_LIST_ITER(CurrentIF);
|
||||||
PLIST_ENTRY CurrentADEEntry;
|
ADE_LIST_ITER(CurrentADE);
|
||||||
PIP_INTERFACE CurrentIF;
|
|
||||||
PADDRESS_ENTRY CurrentADE;
|
|
||||||
|
|
||||||
// TI_DbgPrint(DEBUG_IP, ("Called. Address (0x%X) AddressType (0x%X).\n",
|
// TI_DbgPrint(DEBUG_IP, ("Called. Address (0x%X) AddressType (0x%X).\n",
|
||||||
// Address, AddressType));
|
// Address, AddressType));
|
||||||
|
@ -547,24 +545,17 @@ PADDRESS_ENTRY IPLocateADE(
|
||||||
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
|
|
||||||
/* Search the interface list */
|
/* Search the interface list */
|
||||||
CurrentIFEntry = InterfaceListHead.Flink;
|
ForEachInterface(CurrentIF) {
|
||||||
while (CurrentIFEntry != &InterfaceListHead) {
|
|
||||||
CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
|
|
||||||
|
|
||||||
/* Search the address entry list and return the ADE if found */
|
/* Search the address entry list and return the ADE if found */
|
||||||
CurrentADEEntry = CurrentIF->ADEListHead.Flink;
|
ForEachADE(CurrentIF->ADEListHead,CurrentADE) {
|
||||||
while (CurrentADEEntry != &CurrentIF->ADEListHead) {
|
|
||||||
CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
|
|
||||||
if ((AddrIsEqual(Address, CurrentADE->Address)) &&
|
if ((AddrIsEqual(Address, CurrentADE->Address)) &&
|
||||||
(CurrentADE->Type == AddressType)) {
|
(CurrentADE->Type == AddressType)) {
|
||||||
ReferenceObject(CurrentADE);
|
ReferenceObject(CurrentADE);
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
return CurrentADE;
|
return CurrentADE;
|
||||||
}
|
}
|
||||||
CurrentADEEntry = CurrentADEEntry->Flink;
|
} EndFor(CurrentADE);
|
||||||
}
|
} EndFor(CurrentIF);
|
||||||
CurrentIFEntry = CurrentIFEntry->Flink;
|
|
||||||
}
|
|
||||||
|
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
|
|
||||||
|
@ -586,10 +577,8 @@ PADDRESS_ENTRY IPGetDefaultADE(
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PLIST_ENTRY CurrentIFEntry;
|
ADE_LIST_ITER(CurrentADE);
|
||||||
PLIST_ENTRY CurrentADEEntry;
|
IF_LIST_ITER(CurrentIF);
|
||||||
PIP_INTERFACE CurrentIF;
|
|
||||||
PADDRESS_ENTRY CurrentADE;
|
|
||||||
BOOLEAN LoopbackIsRegistered = FALSE;
|
BOOLEAN LoopbackIsRegistered = FALSE;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IP, ("Called. AddressType (0x%X).\n", AddressType));
|
TI_DbgPrint(DEBUG_IP, ("Called. AddressType (0x%X).\n", AddressType));
|
||||||
|
@ -597,38 +586,30 @@ PADDRESS_ENTRY IPGetDefaultADE(
|
||||||
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
|
|
||||||
/* Search the interface list */
|
/* Search the interface list */
|
||||||
CurrentIFEntry = InterfaceListHead.Flink;
|
ForEachInterface(CurrentIF) {
|
||||||
while (CurrentIFEntry != &InterfaceListHead) {
|
|
||||||
CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
|
|
||||||
|
|
||||||
if (CurrentIF != Loopback) {
|
if (CurrentIF != Loopback) {
|
||||||
/* Search the address entry list and return the first appropriate ADE found */
|
/* Search the address entry list and return the first appropriate ADE found */
|
||||||
CurrentADEEntry = CurrentIF->ADEListHead.Flink;
|
TI_DbgPrint(DEBUG_IP,("Checking interface %x\n", CurrentIF));
|
||||||
while (CurrentADEEntry != &CurrentIF->ADEListHead) {
|
ForEachADE(CurrentIF->ADEListHead,CurrentADE) {
|
||||||
CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
|
if (CurrentADE->Type == AddressType) {
|
||||||
if (CurrentADE->Type == AddressType)
|
|
||||||
ReferenceObject(CurrentADE);
|
ReferenceObject(CurrentADE);
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
return CurrentADE;
|
return CurrentADE;
|
||||||
}
|
}
|
||||||
CurrentADEEntry = CurrentADEEntry->Flink;
|
} EndFor(CurrentADE);
|
||||||
} else
|
} else
|
||||||
LoopbackIsRegistered = TRUE;
|
LoopbackIsRegistered = TRUE;
|
||||||
CurrentIFEntry = CurrentIFEntry->Flink;
|
} EndFor(CurrentIF);
|
||||||
}
|
|
||||||
|
|
||||||
/* No address was found. Use loopback interface if available */
|
/* No address was found. Use loopback interface if available */
|
||||||
if (LoopbackIsRegistered) {
|
if (LoopbackIsRegistered) {
|
||||||
CurrentADEEntry = Loopback->ADEListHead.Flink;
|
ForEachADE(CurrentIF->ADEListHead,CurrentADE) {
|
||||||
while (CurrentADEEntry != &Loopback->ADEListHead) {
|
|
||||||
CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
|
|
||||||
if (CurrentADE->Type == AddressType) {
|
if (CurrentADE->Type == AddressType) {
|
||||||
ReferenceObject(CurrentADE);
|
ReferenceObject(CurrentADE);
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
return CurrentADE;
|
return CurrentADE;
|
||||||
}
|
}
|
||||||
CurrentADEEntry = CurrentADEEntry->Flink;
|
} EndFor(CurrentADE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
|
@ -665,7 +646,7 @@ VOID STDCALL IPTimeout(
|
||||||
|
|
||||||
|
|
||||||
VOID IPDispatchProtocol(
|
VOID IPDispatchProtocol(
|
||||||
PNET_TABLE_ENTRY NTE,
|
PIP_INTERFACE IPInterface,
|
||||||
PIP_PACKET IPPacket)
|
PIP_PACKET IPPacket)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: IP protocol dispatcher
|
* FUNCTION: IP protocol dispatcher
|
||||||
|
@ -692,7 +673,7 @@ VOID IPDispatchProtocol(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the appropriate protocol handler */
|
/* Call the appropriate protocol handler */
|
||||||
(*ProtocolTable[Protocol])(NTE, IPPacket);
|
(*ProtocolTable[Protocol])(IPInterface, IPPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -850,7 +831,10 @@ BOOLEAN IPRegisterInterface(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add interface to the global interface list */
|
/* Add interface to the global interface list */
|
||||||
ExInterlockedInsertTailList(&InterfaceListHead, &IF->ListEntry, &InterfaceListLock);
|
ASSERT(&IF->ListEntry);
|
||||||
|
ExInterlockedInsertTailList(&InterfaceListHead,
|
||||||
|
&IF->ListEntry,
|
||||||
|
&InterfaceListLock);
|
||||||
|
|
||||||
KeReleaseSpinLock(&IF->Lock, OldIrql);
|
KeReleaseSpinLock(&IF->Lock, OldIrql);
|
||||||
|
|
||||||
|
|
|
@ -228,15 +228,24 @@ VOID NBSendSolicit(
|
||||||
a request for the neighbor */
|
a request for the neighbor */
|
||||||
|
|
||||||
/* FIXME: Choose first NTE. We might want to give an NTE as argument */
|
/* FIXME: Choose first NTE. We might want to give an NTE as argument */
|
||||||
CurrentEntry = NCE->Interface->NTEListHead.Flink;
|
if (!NCE->Interface || !NCE->Interface->NTEListHead.Flink) {
|
||||||
if (!IsListEmpty(CurrentEntry))
|
TI_DbgPrint(MID_TRACE,
|
||||||
|
("NCE->Interface: %x, "
|
||||||
|
"NCE->Interface->NTEListHead.Flink %x\n",
|
||||||
|
NCE->Interface,
|
||||||
|
NCE->Interface ? NCE->Interface->NTEListHead.Flink : 0));
|
||||||
|
}
|
||||||
|
if (!IsListEmpty(&NCE->Interface->NTEListHead))
|
||||||
{
|
{
|
||||||
NTE = CONTAINING_RECORD(CurrentEntry, NET_TABLE_ENTRY, IFListEntry);
|
CurrentEntry = NCE->Interface->NTEListHead.Flink;
|
||||||
ARPTransmit(NCE->Address, NTE);
|
NTE = CONTAINING_RECORD(CurrentEntry, NET_TABLE_ENTRY,
|
||||||
|
IFListEntry);
|
||||||
|
ARPTransmit(NCE->Address, NTE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TI_DbgPrint(MIN_TRACE, ("Interface at 0x%X has zero NTE.\n", NCE->Interface));
|
TI_DbgPrint(MIN_TRACE, ("Interface at 0x%X has zero NTE.\n",
|
||||||
|
NCE->Interface));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -479,7 +479,7 @@ VOID ProcessFragment(
|
||||||
DISPLAY_IP_PACKET(Datagram);
|
DISPLAY_IP_PACKET(Datagram);
|
||||||
|
|
||||||
/* Give the packet to the protocol dispatcher */
|
/* Give the packet to the protocol dispatcher */
|
||||||
IPDispatchProtocol(NTE, Datagram);
|
IPDispatchProtocol(IF, Datagram);
|
||||||
|
|
||||||
/* We're done with this datagram */
|
/* We're done with this datagram */
|
||||||
exFreePool(Datagram->Header);
|
exFreePool(Datagram->Header);
|
||||||
|
@ -529,9 +529,7 @@ VOID IPDatagramReassemblyTimeout(
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IPv4Receive(
|
VOID IPv4Receive( PIP_INTERFACE IF, PIP_PACKET IPPacket)
|
||||||
PVOID Context,
|
|
||||||
PIP_PACKET IPPacket)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Receives an IPv4 datagram (or fragment)
|
* FUNCTION: Receives an IPv4 datagram (or fragment)
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -580,11 +578,11 @@ VOID IPv4Receive(
|
||||||
/* FIXME: Possibly forward packets with multicast addresses */
|
/* FIXME: Possibly forward packets with multicast addresses */
|
||||||
|
|
||||||
/* FIXME: Should we allow packets to be received on the wrong interface? */
|
/* FIXME: Should we allow packets to be received on the wrong interface? */
|
||||||
NTE = IPLocateNTEOnInterface((PIP_INTERFACE)Context, &IPPacket->DstAddr, &AddressType);
|
NTE = IPLocateNTEOnInterface(IF, &IPPacket->DstAddr, &AddressType);
|
||||||
|
|
||||||
if (NTE) {
|
if (NTE) {
|
||||||
/* This packet is destined for us */
|
/* This packet is destined for us */
|
||||||
ProcessFragment((PIP_INTERFACE)Context, IPPacket, NTE);
|
ProcessFragment(IF, IPPacket, NTE);
|
||||||
|
|
||||||
/* Done with this NTE */
|
/* Done with this NTE */
|
||||||
DereferenceObject(NTE);
|
DereferenceObject(NTE);
|
||||||
|
@ -608,12 +606,11 @@ VOID IPv4Receive(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID IPReceive( PVOID Context,
|
VOID IPReceive( PIP_INTERFACE IF, PIP_PACKET IPPacket )
|
||||||
PIP_PACKET IPPacket )
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Receives an IP datagram (or fragment)
|
* FUNCTION: Receives an IP datagram (or fragment)
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* Context = Pointer to context information (IP_INTERFACE)
|
* IF = Interface
|
||||||
* IPPacket = Pointer to IP packet
|
* IPPacket = Pointer to IP packet
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -625,7 +622,7 @@ VOID IPReceive( PVOID Context,
|
||||||
switch (Version) {
|
switch (Version) {
|
||||||
case 4:
|
case 4:
|
||||||
IPPacket->Type = IP_ADDRESS_V4;
|
IPPacket->Type = IP_ADDRESS_V4;
|
||||||
IPv4Receive(Context, IPPacket);
|
IPv4Receive(IF, IPPacket);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
IPPacket->Type = IP_ADDRESS_V6;
|
IPPacket->Type = IP_ADDRESS_V6;
|
||||||
|
|
|
@ -14,24 +14,19 @@
|
||||||
#include <address.h>
|
#include <address.h>
|
||||||
#include <pool.h>
|
#include <pool.h>
|
||||||
#include <ip.h>
|
#include <ip.h>
|
||||||
|
#include <tilists.h>
|
||||||
|
|
||||||
NTSTATUS GetInterfaceIPv4Address( PIP_INTERFACE Interface,
|
NTSTATUS GetInterfaceIPv4Address( PIP_INTERFACE Interface,
|
||||||
ULONG TargetType,
|
ULONG TargetType,
|
||||||
PULONG Address ) {
|
PULONG Address ) {
|
||||||
PLIST_ENTRY CurrentIFEntry;
|
ADE_LIST_ITER(CurrentADE);
|
||||||
PLIST_ENTRY CurrentADEEntry;
|
|
||||||
PADDRESS_ENTRY CurrentADE;
|
ForEachADE(Interface->ADEListHead,CurrentADE) {
|
||||||
|
|
||||||
CurrentADEEntry = Interface->ADEListHead.Flink;
|
|
||||||
while (CurrentADEEntry != &Interface->ADEListHead)
|
|
||||||
{
|
|
||||||
CurrentADE = CONTAINING_RECORD(CurrentADEEntry, ADDRESS_ENTRY, ListEntry);
|
|
||||||
if (CurrentADE->Type == TargetType) {
|
if (CurrentADE->Type == TargetType) {
|
||||||
*Address = CurrentADE->Address->Address.IPv4Address;
|
*Address = CurrentADE->Address->Address.IPv4Address;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
CurrentADEEntry = CurrentADEEntry->Flink;
|
} EndFor(CurrentADE);
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
@ -39,15 +34,13 @@ NTSTATUS GetInterfaceIPv4Address( PIP_INTERFACE Interface,
|
||||||
UINT CountInterfaces() {
|
UINT CountInterfaces() {
|
||||||
DWORD Count = 0;
|
DWORD Count = 0;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PLIST_ENTRY CurrentIFEntry;
|
IF_LIST_ITER(CurrentIF);
|
||||||
|
|
||||||
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
|
|
||||||
CurrentIFEntry = InterfaceListHead.Flink;
|
ForEachInterface(CurrentIF) {
|
||||||
while (CurrentIFEntry != &InterfaceListHead) {
|
|
||||||
Count++;
|
Count++;
|
||||||
CurrentIFEntry = CurrentIFEntry->Flink;
|
} EndFor(CurrentIF);
|
||||||
}
|
|
||||||
|
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
|
|
||||||
|
@ -56,19 +49,12 @@ UINT CountInterfaces() {
|
||||||
|
|
||||||
UINT CountInterfaceAddresses( PIP_INTERFACE Interface ) {
|
UINT CountInterfaceAddresses( PIP_INTERFACE Interface ) {
|
||||||
UINT AddrCount = 0;
|
UINT AddrCount = 0;
|
||||||
PADDRESS_ENTRY CurrentADE;
|
ADE_LIST_ITER(CurrentADE);
|
||||||
PLIST_ENTRY CurrentADEntry;
|
|
||||||
|
|
||||||
CurrentADEntry = Interface->ADEListHead.Flink;
|
ForEachADE(Interface->ADEListHead,CurrentADE) {
|
||||||
|
|
||||||
while( CurrentADEntry != &Interface->ADEListHead ) {
|
|
||||||
CurrentADEntry = CurrentADEntry->Flink;
|
|
||||||
CurrentADE = CONTAINING_RECORD(CurrentADEntry,
|
|
||||||
ADDRESS_ENTRY,
|
|
||||||
ListEntry);
|
|
||||||
if( CurrentADE->Type == ADE_UNICAST )
|
if( CurrentADE->Type == ADE_UNICAST )
|
||||||
AddrCount++;
|
AddrCount++;
|
||||||
}
|
} EndFor(CurrentADE);
|
||||||
|
|
||||||
return AddrCount;
|
return AddrCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <info.h>
|
#include <info.h>
|
||||||
#include <memtrack.h>
|
#include <memtrack.h>
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
DWORD DebugTraceLevel = 0x7fffffff;
|
DWORD DebugTraceLevel = 0x7fffffff;
|
||||||
|
@ -208,7 +208,9 @@ CP
|
||||||
|
|
||||||
/* XXX This should probably be done in IoCreateFile() */
|
/* XXX This should probably be done in IoCreateFile() */
|
||||||
/* Parameter checks */
|
/* Parameter checks */
|
||||||
|
|
||||||
Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1); //0-term
|
Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1); //0-term
|
||||||
|
|
||||||
if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) ||
|
if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) ||
|
||||||
(Address->TAAddressCount != 1) ||
|
(Address->TAAddressCount != 1) ||
|
||||||
(Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) ||
|
(Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) ||
|
||||||
|
@ -227,6 +229,7 @@ CP
|
||||||
CP
|
CP
|
||||||
/* Open address file object */
|
/* Open address file object */
|
||||||
|
|
||||||
|
|
||||||
/* Protocol depends on device object so find the protocol */
|
/* Protocol depends on device object so find the protocol */
|
||||||
if (DeviceObject == TCPDeviceObject)
|
if (DeviceObject == TCPDeviceObject)
|
||||||
Protocol = IPPROTO_TCP;
|
Protocol = IPPROTO_TCP;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <memtrack.h>
|
#include <memtrack.h>
|
||||||
|
|
||||||
#ifdef MEMTRACK
|
#ifdef MEMTRACK
|
||||||
|
|
||||||
LIST_ENTRY AllocatedObjectsList;
|
LIST_ENTRY AllocatedObjectsList;
|
||||||
KSPIN_LOCK AllocatedObjectsLock;
|
KSPIN_LOCK AllocatedObjectsLock;
|
||||||
DWORD TagsToShow[MEMTRACK_MAX_TAGS_TO_TRACK] = { 0 };
|
DWORD TagsToShow[MEMTRACK_MAX_TAGS_TO_TRACK] = { 0 };
|
||||||
|
|
|
@ -15,11 +15,12 @@
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <ip.h>
|
#include <ip.h>
|
||||||
#include <route.h>
|
#include <route.h>
|
||||||
|
#include <tilists.h>
|
||||||
|
|
||||||
TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer,
|
TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer,
|
||||||
PUINT BufferSize ) {
|
PUINT BufferSize ) {
|
||||||
PIP_INTERFACE CurrentIF;
|
|
||||||
PLIST_ENTRY CurrentIFEntry;
|
IF_LIST_ITER(CurrentIF);
|
||||||
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
UINT Count = 1; /* Start adapter indices at 1 */
|
UINT Count = 1; /* Start adapter indices at 1 */
|
||||||
|
@ -32,11 +33,7 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer,
|
||||||
|
|
||||||
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
|
|
||||||
CurrentIFEntry = InterfaceListHead.Flink;
|
ForEachInterface(CurrentIF) {
|
||||||
while (CurrentIFEntry != &InterfaceListHead)
|
|
||||||
{
|
|
||||||
CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
|
|
||||||
|
|
||||||
IpCurrent->Index = Count;
|
IpCurrent->Index = Count;
|
||||||
IpCurrent->Addr = 0;
|
IpCurrent->Addr = 0;
|
||||||
IpCurrent->BcastAddr = 0;
|
IpCurrent->BcastAddr = 0;
|
||||||
|
@ -53,9 +50,8 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer,
|
||||||
ADE_ADDRMASK,
|
ADE_ADDRMASK,
|
||||||
&IpAddress->Mask );
|
&IpAddress->Mask );
|
||||||
IpCurrent++;
|
IpCurrent++;
|
||||||
CurrentIFEntry = CurrentIFEntry->Flink;
|
|
||||||
Count++;
|
Count++;
|
||||||
}
|
} EndFor(CurrentIF);
|
||||||
|
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
|
|
||||||
|
@ -155,8 +151,7 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) {
|
||||||
TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer,
|
TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer,
|
||||||
PUINT BufferSize ) {
|
PUINT BufferSize ) {
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PIP_INTERFACE CurrentIF;
|
IF_LIST_ITER(CurrentIF);
|
||||||
PLIST_ENTRY CurrentIFEntry;
|
|
||||||
IPSNMP_INFO SnmpInfo;
|
IPSNMP_INFO SnmpInfo;
|
||||||
UINT IfCount = CountInterfaces();
|
UINT IfCount = CountInterfaces();
|
||||||
UINT AddrCount = 0;
|
UINT AddrCount = 0;
|
||||||
|
@ -171,13 +166,10 @@ TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer,
|
||||||
AddrCount = 0;
|
AddrCount = 0;
|
||||||
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
KeAcquireSpinLock(&InterfaceListLock, &OldIrql);
|
||||||
|
|
||||||
CurrentIFEntry = InterfaceListHead.Flink;
|
ForEachInterface(CurrentIF) {
|
||||||
while (CurrentIFEntry != &InterfaceListHead)
|
|
||||||
{
|
|
||||||
CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
|
CurrentIF = CONTAINING_RECORD(CurrentIFEntry, IP_INTERFACE, ListEntry);
|
||||||
AddrCount += CountInterfaceAddresses( CurrentIF );
|
AddrCount += CountInterfaceAddresses( CurrentIF );
|
||||||
CurrentIFEntry = CurrentIFEntry->Flink;
|
} EndFor(CurrentIF);
|
||||||
}
|
|
||||||
|
|
||||||
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
KeReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue