Migrate to pcap on the datalink layer #157
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes (probably) #136
There were some wild bugs lurking here... As it turns out, my problem (and I suspect the problem others have been having) is related to a relatively obscure and poorly documented hardware feature of modern network cards: offloading. In my particular case, generic receive offload (gro) is what led to netmap (a backend of the pnet backend of Bandwhich) dropping packets for being too large (because gro merges many packets before passing them to the operating system).
The first solution was turning off this feature and related "offload" features using
ethtool
:# ethtool -K eth0 tx off rx off gso off tso off gro off lro off
Obviously though, that's a hacky workaround and other programs are able to read these packets correctly! As it turns out, pnet has many available backends, so I gave a couple a try. Unfortunately the
linux
backend had the same issue asnetmap
, but luckily, thepcap
backend could gracefully handle these merged packets!I needed to enable the
pcap
feature ofpnet
, but now things are reporting correctly for both upload and download (for me at least)!