svn commit: r333668 - vendor/tcpdump/dist
Gleb Smirnoff
glebius at FreeBSD.org
Wed May 23 21:25:19 UTC 2018
Hi,
do we commit cherry-picks into vendor/ subversion space? I believe we don't.
Cherry-picks should go directly to head. vendor/ should get only tagged
full tree updates.
On Wed, May 16, 2018 at 08:43:08AM +0000, Slava Shwartsman wrote:
S> Author: slavash
S> Date: Wed May 16 08:43:08 2018
S> New Revision: 333668
S> URL: https://svnweb.freebsd.org/changeset/base/333668
S>
S> Log:
S> Vendor import two upstream commits:
S> c1bb8784abd3ca978e376b0d10e324db0491237b
S> 9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72
S>
S> When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP,
S> tcpdump will print an error message saying rfmon is not supported.
S>
S> Give a concise explanation as to how one might solve this problem by
S> creating a monitor mode VAP.
S>
S> Approved by: hselasky (mentor), kib (mentor)
S> Sponsored by: Mellanox Technologies
S>
S> Modified:
S> vendor/tcpdump/dist/tcpdump.c
S>
S> Modified: vendor/tcpdump/dist/tcpdump.c
S> ==============================================================================
S> --- vendor/tcpdump/dist/tcpdump.c Wed May 16 06:52:08 2018 (r333667)
S> +++ vendor/tcpdump/dist/tcpdump.c Wed May 16 08:43:08 2018 (r333668)
S> @@ -108,6 +108,10 @@ The Regents of the University of California. All righ
S> #endif /* HAVE_CAP_NG_H */
S> #endif /* HAVE_LIBCAP_NG */
S>
S> +#ifdef __FreeBSD__
S> +#include <sys/sysctl.h>
S> +#endif /* __FreeBSD__ */
S> +
S> #include "netdissect.h"
S> #include "interface.h"
S> #include "addrtoname.h"
S> @@ -1044,6 +1048,30 @@ open_interface(const char *device, netdissect_options
S> } else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0')
S> error("%s: %s\n(%s)", device,
S> pcap_statustostr(status), cp);
S> +#ifdef __FreeBSD__
S> + else if (status == PCAP_ERROR_RFMON_NOTSUP &&
S> + strncmp(device, "wlan", 4) == 0) {
S> + char parent[8], newdev[8];
S> + char sysctl[32];
S> + size_t s = sizeof(parent);
S> +
S> + snprintf(sysctl, sizeof(sysctl),
S> + "net.wlan.%d.%%parent", atoi(device + 4));
S> + sysctlbyname(sysctl, parent, &s, NULL, 0);
S> + strlcpy(newdev, device, sizeof(newdev));
S> + /* Suggest a new wlan device. */
S> + /* FIXME: incrementing the index this way is not going to work well
S> + * when the index is 9 or greater but the only consequence in this
S> + * specific case would be an error message that looks a bit odd.
S> + */
S> + newdev[strlen(newdev)-1]++;
S> + error("%s is not a monitor mode VAP\n"
S> + "To create a new monitor mode VAP use:\n"
S> + " ifconfig %s create wlandev %s wlanmode monitor\n"
S> + "and use %s as the tcpdump interface",
S> + device, newdev, parent, newdev);
S> + }
S> +#endif
S> else
S> error("%s: %s", device,
S> pcap_statustostr(status));
S>
--
Gleb Smirnoff
More information about the svn-src-all
mailing list