summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/tcpdump/tcpdump.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c
index 7cfcc68..48b774d 100644
--- a/contrib/tcpdump/tcpdump.c
+++ b/contrib/tcpdump/tcpdump.c
@@ -71,6 +71,8 @@ extern int SIZE_BUF;
#ifdef __FreeBSD__
#include <sys/capability.h>
#include <sys/ioccom.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
#include <net/bpf.h>
#include <fcntl.h>
#include <libgen.h>
@@ -1307,6 +1309,27 @@ main(int argc, char **argv)
*cp != '\0')
error("%s: %s\n(%s)", device,
pcap_statustostr(status), cp);
+#ifdef __FreeBSD__
+ else if (status == PCAP_ERROR_RFMON_NOTSUP &&
+ strncmp(device, "wlan", 4) == 0) {
+ char parent[8], newdev[8];
+ char sysctl[32];
+ size_t s = sizeof(parent);
+
+ snprintf(sysctl, sizeof(sysctl),
+ "net.wlan.%d.%%parent", atoi(device + 4));
+ sysctlbyname(sysctl, parent, &s, NULL, 0);
+ strlcpy(newdev, device, sizeof(newdev));
+ /* Suggest a new wlan device. */
+ newdev[strlen(newdev)-1]++;
+ error("%s is not a monitor mode VAP\n"
+ "To create a new monitor mode VAP use:\n"
+ " ifconfig %s create wlandev %s wlanmode "
+ "monitor\nand use %s as the tcpdump "
+ "interface", device, newdev, parent,
+ newdev);
+ }
+#endif
else
error("%s: %s", device,
pcap_statustostr(status));
OpenPOWER on IntegriCloud