aboutsummaryrefslogtreecommitdiff
path: root/pcap-npf.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2022-01-06 14:42:16 -0800
committerGuy Harris <gharris@sonic.net>2022-01-06 14:42:16 -0800
commit1a37338725ba1796ed9d986139e304dd64cd8b14 (patch)
tree693a9680d04dc43d059066d4e96f3b986544653a /pcap-npf.c
parent95edc89b0414793d7879978dfece055aee967799 (diff)
npcap: squelch deprecation warnings for kernel dump mode.
If we're building with Npcap, just have the dump mode routines return an error with a message indicating that kernel dump mode isn't supported. [skip cirrus]
Diffstat (limited to 'pcap-npf.c')
-rw-r--r--pcap-npf.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/pcap-npf.c b/pcap-npf.c
index e385b2ac..0f90b36a 100644
--- a/pcap-npf.c
+++ b/pcap-npf.c
@@ -445,6 +445,31 @@ pcap_setuserbuffer_npf(pcap_t *p, int size)
return (0);
}
+#ifdef HAVE_NPCAP_PACKET_API
+/*
+ * Kernel dump mode isn't supported in Npcap; calls to PacketSetDumpName(),
+ * PacketSetDumpLimits(), and PacketIsDumpEnded() will get compile-time
+ * deprecation warnings.
+ *
+ * Avoid calling them; just return errors indicating that kernel dump
+ * mode isn't supported in Npcap.
+ */
+static int
+pcap_live_dump_npf(pcap_t *p, char *filename _U_, int maxsize _U_,
+ int maxpacks _U_)
+{
+ snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+ "Npcap doesn't support kernel dump mode");
+ return (-1);
+}
+static int
+pcap_live_dump_ended_npf(pcap_t *p, int sync)
+{
+ snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+ "Npcap doesn't support kernel dump mode");
+ return (-1);
+}
+#else /* HAVE_NPCAP_PACKET_API */
static int
pcap_live_dump_npf(pcap_t *p, char *filename, int maxsize, int maxpacks)
{
@@ -485,6 +510,7 @@ pcap_live_dump_ended_npf(pcap_t *p, int sync)
return (PacketIsDumpEnded(pw->adapter, (BOOLEAN)sync));
}
+#endif /* HAVE_NPCAP_PACKET_API */
#ifdef HAVE_AIRPCAP_API
static PAirpcapHandle