From: Guy Harris Date: Tue, 10 Jan 2023 08:24:10 +0000 (-0800) Subject: NPF: fix build, update comments. X-Git-Tag: libpcap-1.10.3~3 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/1962e7e8d12a8a2b434257ad965879934970d709 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) --- 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,