Skip to content

Commit

Permalink
Avoid getting stalled on a single large packet by truncating it. See n…
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Oct 27, 2020
1 parent 0d96997 commit 7ada24a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packetWin7/npf/npf/Read.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,22 @@ NPF_Read(
if (ulCapSize > available - copied)
{
//if the packet does not fit into the user buffer, we've ended copying packets
// Put this packet back.
ExInterlockedInsertHeadList(&Open->PacketQueue, pCapDataEntry, &Open->PacketQueueLock);
break;
if (copied == 0)
{
// This packet is too large for the entire buffer. Truncate it.
plen = available - (ulCapSize - pCapData->ulCapLen);
}
else
{
// Put this packet back.
ExInterlockedInsertHeadList(&Open->PacketQueue, pCapDataEntry, &Open->PacketQueueLock);
break;
}
}
else
{
plen = pCapData->ulCaplen;
}

plen = pCapData->ulCaplen;

header = (struct bpf_hdr *) (packp + copied);
header->bh_tstamp = pCapData->pNBCopy->pNBLCopy->tstamp;
Expand Down

0 comments on commit 7ada24a

Please sign in to comment.