mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Cleaing in receive: fixed one bugcheck.
Removed much small allocation cruft (20 byte or less objects) svn path=/trunk/; revision=11602
This commit is contained in:
parent
bdaa32578b
commit
60a319ecaa
23 changed files with 104 additions and 111 deletions
|
@ -309,7 +309,6 @@ PIP_ADDRESS AddrBuildIPv4(
|
||||||
if (IPAddress != NULL) {
|
if (IPAddress != NULL) {
|
||||||
IPAddress->Type = IP_ADDRESS_V4;
|
IPAddress->Type = IP_ADDRESS_V4;
|
||||||
IPAddress->Address.IPv4Address = Address;
|
IPAddress->Address.IPv4Address = Address;
|
||||||
IPAddress->Free = IPAddressFree;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPAddress;
|
return IPAddress;
|
||||||
|
|
|
@ -244,7 +244,7 @@ VOID ARPReceive(
|
||||||
(UCHAR)Interface->AddressLength, /* Hardware address length */
|
(UCHAR)Interface->AddressLength, /* Hardware address length */
|
||||||
(UCHAR)Header->ProtoAddrLen, /* Protocol address length */
|
(UCHAR)Header->ProtoAddrLen, /* Protocol address length */
|
||||||
Interface->Address, /* Sender's (local) hardware address */
|
Interface->Address, /* Sender's (local) hardware address */
|
||||||
&ADE->Address->Address, /* Sender's (local) protocol address */
|
&ADE->Address.Address, /* Sender's (local) protocol address */
|
||||||
SenderHWAddress, /* Target's (remote) hardware address */
|
SenderHWAddress, /* Target's (remote) hardware address */
|
||||||
SenderProtoAddress, /* Target's (remote) protocol address */
|
SenderProtoAddress, /* Target's (remote) protocol address */
|
||||||
ARP_OPCODE_REPLY); /* ARP reply */
|
ARP_OPCODE_REPLY); /* ARP reply */
|
||||||
|
|
|
@ -19,7 +19,7 @@ NTSTATUS GetInterfaceIPv4Address( PIP_INTERFACE Interface,
|
||||||
|
|
||||||
ForEachADE(Interface->ADEListHead,CurrentADE) {
|
ForEachADE(Interface->ADEListHead,CurrentADE) {
|
||||||
if (CurrentADE->Type == TargetType) {
|
if (CurrentADE->Type == TargetType) {
|
||||||
*Address = CurrentADE->Address->Address.IPv4Address;
|
*Address = CurrentADE->Address.Address.IPv4Address;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
} EndFor(CurrentADE);
|
} EndFor(CurrentADE);
|
||||||
|
|
|
@ -124,7 +124,7 @@ PADDRESS_ENTRY CreateADE(
|
||||||
ADE->Free = FreeADE;
|
ADE->Free = FreeADE;
|
||||||
ADE->NTE = NTE;
|
ADE->NTE = NTE;
|
||||||
ADE->Type = Type;
|
ADE->Type = Type;
|
||||||
ADE->Address = Address;
|
RtlCopyMemory(&ADE->Address,Address,sizeof(ADE->Address));
|
||||||
|
|
||||||
/* Add ADE to the list on the interface */
|
/* Add ADE to the list on the interface */
|
||||||
InsertTailList(&IF->ADEListHead, &ADE->ListEntry);
|
InsertTailList(&IF->ADEListHead, &ADE->ListEntry);
|
||||||
|
@ -408,7 +408,7 @@ PNET_TABLE_ENTRY IPLocateNTEOnInterface(
|
||||||
|
|
||||||
while (CurrentEntry != &IF->ADEListHead) {
|
while (CurrentEntry != &IF->ADEListHead) {
|
||||||
Current = CONTAINING_RECORD(CurrentEntry, ADDRESS_ENTRY, ListEntry);
|
Current = CONTAINING_RECORD(CurrentEntry, ADDRESS_ENTRY, ListEntry);
|
||||||
if (AddrIsEqual(Address, Current->Address)) {
|
if (AddrIsEqual(Address, &Current->Address)) {
|
||||||
*AddressType = Current->Type;
|
*AddressType = Current->Type;
|
||||||
TcpipReleaseSpinLock(&IF->Lock, OldIrql);
|
TcpipReleaseSpinLock(&IF->Lock, OldIrql);
|
||||||
return Current->NTE;
|
return Current->NTE;
|
||||||
|
@ -497,7 +497,7 @@ PADDRESS_ENTRY IPLocateADE(
|
||||||
ForEachInterface(CurrentIF) {
|
ForEachInterface(CurrentIF) {
|
||||||
/* Search the address entry list and return the ADE if found */
|
/* Search the address entry list and return the ADE if found */
|
||||||
ForEachADE(CurrentIF->ADEListHead,CurrentADE) {
|
ForEachADE(CurrentIF->ADEListHead,CurrentADE) {
|
||||||
if ((AddrIsEqual(Address, CurrentADE->Address)) &&
|
if ((AddrIsEqual(Address, &CurrentADE->Address)) &&
|
||||||
(CurrentADE->Type == AddressType)) {
|
(CurrentADE->Type == AddressType)) {
|
||||||
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
TcpipReleaseSpinLock(&InterfaceListLock, OldIrql);
|
||||||
return CurrentADE;
|
return CurrentADE;
|
||||||
|
@ -729,7 +729,7 @@ BOOLEAN IPRegisterInterface(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NCE is already referenced */
|
/* NCE is already referenced */
|
||||||
if (!RouterAddRoute(Current->Address, Current->PLE->Prefix, NCE, 1)) {
|
if (!RouterAddRoute(Current->Address, &Current->PLE->Prefix, NCE, 1)) {
|
||||||
TI_DbgPrint(MIN_TRACE, ("Could not add route due to insufficient resources.\n"));
|
TI_DbgPrint(MIN_TRACE, ("Could not add route due to insufficient resources.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ PPREFIX_LIST_ENTRY CreatePLE(PIP_INTERFACE IF, PIP_ADDRESS Prefix, UINT Length)
|
||||||
|
|
||||||
INIT_TAG(PLE, TAG('P','L','E',' '));
|
INIT_TAG(PLE, TAG('P','L','E',' '));
|
||||||
PLE->Interface = IF;
|
PLE->Interface = IF;
|
||||||
PLE->Prefix = Prefix;
|
RtlCopyMemory(&PLE->Prefix, Prefix, sizeof(PLE->Prefix));
|
||||||
PLE->PrefixLength = Length;
|
PLE->PrefixLength = Length;
|
||||||
|
|
||||||
/* Add PLE to the global prefix list */
|
/* Add PLE to the global prefix list */
|
||||||
|
|
|
@ -107,12 +107,6 @@ VOID FreeIPDR(
|
||||||
CurrentEntry = NextEntry;
|
CurrentEntry = NextEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free resources for the header, if it exists */
|
|
||||||
if (IPDR->IPv4Header) {
|
|
||||||
TI_DbgPrint(DEBUG_IP, ("Freeing IPv4 header data at (0x%X).\n", IPDR->IPv4Header));
|
|
||||||
exFreePool(IPDR->IPv4Header);
|
|
||||||
}
|
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IP, ("Freeing IPDR data at (0x%X).\n", IPDR));
|
TI_DbgPrint(DEBUG_IP, ("Freeing IPDR data at (0x%X).\n", IPDR));
|
||||||
|
|
||||||
TcpipFreeToNPagedLookasideList(&IPDRList, IPDR);
|
TcpipFreeToNPagedLookasideList(&IPDRList, IPDR);
|
||||||
|
@ -229,7 +223,7 @@ PIP_PACKET ReassembleDatagram(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the header into the buffer */
|
/* Copy the header into the buffer */
|
||||||
RtlCopyMemory(IPPacket->Header, IPDR->IPv4Header, IPDR->HeaderSize);
|
RtlCopyMemory(IPPacket->Header, &IPDR->IPv4Header, IPDR->HeaderSize);
|
||||||
|
|
||||||
Data = IPPacket->Header + IPDR->HeaderSize;
|
Data = IPPacket->Header + IPDR->HeaderSize;
|
||||||
IPPacket->Data = Data;
|
IPPacket->Data = Data;
|
||||||
|
@ -337,7 +331,6 @@ VOID ProcessFragment(
|
||||||
AddrInitIPv4(&IPDR->DstAddr, IPv4Header->DstAddr);
|
AddrInitIPv4(&IPDR->DstAddr, IPv4Header->DstAddr);
|
||||||
IPDR->Id = IPv4Header->Id;
|
IPDR->Id = IPv4Header->Id;
|
||||||
IPDR->Protocol = IPv4Header->Protocol;
|
IPDR->Protocol = IPv4Header->Protocol;
|
||||||
IPDR->IPv4Header = NULL;
|
|
||||||
InitializeListHead(&IPDR->FragmentListHead);
|
InitializeListHead(&IPDR->FragmentListHead);
|
||||||
InitializeListHead(&IPDR->HoleListHead);
|
InitializeListHead(&IPDR->HoleListHead);
|
||||||
InsertTailList(&IPDR->HoleListHead, &Hole->ListEntry);
|
InsertTailList(&IPDR->HoleListHead, &Hole->ListEntry);
|
||||||
|
@ -403,17 +396,10 @@ VOID ProcessFragment(
|
||||||
|
|
||||||
/* If this is the first fragment, save the IP header */
|
/* If this is the first fragment, save the IP header */
|
||||||
if (FragFirst == 0) {
|
if (FragFirst == 0) {
|
||||||
IPDR->IPv4Header = exAllocatePool(NonPagedPool, IPPacket->HeaderSize);
|
|
||||||
if (!IPDR->IPv4Header) {
|
|
||||||
/* We don't have the resources to process this packet, discard it */
|
|
||||||
Cleanup(&IPDR->Lock, OldIrql, IPDR, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IP, ("First fragment found. Header buffer is at (0x%X). "
|
TI_DbgPrint(DEBUG_IP, ("First fragment found. Header buffer is at (0x%X). "
|
||||||
"Header size is (%d).\n", IPDR->IPv4Header, IPPacket->HeaderSize));
|
"Header size is (%d).\n", IPDR->IPv4Header, IPPacket->HeaderSize));
|
||||||
|
|
||||||
RtlCopyMemory(IPDR->IPv4Header, IPPacket->Header, IPPacket->HeaderSize);
|
RtlCopyMemory(&IPDR->IPv4Header, IPPacket->Header, IPPacket->HeaderSize);
|
||||||
IPDR->HeaderSize = IPPacket->HeaderSize;
|
IPDR->HeaderSize = IPPacket->HeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,9 +453,9 @@ VOID ProcessFragment(
|
||||||
|
|
||||||
Datagram = ReassembleDatagram(IPDR);
|
Datagram = ReassembleDatagram(IPDR);
|
||||||
|
|
||||||
|
RemoveIPDR(IPDR);
|
||||||
TcpipReleaseSpinLock(&IPDR->Lock, OldIrql);
|
TcpipReleaseSpinLock(&IPDR->Lock, OldIrql);
|
||||||
|
|
||||||
RemoveIPDR(IPDR);
|
|
||||||
FreeIPDR(IPDR);
|
FreeIPDR(IPDR);
|
||||||
|
|
||||||
if (!Datagram)
|
if (!Datagram)
|
||||||
|
|
|
@ -272,7 +272,7 @@ PIP_INTERFACE RouterFindOnLinkInterface(
|
||||||
while (CurrentEntry != &PrefixListHead) {
|
while (CurrentEntry != &PrefixListHead) {
|
||||||
Current = CONTAINING_RECORD(CurrentEntry, PREFIX_LIST_ENTRY, ListEntry);
|
Current = CONTAINING_RECORD(CurrentEntry, PREFIX_LIST_ENTRY, ListEntry);
|
||||||
|
|
||||||
if (HasPrefix(Address, Current->Prefix, Current->PrefixLength) &&
|
if (HasPrefix(Address, &Current->Prefix, Current->PrefixLength) &&
|
||||||
((!NTE) || (NTE->Interface == Current->Interface)))
|
((!NTE) || (NTE->Interface == Current->Interface)))
|
||||||
return Current->Interface;
|
return Current->Interface;
|
||||||
|
|
||||||
|
@ -321,9 +321,10 @@ PFIB_ENTRY RouterAddRoute(
|
||||||
|
|
||||||
INIT_TAG(Router, TAG('R','O','U','T'));
|
INIT_TAG(Router, TAG('R','O','U','T'));
|
||||||
|
|
||||||
FIBE->Free = FreeFIB;
|
RtlCopyMemory( &FIBE->NetworkAddress, NetworkAddress,
|
||||||
FIBE->NetworkAddress = NetworkAddress;
|
sizeof(FIBE->NetworkAddress) );
|
||||||
FIBE->Netmask = Netmask;
|
RtlCopyMemory( &FIBE->Netmask, Netmask,
|
||||||
|
sizeof(FIBE->Netmask) );
|
||||||
FIBE->Router = Router;
|
FIBE->Router = Router;
|
||||||
FIBE->Metric = Metric;
|
FIBE->Metric = Metric;
|
||||||
|
|
||||||
|
@ -415,8 +416,8 @@ VOID RouterRemoveRoute(
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ROUTER, ("Called. FIBE (0x%X).\n", FIBE));
|
TI_DbgPrint(DEBUG_ROUTER, ("Called. FIBE (0x%X).\n", FIBE));
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ROUTER, ("FIBE (%s).\n", A2S(FIBE->NetworkAddress)));
|
TI_DbgPrint(DEBUG_ROUTER, ("FIBE (%s).\n", A2S(&FIBE->NetworkAddress)));
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&FIBLock, &OldIrql);
|
TcpipAcquireSpinLock(&FIBLock, &OldIrql);
|
||||||
DestroyFIBE(FIBE);
|
DestroyFIBE(FIBE);
|
||||||
|
@ -483,10 +484,6 @@ PFIB_ENTRY RouterCreateRouteIPv4(
|
||||||
if (!FIBE) {
|
if (!FIBE) {
|
||||||
/* Not enough free resources */
|
/* Not enough free resources */
|
||||||
NBRemoveNeighbor(NCE);
|
NBRemoveNeighbor(NCE);
|
||||||
|
|
||||||
(pNetworkAddress->Free)(pNetworkAddress);
|
|
||||||
(pNetmask->Free)(pNetmask);
|
|
||||||
(pRouterAddress->Free)(pRouterAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FIBE;
|
return FIBE;
|
||||||
|
|
|
@ -112,7 +112,7 @@ NTSTATUS RawIPSendDatagram(
|
||||||
if( Status == NDIS_STATUS_SUCCESS )
|
if( Status == NDIS_STATUS_SUCCESS )
|
||||||
Status = BuildRawIPPacket( &Packet,
|
Status = BuildRawIPPacket( &Packet,
|
||||||
BufferLen,
|
BufferLen,
|
||||||
AddrFile->ADE->Address,
|
&AddrFile->ADE->Address,
|
||||||
AddrFile->Port );
|
AddrFile->Port );
|
||||||
|
|
||||||
if( Status == NDIS_STATUS_SUCCESS ) {
|
if( Status == NDIS_STATUS_SUCCESS ) {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
extern ULONG TCP_IPIdentification;
|
extern ULONG TCP_IPIdentification;
|
||||||
extern LIST_ENTRY SleepingThreadsList;
|
extern LIST_ENTRY SleepingThreadsList;
|
||||||
extern FAST_MUTEX SleepingThreadsLock;
|
extern FAST_MUTEX SleepingThreadsLock;
|
||||||
|
extern RECURSIVE_MUTEX TCPLock;
|
||||||
|
|
||||||
int TCPSocketState(void *ClientData,
|
int TCPSocketState(void *ClientData,
|
||||||
void *WhichSocket,
|
void *WhichSocket,
|
||||||
|
@ -31,6 +32,8 @@ int TCPSocketState(void *ClientData,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TcpipRecursiveMutexEnter( &TCPLock, TRUE );
|
||||||
|
|
||||||
if( (NewState & SEL_CONNECT) &&
|
if( (NewState & SEL_CONNECT) &&
|
||||||
!(Connection->State & SEL_CONNECT) ) {
|
!(Connection->State & SEL_CONNECT) ) {
|
||||||
while( !IsListEmpty( &Connection->ConnectRequest ) ) {
|
while( !IsListEmpty( &Connection->ConnectRequest ) ) {
|
||||||
|
@ -75,7 +78,7 @@ int TCPSocketState(void *ClientData,
|
||||||
TI_DbgPrint(MID_TRACE,
|
TI_DbgPrint(MID_TRACE,
|
||||||
("Reading %d bytes to %x\n", RecvLen, RecvBuffer));
|
("Reading %d bytes to %x\n", RecvLen, RecvBuffer));
|
||||||
|
|
||||||
if( NewState & SEL_FIN && !RecvLen ) {
|
if( (NewState & SEL_FIN) && !RecvLen ) {
|
||||||
Status = STATUS_END_OF_FILE;
|
Status = STATUS_END_OF_FILE;
|
||||||
Received = 0;
|
Received = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,6 +123,8 @@ int TCPSocketState(void *ClientData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -373,6 +373,7 @@ NTSTATUS TCPReceiveData
|
||||||
Bucket = ExAllocatePool( NonPagedPool, sizeof(*Bucket) );
|
Bucket = ExAllocatePool( NonPagedPool, sizeof(*Bucket) );
|
||||||
if( !Bucket ) {
|
if( !Bucket ) {
|
||||||
TI_DbgPrint(MID_TRACE,("Failed to allocate bucket\n"));
|
TI_DbgPrint(MID_TRACE,("Failed to allocate bucket\n"));
|
||||||
|
TcpipRecursiveMutexLeave( &TCPLock );
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ NTSTATUS UDPSendDatagram(
|
||||||
Status = BuildUDPPacket( &Packet,
|
Status = BuildUDPPacket( &Packet,
|
||||||
&RemoteAddress,
|
&RemoteAddress,
|
||||||
RemotePort,
|
RemotePort,
|
||||||
AddrFile->ADE->Address,
|
&AddrFile->ADE->Address,
|
||||||
AddrFile->Port,
|
AddrFile->Port,
|
||||||
BufferData,
|
BufferData,
|
||||||
DataSize );
|
DataSize );
|
||||||
|
|
|
@ -200,7 +200,7 @@ VOID STDCALL LanReceiveWorker( PVOID Context ) {
|
||||||
|
|
||||||
while( (ListEntry =
|
while( (ListEntry =
|
||||||
ExInterlockedRemoveHeadList( &LanWorkList, &LanWorkLock )) ) {
|
ExInterlockedRemoveHeadList( &LanWorkList, &LanWorkLock )) ) {
|
||||||
WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
|
WorkItem = CONTAINING_RECORD(ListEntry, LAN_WQ_ITEM, ListEntry);
|
||||||
|
|
||||||
Packet = WorkItem->Packet;
|
Packet = WorkItem->Packet;
|
||||||
Adapter = WorkItem->Adapter;
|
Adapter = WorkItem->Adapter;
|
||||||
|
@ -732,8 +732,6 @@ VOID BindAdapter(
|
||||||
/* XXX how do we proceed? No ip address, no parameters... do we guess? */
|
/* XXX how do we proceed? No ip address, no parameters... do we guess? */
|
||||||
if(RegHandle)
|
if(RegHandle)
|
||||||
ZwClose(RegHandle);
|
ZwClose(RegHandle);
|
||||||
if(Address) Address->Free(Address);
|
|
||||||
if(Netmask) Netmask->Free(Netmask);
|
|
||||||
IPDestroyInterface(IF);
|
IPDestroyInterface(IF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -750,14 +748,11 @@ VOID BindAdapter(
|
||||||
|
|
||||||
/* Create a net table entry for this interface */
|
/* Create a net table entry for this interface */
|
||||||
if (!IPCreateNTE(IF, Address, AddrCountPrefixBits(Netmask))) {
|
if (!IPCreateNTE(IF, Address, AddrCountPrefixBits(Netmask))) {
|
||||||
Netmask->Free(Netmask);
|
|
||||||
TI_DbgPrint(MIN_TRACE, ("IPCreateNTE() failed.\n"));
|
TI_DbgPrint(MIN_TRACE, ("IPCreateNTE() failed.\n"));
|
||||||
IPDestroyInterface(IF);
|
IPDestroyInterface(IF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Netmask->Free(Netmask);
|
|
||||||
|
|
||||||
/* Register interface with IP layer */
|
/* Register interface with IP layer */
|
||||||
IPRegisterInterface(IF);
|
IPRegisterInterface(IF);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
INIT_TAG((IPAddress), TAG('I','P','V','4')); \
|
INIT_TAG((IPAddress), TAG('I','P','V','4')); \
|
||||||
(IPAddress)->Type = IP_ADDRESS_V4; \
|
(IPAddress)->Type = IP_ADDRESS_V4; \
|
||||||
(IPAddress)->Address.IPv4Address = (RawAddress); \
|
(IPAddress)->Address.IPv4Address = (RawAddress); \
|
||||||
(IPAddress)->Free = IPAddressFree; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
|
|
@ -22,17 +22,16 @@ typedef IPv6_RAW_ADDRESS *PIPv6_RAW_ADDRESS;
|
||||||
/* IP style address */
|
/* IP style address */
|
||||||
typedef struct IP_ADDRESS {
|
typedef struct IP_ADDRESS {
|
||||||
DEFINE_TAG
|
DEFINE_TAG
|
||||||
UCHAR Type; /* Type of IP address */
|
UCHAR Type; /* Type of IP address */
|
||||||
union {
|
union {
|
||||||
IPv4_RAW_ADDRESS IPv4Address; /* IPv4 address (in network byte order) */
|
IPv4_RAW_ADDRESS IPv4Address;/* IPv4 address (in network byte order) */
|
||||||
PIPv6_RAW_ADDRESS IPv6Address; /* IPv6 address (in network byte order) */
|
IPv6_RAW_ADDRESS IPv6Address;/* IPv6 address (in network byte order) */
|
||||||
} Address;
|
} Address;
|
||||||
OBJECT_FREE_ROUTINE Free; /* The free routine */
|
|
||||||
} IP_ADDRESS, *PIP_ADDRESS;
|
} IP_ADDRESS, *PIP_ADDRESS;
|
||||||
|
|
||||||
/* IP type constants */
|
/* IP type constants */
|
||||||
#define IP_ADDRESS_V4 0x00 /* IPv4 style address */
|
#define IP_ADDRESS_V4 0x04 /* IPv4 style address */
|
||||||
#define IP_ADDRESS_V6 0x01 /* IPv6 style address */
|
#define IP_ADDRESS_V6 0x06 /* IPv6 style address */
|
||||||
|
|
||||||
|
|
||||||
/* IPv4 header format */
|
/* IPv4 header format */
|
||||||
|
@ -49,6 +48,21 @@ typedef struct IPv4_HEADER {
|
||||||
IPv4_RAW_ADDRESS DstAddr; /* Destination Address */
|
IPv4_RAW_ADDRESS DstAddr; /* Destination Address */
|
||||||
} IPv4_HEADER, *PIPv4_HEADER;
|
} IPv4_HEADER, *PIPv4_HEADER;
|
||||||
|
|
||||||
|
/* IPv6 header format */
|
||||||
|
typedef struct IPv6_HEADER {
|
||||||
|
ULONG VTF; /* Version, Traffic Class, Flow Label */
|
||||||
|
USHORT PayloadLength;
|
||||||
|
UCHAR NextHeader; /* Same as Protocol in IPv4 */
|
||||||
|
UCHAR HopLimit; /* Same as Ttl in IPv4 */
|
||||||
|
IPv6_RAW_ADDRESS SrcAddr;
|
||||||
|
IPv6_RAW_ADDRESS DstAddr;
|
||||||
|
} IPv6_HEADER, *PIPv6_HEADER;
|
||||||
|
|
||||||
|
typedef union _IP_HEADER {
|
||||||
|
IPv4_HEADER v4;
|
||||||
|
IPv6_HEADER v6;
|
||||||
|
} IP_HEADER, *PIP_HEADER;
|
||||||
|
|
||||||
#define IPv4_FRAGOFS_MASK 0x1FFF /* Fragment offset mask (host byte order) */
|
#define IPv4_FRAGOFS_MASK 0x1FFF /* Fragment offset mask (host byte order) */
|
||||||
#define IPv4_MF_MASK 0x2000 /* More fragments (host byte order) */
|
#define IPv4_MF_MASK 0x2000 /* More fragments (host byte order) */
|
||||||
#define IPv4_DF_MASK 0x4000 /* Don't fragment (host byte order) */
|
#define IPv4_DF_MASK 0x4000 /* Don't fragment (host byte order) */
|
||||||
|
@ -99,7 +113,7 @@ typedef struct _ADDRESS_ENTRY {
|
||||||
OBJECT_FREE_ROUTINE Free; /* Routine used to free resources for the object */
|
OBJECT_FREE_ROUTINE Free; /* Routine used to free resources for the object */
|
||||||
struct _NET_TABLE_ENTRY *NTE; /* NTE associated with this address */
|
struct _NET_TABLE_ENTRY *NTE; /* NTE associated with this address */
|
||||||
UCHAR Type; /* Address type */
|
UCHAR Type; /* Address type */
|
||||||
PIP_ADDRESS Address; /* Pointer to address identifying this entry */
|
IP_ADDRESS Address; /* Pointer to address identifying this entry */
|
||||||
} ADDRESS_ENTRY, *PADDRESS_ENTRY;
|
} ADDRESS_ENTRY, *PADDRESS_ENTRY;
|
||||||
|
|
||||||
/* Values for address type -- also the interface flags */
|
/* Values for address type -- also the interface flags */
|
||||||
|
|
|
@ -12,7 +12,7 @@ typedef struct _PREFIX_LIST_ENTRY {
|
||||||
DEFINE_TAG
|
DEFINE_TAG
|
||||||
LIST_ENTRY ListEntry; /* Entry on list */
|
LIST_ENTRY ListEntry; /* Entry on list */
|
||||||
PIP_INTERFACE Interface; /* Pointer to interface */
|
PIP_INTERFACE Interface; /* Pointer to interface */
|
||||||
PIP_ADDRESS Prefix; /* Pointer to prefix */
|
IP_ADDRESS Prefix; /* Pointer to prefix */
|
||||||
UINT PrefixLength; /* Length of prefix */
|
UINT PrefixLength; /* Length of prefix */
|
||||||
} PREFIX_LIST_ENTRY, *PPREFIX_LIST_ENTRY;
|
} PREFIX_LIST_ENTRY, *PPREFIX_LIST_ENTRY;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ typedef struct IPDATAGRAM_REASSEMBLY {
|
||||||
IP_ADDRESS DstAddr; /* Destination address */
|
IP_ADDRESS DstAddr; /* Destination address */
|
||||||
UCHAR Protocol; /* Internet Protocol number */
|
UCHAR Protocol; /* Internet Protocol number */
|
||||||
USHORT Id; /* Identification number */
|
USHORT Id; /* Identification number */
|
||||||
PIPv4_HEADER IPv4Header; /* Pointer to IP header */
|
IP_HEADER IPv4Header; /* Pointer to IP header */
|
||||||
UINT HeaderSize; /* Length of IP header */
|
UINT HeaderSize; /* Length of IP header */
|
||||||
LIST_ENTRY FragmentListHead; /* IP fragment list */
|
LIST_ENTRY FragmentListHead; /* IP fragment list */
|
||||||
LIST_ENTRY HoleListHead; /* IP datagram hole list */
|
LIST_ENTRY HoleListHead; /* IP datagram hole list */
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
typedef struct _FIB_ENTRY {
|
typedef struct _FIB_ENTRY {
|
||||||
LIST_ENTRY ListEntry; /* Entry on list */
|
LIST_ENTRY ListEntry; /* Entry on list */
|
||||||
OBJECT_FREE_ROUTINE Free; /* Routine used to free resources for the object */
|
OBJECT_FREE_ROUTINE Free; /* Routine used to free resources for the object */
|
||||||
PIP_ADDRESS NetworkAddress; /* Address of network */
|
IP_ADDRESS NetworkAddress; /* Address of network */
|
||||||
PIP_ADDRESS Netmask; /* Netmask of network */
|
IP_ADDRESS Netmask; /* Netmask of network */
|
||||||
PNEIGHBOR_CACHE_ENTRY Router; /* Pointer to NCE of router to use */
|
PNEIGHBOR_CACHE_ENTRY Router; /* Pointer to NCE of router to use */
|
||||||
UINT Metric; /* Cost of this route */
|
UINT Metric; /* Cost of this route */
|
||||||
} FIB_ENTRY, *PFIB_ENTRY;
|
} FIB_ENTRY, *PFIB_ENTRY;
|
||||||
|
|
|
@ -182,7 +182,7 @@ typedef struct _ADDRESS_FILE {
|
||||||
struct _CONNECTION_ENDPOINT *Connection;
|
struct _CONNECTION_ENDPOINT *Connection;
|
||||||
/* Associated connection or NULL if no
|
/* Associated connection or NULL if no
|
||||||
associated connection exist */
|
associated connection exist */
|
||||||
PIP_ADDRESS AddrCache; /* One entry address cache (destination
|
IP_ADDRESS AddrCache; /* One entry address cache (destination
|
||||||
address of last packet transmitted) */
|
address of last packet transmitted) */
|
||||||
|
|
||||||
/* The following members are used to control event notification */
|
/* The following members are used to control event notification */
|
||||||
|
|
|
@ -467,7 +467,7 @@ NTSTATUS DispTdiDisconnect(
|
||||||
Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
|
Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
|
||||||
Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
||||||
Address->Address[0].Address[0].sin_port = AddrFile->Port;
|
Address->Address[0].Address[0].sin_port = AddrFile->Port;
|
||||||
Address->Address[0].Address[0].in_addr = AddrFile->ADE->Address->Address.IPv4Address;
|
Address->Address[0].Address[0].in_addr = AddrFile->ADE->Address.Address.IPv4Address;
|
||||||
RtlZeroMemory(
|
RtlZeroMemory(
|
||||||
&Address->Address[0].Address[0].sin_zero,
|
&Address->Address[0].Address[0].sin_zero,
|
||||||
sizeof(Address->Address[0].Address[0].sin_zero));
|
sizeof(Address->Address[0].Address[0].sin_zero));
|
||||||
|
@ -594,7 +594,7 @@ NTSTATUS DispTdiQueryInformation(
|
||||||
Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
|
Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
|
||||||
Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
||||||
Address->Address[0].Address[0].sin_port = AddrFile->Port;
|
Address->Address[0].Address[0].sin_port = AddrFile->Port;
|
||||||
Address->Address[0].Address[0].in_addr = AddrFile->ADE->Address->Address.IPv4Address;
|
Address->Address[0].Address[0].in_addr = AddrFile->ADE->Address.Address.IPv4Address;
|
||||||
RtlZeroMemory(
|
RtlZeroMemory(
|
||||||
&Address->Address[0].Address[0].sin_zero,
|
&Address->Address[0].Address[0].sin_zero,
|
||||||
sizeof(Address->Address[0].Address[0].sin_zero));
|
sizeof(Address->Address[0].Address[0].sin_zero));
|
||||||
|
|
|
@ -69,7 +69,7 @@ PADDRESS_FILE AddrSearchNext(
|
||||||
while (CurrentEntry != &AddressFileListHead) {
|
while (CurrentEntry != &AddressFileListHead) {
|
||||||
Current = CONTAINING_RECORD(CurrentEntry, ADDRESS_FILE, ListEntry);
|
Current = CONTAINING_RECORD(CurrentEntry, ADDRESS_FILE, ListEntry);
|
||||||
|
|
||||||
IPAddress = Current->ADE->Address;
|
IPAddress = &Current->ADE->Address;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_ADDRFILE, ("Comparing: ((%d, %d, %s), (%d, %d, %s)).\n",
|
TI_DbgPrint(DEBUG_ADDRFILE, ("Comparing: ((%d, %d, %s), (%d, %d, %s)).\n",
|
||||||
WN2H(Current->Port),
|
WN2H(Current->Port),
|
||||||
|
@ -340,7 +340,7 @@ NTSTATUS FileOpenAddress(
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Opening address %s for communication.\n",
|
TI_DbgPrint(MID_TRACE, ("Opening address %s for communication.\n",
|
||||||
A2S(AddrFile->ADE->Address)));
|
A2S(&AddrFile->ADE->Address)));
|
||||||
|
|
||||||
/* Protocol specific handling */
|
/* Protocol specific handling */
|
||||||
switch (Protocol) {
|
switch (Protocol) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
DWORD DebugTraceLevel = 0x7fffffff;
|
DWORD DebugTraceLevel = 0x7fffffff;
|
||||||
|
|
|
@ -85,20 +85,19 @@ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) {
|
||||||
|
|
||||||
while( RtCurrent < RouteEntries + RtCount ) {
|
while( RtCurrent < RouteEntries + RtCount ) {
|
||||||
/* Copy Desitnation */
|
/* Copy Desitnation */
|
||||||
if( RCacheCur->NetworkAddress && RCacheCur->Netmask &&
|
if( RCacheCur->Router ) {
|
||||||
RCacheCur->Router ) {
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("%d: NA %08x NM %08x GW %08x MT %d\n",
|
TI_DbgPrint(MAX_TRACE, ("%d: NA %08x NM %08x GW %08x MT %d\n",
|
||||||
RtCurrent - RouteEntries,
|
RtCurrent - RouteEntries,
|
||||||
RCacheCur->NetworkAddress->Address,
|
&RCacheCur->NetworkAddress.Address,
|
||||||
RCacheCur->Netmask->Address,
|
&RCacheCur->Netmask.Address,
|
||||||
RCacheCur->Router->Address.Address,
|
RCacheCur->Router->Address.Address,
|
||||||
RCacheCur->Metric));
|
RCacheCur->Metric));
|
||||||
|
|
||||||
RtlCopyMemory( &RtCurrent->Dest,
|
RtlCopyMemory( &RtCurrent->Dest,
|
||||||
&RCacheCur->NetworkAddress->Address,
|
&RCacheCur->NetworkAddress.Address,
|
||||||
sizeof(RtCurrent->Dest) );
|
sizeof(RtCurrent->Dest) );
|
||||||
RtlCopyMemory( &RtCurrent->Mask,
|
RtlCopyMemory( &RtCurrent->Mask,
|
||||||
&RCacheCur->Netmask->Address,
|
&RCacheCur->Netmask.Address,
|
||||||
sizeof(RtCurrent->Mask) );
|
sizeof(RtCurrent->Mask) );
|
||||||
/* Currently, this address is stuffed into the pointer.
|
/* Currently, this address is stuffed into the pointer.
|
||||||
* That probably is not intended. */
|
* That probably is not intended. */
|
||||||
|
|
|
@ -1,52 +1,50 @@
|
||||||
# Import stubs Auto-generated by ./stubgen.sh
|
# Automatically generated by stubgen
|
||||||
ntoskrnl.a _imp_@InterlockedDecrement@4
|
ndis.a _imp__NDIS_BUFFER_TO_SPAN_PAGES@4
|
||||||
ntoskrnl.a _imp_@InterlockedExchange@8
|
ntoskrnl.a _imp__KeBugCheck@4
|
||||||
ntoskrnl.a _imp_@InterlockedIncrement@4
|
|
||||||
ntoskrnl.a _imp_@InterlockedPopEntrySList@4
|
ntoskrnl.a _imp_@InterlockedPopEntrySList@4
|
||||||
ntoskrnl.a _imp_@InterlockedPushEntrySList@8
|
ntoskrnl.a _imp_@InterlockedPushEntrySList@8
|
||||||
ntoskrnl.a _imp_@IofCompleteRequest@8
|
|
||||||
ntoskrnl.a _imp_@ObfDereferenceObject@4
|
|
||||||
ntoskrnl.a _imp__ExAllocatePool@8
|
|
||||||
ntoskrnl.a _imp__ExDeleteNPagedLookasideList@4
|
ntoskrnl.a _imp__ExDeleteNPagedLookasideList@4
|
||||||
ntoskrnl.a _imp__ExFreePool@4
|
|
||||||
ntoskrnl.a _imp__ExInitializeNPagedLookasideList@28
|
ntoskrnl.a _imp__ExInitializeNPagedLookasideList@28
|
||||||
ntoskrnl.a _imp__ExInterlockedInsertTailList@12
|
|
||||||
ntoskrnl.a _imp__ExInterlockedRemoveHeadList@8
|
|
||||||
ntoskrnl.a _imp__ExQueueWorkItem@8
|
|
||||||
ntoskrnl.a _imp__IoAcquireCancelSpinLock@4
|
|
||||||
ntoskrnl.a _imp__IoAllocateMdl@20
|
|
||||||
ntoskrnl.a _imp__IoCreateDevice@28
|
|
||||||
ntoskrnl.a _imp__IoDeleteDevice@4
|
|
||||||
ntoskrnl.a _imp__IoFileObjectType
|
|
||||||
ntoskrnl.a _imp__IoFreeMdl@4
|
|
||||||
ntoskrnl.a _imp__IoReleaseCancelSpinLock@4
|
|
||||||
ntoskrnl.a _imp__KeBugCheck@4
|
|
||||||
ntoskrnl.a _imp__KeCancelTimer@4
|
|
||||||
ntoskrnl.a _imp__KeInitializeDpc@12
|
|
||||||
ntoskrnl.a _imp__KeInitializeEvent@12
|
|
||||||
ntoskrnl.a _imp__KeInitializeSpinLock@4
|
|
||||||
ntoskrnl.a _imp__KeInitializeTimer@4
|
|
||||||
ntoskrnl.a _imp__KeResetEvent@4
|
|
||||||
ntoskrnl.a _imp__KeSetEvent@12
|
|
||||||
ntoskrnl.a _imp__KeSetTimerEx@20
|
|
||||||
ntoskrnl.a _imp__KeWaitForSingleObject@20
|
|
||||||
ntoskrnl.a _imp__MmMapLockedPages@8
|
|
||||||
ntoskrnl.a _imp__MmProbeAndLockPages@12
|
|
||||||
ntoskrnl.a _imp__MmUnlockPages@4
|
|
||||||
ndis.a _imp__NDIS_BUFFER_TO_SPAN_PAGES@4
|
|
||||||
ndis.a _imp__NdisAllocateBuffer@20
|
|
||||||
ndis.a _imp__NdisAllocateBufferPool@12
|
|
||||||
ndis.a _imp__NdisAllocatePacket@12
|
|
||||||
ndis.a _imp__NdisAllocatePacketPool@16
|
|
||||||
ndis.a _imp__NdisCloseAdapter@8
|
|
||||||
ndis.a _imp__NdisDeregisterProtocol@8
|
ndis.a _imp__NdisDeregisterProtocol@8
|
||||||
ndis.a _imp__NdisFreeBuffer@4
|
|
||||||
ndis.a _imp__NdisFreeBufferPool@4
|
|
||||||
ndis.a _imp__NdisFreePacket@4
|
|
||||||
ndis.a _imp__NdisFreePacketPool@4
|
|
||||||
ndis.a _imp__NdisOpenAdapter@44
|
|
||||||
ndis.a _imp__NdisRegisterProtocol@16
|
ndis.a _imp__NdisRegisterProtocol@16
|
||||||
ndis.a _imp__NdisRequest@12
|
ndis.a _imp__NdisCloseAdapter@8
|
||||||
|
ndis.a _imp__NdisOpenAdapter@44
|
||||||
ndis.a _imp__NdisSend@12
|
ndis.a _imp__NdisSend@12
|
||||||
ndis.a _imp__NdisTransferData@28
|
ndis.a _imp__NdisTransferData@28
|
||||||
|
ntoskrnl.a _imp__ExInterlockedRemoveHeadList@8
|
||||||
|
ndis.a _imp__NdisRequest@12
|
||||||
|
ndis.a _imp__NdisFreePacket@4
|
||||||
|
ndis.a _imp__NdisFreeBuffer@4
|
||||||
|
ndis.a _imp__NdisAllocatePacket@12
|
||||||
|
ndis.a _imp__NdisAllocateBuffer@20
|
||||||
|
ntoskrnl.a _imp__ExInterlockedInsertTailList@12
|
||||||
|
ntoskrnl.a _imp_@IofCompleteRequest@8
|
||||||
|
ntoskrnl.a _imp__MmProbeAndLockPages@12
|
||||||
|
ntoskrnl.a _imp__IoAllocateMdl@20
|
||||||
|
ntoskrnl.a _imp__ExFreePool@4
|
||||||
|
ntoskrnl.a _imp__IoFreeMdl@4
|
||||||
|
ntoskrnl.a _imp__MmUnlockPages@4
|
||||||
|
ntoskrnl.a _imp__MmMapLockedPages@8
|
||||||
|
ntoskrnl.a _imp_@ObfDereferenceObject@4
|
||||||
ntoskrnl.a _imp__ObReferenceObjectByHandle@24
|
ntoskrnl.a _imp__ObReferenceObjectByHandle@24
|
||||||
|
ntoskrnl.a _imp__IoFileObjectType
|
||||||
|
ntoskrnl.a _imp_@InterlockedExchange@8
|
||||||
|
ntoskrnl.a _imp__KeSetTimerEx@20
|
||||||
|
ntoskrnl.a _imp__KeInitializeTimer@4
|
||||||
|
ntoskrnl.a _imp__KeInitializeDpc@12
|
||||||
|
ndis.a _imp__NdisAllocateBufferPool@12
|
||||||
|
ndis.a _imp__NdisAllocatePacketPool@16
|
||||||
|
ntoskrnl.a _imp__KeInitializeSpinLock@4
|
||||||
|
ntoskrnl.a _imp__IoCreateDevice@28
|
||||||
|
ntoskrnl.a _imp__ExQueueWorkItem@8
|
||||||
|
ntoskrnl.a _imp__IoDeleteDevice@4
|
||||||
|
ndis.a _imp__NdisFreePacketPool@4
|
||||||
|
ndis.a _imp__NdisFreeBufferPool@4
|
||||||
|
ntoskrnl.a _imp__KeCancelTimer@4
|
||||||
|
ntoskrnl.a _imp__KeWaitForSingleObject@20
|
||||||
|
ntoskrnl.a _imp__KeResetEvent@4
|
||||||
|
ntoskrnl.a _imp__IoReleaseCancelSpinLock@4
|
||||||
|
ntoskrnl.a _imp__KeSetEvent@12
|
||||||
|
ntoskrnl.a _imp__IoAcquireCancelSpinLock@4
|
||||||
|
ntoskrnl.a _imp__KeInitializeEvent@12
|
||||||
|
ntoskrnl.a _imp__ExAllocatePool@8
|
||||||
|
|
Loading…
Reference in a new issue