pcap_next_ex does not time out
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libpcap |
New
|
Unknown
|
|||
libpcap (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
$ lsb_release -rd
Description: Ubuntu 18.04.2 LTS
Release: 18.04
$ apt-cache policy libpcap0.8
libpcap0.8:
Installiert: 1.8.1-6ubuntu1
Installations
Versionstabelle:
*** 1.8.1-6ubuntu1 500
500 http://
100 /var/lib/
I have a tool that opens the local LAN interfaces via pcap_open_live with a timeout of 1 ms and then reads from all interfaces. The tool used to work on Ubuntu 16.04 but hangs on Ubuntu 18.04.
When using libpcap0.8 1.7.4-2 (https:/
Comparing the sources at https:/
Please find attached a small program that you can compile and run with "g++ pcap_test.cpp -lpcap; sudo ./a.out". On a working Ubuntu/pcap when opening an interface without traffic we see 42 times that pcap_next_ex returns 0 (timeout, no packet available). In case of the malfunction the program waits until a packet is available and the program either outputs no pcap_next_ex return (no packets received) or it outputs that pcap_next_ex returns 1 (one packet read).
Attaching gdb to the hanging program show this backtrace (after "sudo apt install libpcap0.8-dbg"):
#0 0x00007f3335fd5bc4 in __GI___poll (fds=fds@
#1 0x00007f33364d09da in poll (__timeout=
#2 pcap_wait_
#3 0x00007f33364d0c05 in pcap_read_
#4 0x00007f33364d866a in pcap_next_ex (p=<optimized out>, pkt_header=
poll with timeout=-1 waits without timeout, so blocks until a packet is read. Comments in the function for calculating the poll-timeout suggest that this is OK and that TPACKET3 is taking care of handling the timeout, but not having heard of TPACKET3 before I have no idea how that could/should work.
tags: | added: server-triage-discuss |
Changed in libpcap: | |
status: | Unknown → New |
Status changed to 'Confirmed' because the bug affects multiple users.