Closed erlbeck closed 3 years ago
Older versions of libpcap don't seem to have PCAP_IF_CONNECTION_STATUS
diff --git a/c_src/epcap.c b/c_src/epcap.c
index b5edf49..3d8dd7c 100644
--- a/c_src/epcap.c
+++ b/c_src/epcap.c
@@ -396,8 +396,10 @@ static int epcap_open(EPCAP_STATE *ep) {
if (!(flags & PCAP_IF_UP) || !(flags & PCAP_IF_RUNNING))
continue;
+#ifdef PCAP_IF_CONNECTION_STATUS_DISCONNECTED
if ((flags & PCAP_IF_CONNECTION_STATUS) == PCAP_IF_CONNECTION_STATUS_DISCONNECTED)
continue;
+#endif
if (!(flags & PCAP_IF_LOOPBACK))
/* found */
Oops, I didn't want to include that chunk into the commit. Even if keeping that, it should go into another commit.
Other than intended, this PR changes the behaviour on non-Linux platforms which I wanted to avoid.
I have changed the first commit to set the immediate mode by default. The -I epcap CLI option now has a numeric value which is used to disable (0) or enable (1) the immediate mode. The value of the 'immediate' option is translated accordingly.
The chunk related to pcap_findalldevs is now removed.
Documentation on the 'timeout' option has been added.
Currently the test suite does not run successfully on Linux 5.4.0 / libpcap 1.9.1 due to timeouts.
There is also no way to force the immediate mode in a portable way (the closest would be {timeout, 1}).
Add an option 'immediate' ('-I' in epcap's CLI) to explicitly set libpcap's immediate mode and use it in the test suite instead of relying on the default timeout settings.