Skip to content

Commit

Permalink
Revert "Merge branch 'master' of https://github.com/nmap/npcap"
Browse files Browse the repository at this point in the history
This reverts commit 25e414d, reversing
changes made to a8e348d.
  • Loading branch information
fyodor committed Aug 24, 2020
1 parent 25e414d commit 5eb74e3
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 108 deletions.
12 changes: 2 additions & 10 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ are not permitted by applicable laws, these express or implied
restrictions shall remain in force and effect to the maximum extent
permitted by such applicable laws.

THIRD PARTY SOFTWARE ATTRIBUTION
WINPCAP & LIBPCAP ATTRIBUTION

Some of the Npcap code is originally from WinPcap software
(http://www.winpcap.org/). See
Expand All @@ -209,15 +209,7 @@ for further information and attribution related to that.

Npcap also includes and depends on the Libpcap packet capturing
library, which is under a 3-clause BSD license allowing free
redistribution and use in other software. The Libpcap license
including attribution and warranty disclaimer statements can be
redistribution and use in other software. The Libpcap license can be
found at:
https://github.com/nmap/npcap/blob/master/Libpcap-License.txt

Finally Npcap includes code from David Young in the
ieee80211_radiotap.h header file. This code is also under a 3-clause
BSD license allowing free redistribution and use in other software.
The copyright, attribution, and warranty disclaimer statements can be
found in the file itself (search for "David Young") at:
https://github.com/nmap/npcap/blob/master/packetWin7/npf/npf/ieee80211_radiotap.h

8 changes: 6 additions & 2 deletions packetWin7/npf/npf/Openclos.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ _Use_decl_annotations_
VOID NPF_ReturnNBCopies(PNPF_NB_COPIES pNBCopy, PDEVICE_EXTENSION pDevExt)
{
PBUFCHAIN_ELEM pDeleteMe = NULL;
// FirstElem is not separately allocated
PBUFCHAIN_ELEM pElem = pNBCopy->FirstElem.Next;
PBUFCHAIN_ELEM pElem = pNBCopy->pFirstElem;
#if DBG
PBUFCHAIN_ELEM pLastElem = pNBCopy->pLastElem;
#endif
ULONG refcount = InterlockedDecrement(&pNBCopy->refcount);

if (refcount == 0)
Expand All @@ -430,6 +432,8 @@ VOID NPF_ReturnNBCopies(PNPF_NB_COPIES pNBCopy, PDEVICE_EXTENSION pDevExt)
{
pDeleteMe = pElem;
pElem = pElem->Next;
// Either there's another after this or this is the last one
ASSERT(pElem || pLastElem == pDeleteMe);
ExFreeToLookasideListEx(&pDevExt->BufferPool, pDeleteMe);
}
}
Expand Down
11 changes: 0 additions & 11 deletions packetWin7/npf/npf/Packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,6 @@ DriverEntry(
}
devExtP->bNBCopiesPoolInit = 1;

Status = ExInitializeLookasideListEx(&devExtP->SrcNBPool, NULL, NULL, NonPagedPool, 0, sizeof(NPF_SRC_NB), NPF_SRCNB_POOL_TAG, 0);
if (Status != STATUS_SUCCESS)
{
TRACE_MESSAGE(PACKET_DEBUG_LOUD, "Failed to allocate SrcNBPool");
break;
}
devExtP->bSrcNBPoolInit = 1;

Status = ExInitializeLookasideListEx(&devExtP->InternalRequestPool, NULL, NULL, NonPagedPool, 0, sizeof(INTERNAL_REQUEST), NPF_REQ_POOL_TAG, 0);
if (Status != STATUS_SUCCESS)
{
Expand Down Expand Up @@ -539,8 +531,6 @@ DriverEntry(
ExDeleteLookasideListEx(&devExtP->NBCopiesPool);
if (devExtP->bNBLCopyPoolInit)
ExDeleteLookasideListEx(&devExtP->NBLCopyPool);
if (devExtP->bSrcNBPoolInit)
ExDeleteLookasideListEx(&devExtP->SrcNBPool);
if (devExtP->bBufferPoolInit)
ExDeleteLookasideListEx(&devExtP->BufferPool);
if (devExtP->AllOpensLock)
Expand Down Expand Up @@ -1001,7 +991,6 @@ Return Value:
ExDeleteLookasideListEx(&DeviceExtension->BufferPool);
ExDeleteLookasideListEx(&DeviceExtension->NBLCopyPool);
ExDeleteLookasideListEx(&DeviceExtension->NBCopiesPool);
ExDeleteLookasideListEx(&DeviceExtension->SrcNBPool);
ExDeleteLookasideListEx(&DeviceExtension->InternalRequestPool);
ExDeleteLookasideListEx(&DeviceExtension->CapturePool);
#ifdef HAVE_DOT11_SUPPORT
Expand Down
27 changes: 6 additions & 21 deletions packetWin7/npf/npf/Packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,8 @@ typedef struct _DEVICE_EXTENSION
PDEVICE_OBJECT pDevObj; // pointer to the DEVICE_OBJECT for this device

LOOKASIDE_LIST_EX BufferPool; // Pool of BUFCHAIN_ELEM to hold capture data temporarily.
LOOKASIDE_LIST_EX NBLCopyPool; // Pool of NPF_NBL_COPY, NPF_NB_COPIES, NPF_SRC_NB objects
LOOKASIDE_LIST_EX NBLCopyPool; // Pool of NPF_NBL_COPY objects
LOOKASIDE_LIST_EX NBCopiesPool; // Pool of NPF_NB_COPIES objects
LOOKASIDE_LIST_EX SrcNBPool; // Pool of NPF_SRC_NB objects
LOOKASIDE_LIST_EX InternalRequestPool; // Pool of INTERNAL_REQUEST structures that wrap every single OID request.
LOOKASIDE_LIST_EX CapturePool; // Pool of NPF_CAP_DATA objects
#ifdef HAVE_DOT11_SUPPORT
Expand All @@ -277,7 +276,6 @@ typedef struct _DEVICE_EXTENSION
UCHAR bBufferPoolInit:1;
UCHAR bNBLCopyPoolInit:1;
UCHAR bNBCopiesPoolInit:1;
UCHAR bSrcNBPoolInit:1;
UCHAR bInternalRequestPoolInit:1;
UCHAR bCapturePoolInit:1;
UCHAR bDot11HeaderPoolInit:1;
Expand Down Expand Up @@ -475,30 +473,17 @@ typedef struct _BUFCHAIN_ELEM
/* This is like a lower-overhead version of NET_BUFFER based on BUFCHAIN_ELEM instead of MDL */
typedef struct _NPF_NB_COPIES
{
SINGLE_LIST_ENTRY CopiesEntry;
PNPF_NBL_COPY pNBLCopy;
PBUFCHAIN_ELEM pFirstElem; // Bufchain of packet data
PBUFCHAIN_ELEM pLastElem; // Last elem in the chain
PMDL pSrcCurrMdl; // MDL where we left off copying from the source NET_BUFFER
ULONG ulCurrMdlOffset; // Position in that MDL.
ULONG ulSize; //Size of all used space in the bufchain.
ULONG ulPacketSize; // Size of the original packet
ULONG refcount;
BUFCHAIN_ELEM FirstElem; // Bufchain of packet data
} NPF_NB_COPIES, *PNPF_NB_COPIES;

typedef struct _NPF_SRC_NB
{
SINGLE_LIST_ENTRY CopiesEntry;
PNPF_NB_COPIES pNBCopy;
PBUFCHAIN_ELEM pLastElem; // Last elem in the chain
PMDL pSrcCurrMdl; // MDL where we left off copying from the source NET_BUFFER
ULONG ulCurrMdlOffset; // Position in that MDL.
} NPF_SRC_NB, *PNPF_SRC_NB;

// so we can use the same lookaside list for all these things
typedef union _NPF_NB_STORAGE
{
NPF_NBL_COPY NBLCopy;
NPF_SRC_NB SrcNB;
NPF_NB_COPIES NBCopy;
} NPF_NB_STORAGE, *PNPF_NB_STORAGE;

/* Structure of a captured packet data description */
typedef struct _NPF_CAP_DATA
{
Expand Down
Loading

0 comments on commit 5eb74e3

Please sign in to comment.