Skip to content

Commit ef7ab72

Browse files
committed
Conditionally use NETMASK_UNKNOWN or 0 for pcap_compile().
What we should do depends on the libpcap version, so try to adjust.
1 parent a43add4 commit ef7ab72

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pcap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,13 @@ static int lpcap_dump_open(lua_State *L)
315315
return 1;
316316
}
317317

318-
318+
/* Current libpcap says to use PCAP_NETMASK_UNKNOWN if you don't know the
319+
netmask, older libpcaps says to use 0, so we do one or the other
320+
depending on whether the macro exists.
321+
*/
322+
#ifndef PCAP_NETMASK_UNKNOWN
323+
# define PCAP_NETMASK_UNKNOWN 0
324+
#endif
319325
/*-
320326
-- cap = cap:set_filter(filter, nooptimize)
321327

0 commit comments

Comments
 (0)