Turnaround time longer on Linux over conf.L2socket
Brief description
Packets are taking ~0.1 seconds to be received over conf.L2socket on Linux.
Scapy version
2.4.5
Python version
3.6.9
Operating system
Ubuntu 18.04.6
Additional environment information
No response
How to reproduce
Running the attached echo_demo.py file (zipped) which uses the SatCat5 python API, will print the turnaround time it takes to send and receive a message. On the Linux machine (Ubuntu 18.04.6) the turnaround time is consistently ~0.1 seconds, but Wireshark shows that the packet is actually received in less than 0.001 seconds. Running it on a Windows machine (with Npcap 1.60) shows similar results to the Wireshark output.
Actual result

Expected result

Related resources
No response
Hi, do you have the same issue if you enable
conf.use_pcap = True
on linux?
Yes these results are with it enabled. It is enabled on line 33 of satcat5_eth.py
How about with it disabled?
Disabling conf.use_pcap and changing the .nonblock_recv() to .recv() gave these results:

So it's better, but still not nearly as fast as it should be?
Yeah you're right. I'll have to check if I can reproduce..
Can you retry with master to be sure? rather than 2.4.5
I tried with master and it was the same result
Could the issue be related to this? https://www.tcpdump.org/faq.html#q15
In immediate mode libpcap receives captured packets from the OS kernel one at a time, which results in a higher CPU overhead and a more likely packet loss; in buffered mode it receives multiple packets at once, but only after the buffer is full or its timeout has expired, which might take much longer than expected
@gpotter2 any update on reproducing it?