summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-02-20 18:48:27 -0800
committerGuy Harris <guy@alum.mit.edu>2015-02-25 17:19:25 -0800
commit6f914c8808a7daf306dfe20a89c0abcba968c45c (patch)
tree9dd0cf827bdf9c5a12a3feefee51d2f76d3b7a94
parenteef78a7e69c8c6e9cb5818d5adcec8f7e47a3078 (diff)
downloadlibpcap-6f914c8808a7daf306dfe20a89c0abcba968c45c.tar.gz
Check for Wi-Fi interfaces and don't offer DOCSIS on them.
-rw-r--r--pcap-linux.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 4e945191..fd615bd0 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -2605,7 +2605,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
@@ -2619,16 +2619,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 */