mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-14 12:23:58 +00:00
When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP,
tcpdump will print an error message saying rfmon is not supported. Give a concise explanation as to how one might solve this problem by creating a monitor mode VAP.
This commit is contained in:
parent
d1da193810
commit
480d5cc8f7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253827
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue