[Winpcap-users] Capture mode limitations
Gianluca Varenni
gianluca.varenni at cacetech.com
Thu Sep 14 06:53:47 GMT 2006
----- Original Message -----
From: "Ioan Popescu" <ipopescu at dataq.com>
To: "WinPCap-Users" <winpcap-users at winpcap.org>
Sent: Wednesday, September 13, 2006 12:46 PM
Subject: [Winpcap-users] Capture mode limitations
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Is it documented anywhere what is/isn't possible during packet
> capture/statistics? For example, is it possible to set a new filter (from
> a
> different thread) after the pcap_loop() is entered? Or should everything
> occur between when the adapter is opened and the pcap_loop is entered?
The problem is not chaning a setting while pcap_loop is running. The problem
is doing that from a thread which is not the one running pcap_loop. Like
many other libraries, libpcap/WinPcap is not thread safe from this point of
view, i.e. you cannot call two pcap functions **on the same pcap_t handle**
from two different threads. Instead, you can use two different pcap_t
handles from different threads without problems.
Regarding your issue, I suggest you to use pcap_next_ex to receive packets,
and then set a new filter (or similar operations) between two calls of
pcap_next_ex, in the same thread. If you want to set a new filter from a
different thread, you need to put some sort of synchronization so that only
one thread at a time accesses the pcap_t structure (by passing it to a pcap
function).
I hope I was clear enough...
Have a nice day
GV
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (MingW32)
>
> iQIVAwUBRQhgJ3GK1KGABytRAQpjXA//TFbKzXsjrOsOxeVPAibgrk2YfhXVzvPS
> DiOLxCdhL0Gfygy0PSHEx+H5Gx3tnXDMu5ql4Wg8SnknDHcR81aw6uSN3vXSVfO3
> e6J7SAfr0W2IUgO3YI0iyvQ/p11wfTtsUqKcO9M2yKItbFVukxf56QxtTqByQbWG
> 5FOXvEVnlOuZI6LZTPId5WrAt8UOVVchFHnkIhKt7JyeDxnZTzbQb82rigztsSmD
> 8/iy4AJJgiOLqYYC6O3FA+qj39Uf/b60OgL03QfZ3erW2y0Ft+eKdzjhBy9Sb3kw
> LEt8b3GtRVtjcDEs6uKQNvCBOtPHDu4WxUpln8wFglplkNsBwsHf3MK5f3DQSHRm
> ZFH9Msw4MpCLEa4mEihpiJt7s/hUQeYWrP/tgHqJRK41UcTYlffd/yMS4svqCo/5
> QIs8FVq9FCsJ/4z3rTzHYDCYSLcydiPqZ7kxmjjSQSAwt5aRAeuhCyP/aJAAMO2x
> TV6rc9T8xrzRdRI+cLifbz9BPxH9tbVaxdIBNz62t/3WGFEDspBxFVxvwpqB3/Zk
> sbrxEYClCCW3x4l04PFLSKYQprbvXvv/Aol7stk2i9urTeOkaLQKUt4b+X+tgs93
> M68bNkYoWzgakMQgYFZtmPFSIHcADES0xu4Ooj/AgQf797DuYgWDHTqrWgxD8C25
> 0mH0RdYNrNo=
> =v5Em
> -----END PGP SIGNATURE-----
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users
More information about the Winpcap-users
mailing list