Fix ethsock_is_unplugged
It would return `true`, even if the status was actually `PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE`.
This commit is contained in:
parent
ae9d8fa325
commit
dab3625db4
1 changed files with 3 additions and 2 deletions
|
|
@ -586,14 +586,15 @@ bool ethsock_is_wifi(struct ethsock *sock)
|
|||
|
||||
bool ethsock_is_unplugged(struct ethsock *sock)
|
||||
{
|
||||
#ifdef PCAP_IF_WIRELESS
|
||||
#ifdef PCAP_IF_CONNECTION_STATUS
|
||||
bpf_u_int32 flags;
|
||||
|
||||
if (!intf_get_pcap_flags(sock->intf, &flags)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return flags & PCAP_IF_CONNECTION_STATUS_DISCONNECTED;
|
||||
return (flags & PCAP_IF_CONNECTION_STATUS)
|
||||
== PCAP_IF_CONNECTION_STATUS_DISCONNECTED;
|
||||
#else
|
||||
#warning "libpcap version is < 1.9.0"
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue