]> The Tcpdump Group git mirrors - libpcap/commitdiff
NPF: fix build, update comments.
authorGuy Harris <[email protected]>
Tue, 10 Jan 2023 08:24:10 +0000 (00:24 -0800)
committerGuy Harris <[email protected]>
Tue, 10 Jan 2023 08:36:16 +0000 (00:36 -0800)
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)

pcap-npf.c

index c531a39365a7e89fc3aa952041b3eff329bc2fda..62c526d923ad288fc19d76633e1a34c22846bb78 100644 (file)
@@ -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,