You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am maintaining a C++ application using libpcap 0.9.8. A process receiving MAC/LLC data from the network crashes randomly on a call to pcap_next or pcap_open_live after a call to pcap_close.
To isolate the problem i wrote a small program that creates threads that receive data with pcap next. The main thread calls pcap_close while the other threads are calling pcap_next.
When I execute the program, sometimes it finishes without error, sometimes it crashed on pcap_next.
Is this a bug of this version (0.9.8) of libpcap or am I not supposed to call pcap_close while a thread is calling pcap_next ?
Here is the source code :
The text was updated successfully, but these errors were encountered:
lalibpcapcamarchepas
changed the title
Segmentation fault on pcap_next with libpcap 0.8.9
Segmentation fault on pcap_next with libpcap 0.9.8
Nov 20, 2017
There were a few similar reports, AFAIR, they ended up as either a bug in the main software (not libpcap) or a bug specific to an old libpcap version (recent libpcap is thread-safe).
or am I not supposed to call pcap_close while a thread is calling pcap_next
You are definitely not supposed to be calling pcap_close() on a pcap_t * while another thread is calling pcap_next() - or any other libpcap function! - on the same pcap_t *.
There is no thread interlocking in a pcap_t. Once you've gotten a pcap_t *, use it only within one thread.
Once you've gotten a pcap_t *, use it only within one thread.
...which means that, once you've started a thread to read from that pcap_t *, do NOT do anything with that pcap_t *, other than perhaps calling pcap_breakloop() or making calls to fetch data such as its selectable descriptor on UN*X or its event handle on Windows, until the thread reading from that pcap_t * has indicated that it's done with the pcap_t * (e.g., by exiting).
Hello,
I am maintaining a C++ application using libpcap 0.9.8. A process receiving MAC/LLC data from the network crashes randomly on a call to pcap_next or pcap_open_live after a call to pcap_close.
To isolate the problem i wrote a small program that creates threads that receive data with pcap next. The main thread calls pcap_close while the other threads are calling pcap_next.
When I execute the program, sometimes it finishes without error, sometimes it crashed on pcap_next.
Is this a bug of this version (0.9.8) of libpcap or am I not supposed to call pcap_close while a thread is calling pcap_next ?
Here is the source code :
The text was updated successfully, but these errors were encountered: