Fix compile error on libpcap < 1.9.0

This commit is contained in:
paldier 2022-11-01 13:44:07 +08:00 committed by GitHub
parent 25e2364930
commit d85c5a766e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -586,6 +586,7 @@ bool ethsock_is_wifi(struct ethsock *sock)
bool ethsock_is_unplugged(struct ethsock *sock) bool ethsock_is_unplugged(struct ethsock *sock)
{ {
#ifdef PCAP_IF_WIRELESS
bpf_u_int32 flags; bpf_u_int32 flags;
if (!intf_get_pcap_flags(sock->intf, &flags)) { if (!intf_get_pcap_flags(sock->intf, &flags)) {
@ -593,6 +594,10 @@ bool ethsock_is_unplugged(struct ethsock *sock)
} }
return flags & PCAP_IF_CONNECTION_STATUS_DISCONNECTED; return flags & PCAP_IF_CONNECTION_STATUS_DISCONNECTED;
#else
#warning "libpcap version is < 1.9.0"
return false;
#endif
} }
struct ethsock *ethsock_create(const char *intf, uint16_t protocol) struct ethsock *ethsock_create(const char *intf, uint16_t protocol)