]> The Tcpdump Group git mirrors - tcpdump/commitdiff
tcpdump: show error message for PCAP_ERROR_CAPTURE_NOTSUP.
authorGuy Harris <[email protected]>
Sat, 4 Jan 2025 23:29:19 +0000 (15:29 -0800)
committerGuy Harris <[email protected]>
Sun, 5 Jan 2025 17:29:59 +0000 (09:29 -0800)
If an attempt to open a capture device failed because capturing isn't
supported on that device, check whether an error message with a further
explanation was provided and, if so, report it.

(cherry picked from commit 4b7d5a255b22717afb6052645343d59669811fd6)

CHANGES
tcpdump.c

diff --git a/CHANGES b/CHANGES
index fbd9fa99337b20b8012a2eec4842f8fff5106209..b41915962b74e1e9e49756849aee2c9d00a778e0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,8 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
       PTP: Fix management packet fields.
     User interface:
       Warn that options -A, -x[x] and -X[X] are mutually exclusive.
+      For PCAP_ERROR_CAPTURE_NOTSUP, show the error message provided
+        by libpcap for that error if it's non-empty.
     Source code:
       Fix '-tt' option printing when time > 2106-02-07T06:28:15Z.
       Add sub-second packet timestamp checks for invalid micro/nano.
index 9bab8d87850044e0bb1051346bd77642c556901b..05b319b757a9c011bf2b8839f6455da64aacfe31 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1399,6 +1399,11 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
                } else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0')
                        error("%s: %s\n(%s)", device,
                            pcap_statustostr(status), cp);
+#ifdef PCAP_ERROR_CAPTURE_NOTSUP
+               else if (status == PCAP_ERROR_CAPTURE_NOTSUP && *cp != '\0')
+                       error("%s: %s\n(%s)", device,
+                           pcap_statustostr(status), cp);
+#endif
 #ifdef __FreeBSD__
                else if (status == PCAP_ERROR_RFMON_NOTSUP &&
                    strncmp(device, "wlan", 4) == 0) {