forked from the-tcpdump-group/libpcap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set socket protocol only after packet ring configured
When using the memory mapped packet receive path on Linux, we find that if the buffer is "large" we get a number of dropped packets. This number of packets is roughly proportional to the buffer size. It turns out that these packets are dropped by the kernel in the time period between the socket being opened and the ring parameter setup completing (this is where the kernel has to allocate the buffer memory). To prevent this, we can open the socket on protocol 0, which the kernel interprets to mean that we don't want to receive any packets at all (this is described when opening a memory mapped packet socket for TX only). We then set the correct protocol once everything is configured. Signed-off-by: Mark Marshall <[email protected]>
- Loading branch information
Mark Marshall
committed
Nov 19, 2019
1 parent
bf0a7f8
commit 97f59a7
Showing
1 changed file
with
49 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters