From: Guy Harris Date: Sat, 4 Jan 2025 23:29:19 +0000 (-0800) Subject: tcpdump: show error message for PCAP_ERROR_CAPTURE_NOTSUP. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/9556b0ed4c5bf6871054b711b18985ae92498292 tcpdump: show error message for PCAP_ERROR_CAPTURE_NOTSUP. 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) --- diff --git a/CHANGES b/CHANGES index fbd9fa99..b4191596 100644 --- 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. diff --git a/tcpdump.c b/tcpdump.c index 9bab8d87..05b319b7 100644 --- 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) {