Skip to content

Commit 4b7d5a2

Browse files
committed
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.
1 parent 9781ab8 commit 4b7d5a2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
9898
PTP: Fix management packet fields.
9999
User interface:
100100
Warn that options -A, -x[x] and -X[X] are mutually exclusive.
101+
For PCAP_ERROR_CAPTURE_NOTSUP, show the error message provided
102+
by libpcap for that error if it's non-empty.
101103
Source code:
102104
Fix '-tt' option printing when time > 2106-02-07T06:28:15Z.
103105
Add sub-second packet timestamp checks for invalid micro/nano.

tcpdump.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,11 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
13461346
} else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0')
13471347
error("%s: %s\n(%s)", device,
13481348
pcap_statustostr(status), cp);
1349+
#ifdef PCAP_ERROR_CAPTURE_NOTSUP
1350+
else if (status == PCAP_ERROR_CAPTURE_NOTSUP && *cp != '\0')
1351+
error("%s: %s\n(%s)", device,
1352+
pcap_statustostr(status), cp);
1353+
#endif
13491354
#ifdef __FreeBSD__
13501355
else if (status == PCAP_ERROR_RFMON_NOTSUP &&
13511356
strncmp(device, "wlan", 4) == 0) {

0 commit comments

Comments
 (0)