mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-06-16 21:10:57 +08:00
Disable TPACKET v3 to prevent packets reordering in root mode
It seems like TPACKET V3 causes packet reordering issues, where a packet A sent before a packet B by the same host is actually seen after B in the capture. This causes inexistent out-of-order and missing TCP segments issues in Wireshark. This has been verified by comparing the PCAP dump generated by PCAPdroid in HTTP server mode with the traffic dump on the LAN, thus excluding reordering occuring over the Internet.
This commit is contained in:
parent
5e9be5cd8b
commit
f715c06be1
@ -417,7 +417,19 @@ static int open_interface(pcapd_iface_t *iface, pcapd_runtime_t *rt, const char
|
||||
/* The snaplen includes the datalink overhead. Max datalink overhead (SLL2): 20 B */
|
||||
int snaplen = mtu + SLL2_HDR_LEN;
|
||||
|
||||
pcap_t *pd = pcap_open_live(ifname, snaplen, 0, 1, errbuf);
|
||||
// pcap_set_immediate_mode necessary to avoid using TPACKET v3, which sometimes causes packets
|
||||
// reordering in the capture
|
||||
pcap_t *pd;
|
||||
if(!(pd = pcap_create(ifname, errbuf)) ||
|
||||
pcap_set_immediate_mode(pd, 1) ||
|
||||
pcap_set_snaplen(pd, snaplen) ||
|
||||
pcap_activate(pd)) {
|
||||
if(pd) {
|
||||
pcap_close(pd);
|
||||
pd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!pd) {
|
||||
// try to open as file
|
||||
pd = pcap_open_offline(ifname, errbuf);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user