From: Guy Harris Date: Tue, 1 May 2018 07:32:32 +0000 (-0700) Subject: Don't mark loopback devices as "connection status unknown". X-Git-Tag: libpcap-1.9-bp~58 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/ff647f1d116edaff3006ea0f99dd07b9b74622e6?ds=sidebyside Don't mark loopback devices as "connection status unknown". It's not unknown, it's *inapplicable*. --- diff --git a/pcap-bpf.c b/pcap-bpf.c index e06f8073..9f4c62b5 100644 --- a/pcap-bpf.c +++ b/pcap-bpf.c @@ -2804,8 +2804,22 @@ static int get_if_flags(const char *name _U_, bpf_u_int32 *flags _U_, char *errbuf _U_) { /* - * Nothing we can do. + * Nothing we can do other than mark loopback devices as "the + * connected/disconnected status doesn't apply". + * + * XXX - on Solaris, can we do what the dladm command does, + * i.e. get a connected/disconnected indication from a kstat? + * (Note that you can also get the link speed, and possibly + * other information, from a kstat as well.) */ + if (*flags & PCAP_IF_LOOPBACK) { + /* + * Loopback devices aren't wireless, and "connected"/ + * "disconnected" doesn't apply to them. + */ + *flags |= PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE; + return (0); + } return (0); } #endif