aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2023-01-10 00:24:10 -0800
committerGuy Harris <gharris@sonic.net>2023-01-10 00:36:16 -0800
commit1962e7e8d12a8a2b434257ad965879934970d709 (patch)
treec4244bfb8103f005b5a3c58d6400f6617afa1ef7
parent16de5e6b4c24de40d3ae5e2cd000b57fe5e51f19 (diff)
downloadlibpcap-1962e7e8d12a8a2b434257ad965879934970d709.tar.gz
NPF: fix build, update comments.
The MS Surface Pro's mobile broadband driver appears to be returning NDIS_STATUS_NOT_SUPPORTED for all attempts to set the hardware filter, whether promiscuous mode is on or off. Update the comments to reflect that, and fix a remaining check against NPF_SURFACE_MOBILE_NONPROMISC. (cherry picked from commit 88926013e35cd3999c9cdd029c491c535496d261)
-rw-r--r--pcap-npf.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/pcap-npf.c b/pcap-npf.c
index c531a393..62c526d9 100644
--- a/pcap-npf.c
+++ b/pcap-npf.c
@@ -1003,16 +1003,10 @@ pcap_breakloop_npf(pcap_t *p)
*
* but I don't know why the goal was to avoid that translation.
*
- * Attempting to set non-promiscuous mode on a Microsoft Surface Pro's
+ * Attempting to set the hardware filter on a Microsoft Surface Pro's
* Mobile Broadband Adapter returns an error that appears to be
* NDIS_STATUS_NOT_SUPPORTED ORed with the "Customer" bit, so it's
- * probably indicating that it doesn't support promiscuous mode,
- * as one might expect, given that it's not going to promiscuously
- * snoop for arbitrary mobile telecom network packets. That error can
- * safely be ignored, as it's always in non-promiscuous mode; an
- * alternative would be to report the PCAP_WARNING_PROMISC_NOTSUP
- * warning, which indicates that the activate call succeeded but
- * that something happened that the user might want to know about.
+ * probably indicating that it doesn't support that.
*
* It is likely that there are other devices which throw spurious errors,
* at which point this will need refactoring to efficiently check against
@@ -1310,14 +1304,13 @@ pcap_activate_npf(pcap_t *p)
/*
* Suppress spurious error generated by non-compiant
- * MS Surface mobile adapters.
+ * MS Surface mobile adapters that appear to
+ * return NDIS_STATUS_NOT_SUPPORTED for attempts
+ * to set the hardware filter.
*
- * It appears to be reporting STATUS_NOT_SUPPORTED
- * (ndis.h defines NDIS_STATUS_NOT_SUPPORTED to
- * have the same value as the NT status value
- * STATUS_NOT_SUPPORTED), but with the NT status
- * value "Customer" bit set, probably by the
- * Npcap NPF driver.
+ * It appears to be reporting NDIS_STATUS_NOT_SUPPORTED,
+ * but with the NT status value "Customer" bit set;
+ * the Npcap NPF driver sets that bit in some cases.
*
* If we knew that this meant "promiscuous mode
* isn't supported", we could add a "promiscuous
@@ -1380,7 +1373,7 @@ pcap_activate_npf(pcap_t *p)
* Suppress spurious error generated by non-compiant
* MS Surface mobile adapters.
*/
- if (errcode != NPF_SURFACE_MOBILE_NONPROMISC)
+ if (errcode != (NDIS_STATUS_NOT_SUPPORTED|NT_STATUS_CUSTOMER_DEFINED))
{
pcap_fmt_errmsg_for_win32_err(p->errbuf,
PCAP_ERRBUF_SIZE, errcode,