diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-02-20 18:48:27 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-02-25 17:33:02 -0800 |
commit | 0a71e0c52e95454564b2327cdc808443afb08ca2 (patch) | |
tree | f8f8940c3b5c0b1edf6c1b25f75d711a67e88abc | |
parent | a2cdefc4d5801212a337efa76de03dda2c79d37a (diff) | |
download | libpcap-0a71e0c52e95454564b2327cdc808443afb08ca2.tar.gz |
Check for Wi-Fi interfaces and don't offer DOCSIS on them.
-rw-r--r-- | pcap-linux.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index ff5de850..b5b35aad 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -2572,7 +2572,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, const char *device, } /* - * This is (presumably) a real Ethernet capture; give it a + * Is this a real Ethernet device? If so, give it a * link-layer-type list with DLT_EN10MB and DLT_DOCSIS, so * that an application can let you choose it, in case you're * capturing DOCSIS traffic that a Cisco Cable Modem @@ -2586,16 +2586,27 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, const char *device, * a Cisco CMTS won't put traffic onto it or get traffic * bridged onto it? ISDN is handled in "activate_new()", * as we fall back on cooked mode there; are there any - * others? + * others, and we handle 802.11 devices by using + * pcap_can_set_rfmon_linux(); are there any others?? */ - handle->dlt_list = (u_int *) malloc(sizeof(u_int) * 2); - /* - * If that fails, just leave the list empty. - */ - if (handle->dlt_list != NULL) { - handle->dlt_list[0] = DLT_EN10MB; - handle->dlt_list[1] = DLT_DOCSIS; - handle->dlt_count = 2; +#ifdef IW_MODE_MONITOR + if (has_wext(handle->fd, device, handle->errbuf) != 1) { + /* + * It supports the wireless extensions, so it's a Wi-Fi + * device; don't offer DOCSIS. + */ + } else +#endif + { + handle->dlt_list = (u_int *) malloc(sizeof(u_int) * 2); + /* + * If that fails, just leave the list empty. + */ + if (handle->dlt_list != NULL) { + handle->dlt_list[0] = DLT_EN10MB; + handle->dlt_list[1] = DLT_DOCSIS; + handle->dlt_count = 2; + } } /* FALLTHROUGH */ |