Skip to content

Commit

Permalink
Use struct bpf_stat for stats in driver
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Jan 26, 2023
1 parent e4c623c commit 2f6b16c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packetWin7/npf/npf/Packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,8 @@ static NTSTATUS funcBIOCGSTATS(_In_ POPEN_INSTANCE pOpen,
_In_ ULONG ulBufLen,
_Out_ PULONG_PTR Info)
{
static const ULONG uNeeded = 4 * sizeof(UINT);
static const ULONG uNeeded = sizeof(struct bpf_stat);
struct bpf_stat *pStats = pBuf;

*Info = 0;
if (ulBufLen < uNeeded)
Expand All @@ -1121,10 +1122,10 @@ static NTSTATUS funcBIOCGSTATS(_In_ POPEN_INSTANCE pOpen,
return STATUS_CANCELLED;
}

((PUINT)pBuf)[0] = pOpen->Received;
((PUINT)pBuf)[1] = pOpen->Dropped + pOpen->ResourceDropped;
((PUINT)pBuf)[2] = 0; // Not yet supported
((PUINT)pBuf)[3] = pOpen->Accepted;
pStats->bs_recv = pOpen->Received;
pStats->bs_drop = pOpen->Dropped + pOpen->ResourceDropped;
pStats->ps_ifdrop = 0; // Not yet supported
pStats->bs_capt = pOpen->Accepted;

NPF_StopUsingOpenInstance(pOpen, OpenDetached, NPF_IRQL_UNKNOWN);

Expand Down

0 comments on commit 2f6b16c

Please sign in to comment.