diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-04-29 15:02:09 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-04-29 15:02:09 -0700 |
commit | 38fe5d4033c4e49b414617473aa581a75873fc89 (patch) | |
tree | f87da023892e1eb2d06cbe981a2e473fc3f82ddd /pcap-snf.c | |
parent | e3a28bfcb200115ef541c0eda3d9b3ae2136e4c5 (diff) | |
download | libpcap-38fe5d4033c4e49b414617473aa581a75873fc89.tar.gz |
Add more interface flags to pcap_findalldevs().
We add:
PCAP_IF_WIRELESS, which indicates whether the interface is "wireless" or
not.
PCAP_IF_CONNECTION_STATUS, which is a bitmask for a two-bit field that
can have one of the values:
PCAP_IF_CONNECTION_STATUS_UNKNOWN if the status of whether the interface
is "connected" or "disconnected" is unknown;
PCAP_IF_CONNECTION_STATUS_CONNECTED if the interface is "connected";
PCAP_IF_CONNECTION_STATUS_DISCONNECTED if the interface is
"disconnected";
PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE if the notion of "connected" or
"disconnected" doesn't apply to this interface.
Take that into account when sorting interfaces in the interface list,
penalizing "disconnected" interfaces, as you won't see traffic on them
if they're not wireless and you'd have to be in some form of "monitor
mode" to see traffic on them if they're wireless.
This should address GitHub issue #700.
Diffstat (limited to 'pcap-snf.c')
-rw-r--r-- | pcap-snf.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -439,6 +439,12 @@ snf_findalldevs(pcap_if_list_t *devlistp, char *errbuf) } else { /* * No. Add an entry for it. + * + * XXX - is there a notion of "up" or "running", + * and can we determine whether something's + * plugged into the adapter and set + * PCAP_IF_CONNECTION_STATUS_CONNECTED or + * PCAP_IF_CONNECTION_STATUS_DISCONNECTED? */ dev = add_dev(devlistp, ifa->snf_ifa_name, 0, desc, errbuf); @@ -481,7 +487,18 @@ snf_findalldevs(pcap_if_list_t *devlistp, char *errbuf) (void)pcap_snprintf(name,MAX_DESC_LENGTH,"snf%d",allports); (void)pcap_snprintf(desc,MAX_DESC_LENGTH,"Myricom Merge Bitmask All Ports snf%d", allports); - if (add_dev(devlistp, name, 0, desc, errbuf) == NULL) + /* + * XXX - is there any notion of "up" and "running" that + * would apply to this device, given that it handles + * multiple ports? + * + * Presumably, there's no notion of "connected" vs. + * "disconnected", as "is this plugged into a network?" + * would be a per-port property. + */ + if (add_dev(devlistp, name, + PCAP_IF_CONNECTION_STATUS_NOT_APPLICABLE, desc, + errbuf) == NULL) return (-1); /* * XXX - should we give it a list of addresses with all |