diff options
author | Thomas Habets <thomas@habets.se> | 2022-10-26 21:24:58 +0100 |
---|---|---|
committer | Thomas Habets <thomas@habets.se> | 2022-10-26 21:24:58 +0100 |
commit | 0da7a471f16fca6eabf9c8884566c91a1e753659 (patch) | |
tree | 69450ddf71dbce50c9417d3e585cae5c1e6617be | |
parent | af1ef6bc2438c34733762dd935e912d5cba78a7a (diff) | |
download | arping-0da7a471f16fca6eabf9c8884566c91a1e753659.tar.gz |
Use PCAP_NETMASK_UNKNOWN, where available
-rw-r--r-- | src/arping.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/arping.c b/src/arping.c index a99f05d..041d9b9 100644 --- a/src/arping.c +++ b/src/arping.c @@ -150,6 +150,10 @@ #define UNUSED(x) (void)(x) +#ifndef PCAP_NETMASK_UNKNOWN +#define PCAP_NETMASK_UNKNOWN 0xffffffff +#endif + /** * OS-specific interface finding using routing table. See findif_*.c * ebuf must be called with a size of at least @@ -2478,7 +2482,8 @@ arping_main(int argc, char **argv) } else { snprintf(bpf_filter, sizeof(bpf_filter), "arp"); } - if (-1 == pcap_compile(pcap, &bp, bpf_filter, 0, -1)) { + if (-1 == pcap_compile(pcap, &bp, bpf_filter, 0, + PCAP_NETMASK_UNKNOWN)) { fprintf(stderr, "arping: pcap_compile(%s): %s\n", bpf_filter, pcap_geterr(pcap)); exit(1); @@ -2491,7 +2496,8 @@ arping_main(int argc, char **argv) } else { snprintf(bpf_filter, sizeof(bpf_filter), "icmp"); } - if (-1 == pcap_compile(pcap, &bp, bpf_filter, 0,-1)) { + if (-1 == pcap_compile(pcap, &bp, bpf_filter, 0, + PCAP_NETMASK_UNKNOWN)) { fprintf(stderr, "arping: pcap_compile(%s): %s\n", bpf_filter, pcap_geterr(pcap)); exit(1); |