aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/usbdump
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-04-28 07:50:45 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-04-28 07:50:45 +0000
commit3b8f08459569bf0faa21473e5cec2491e95c9349 (patch)
tree80f45dd81ca716bcd7ca9674581e1fc40b93cd34 /usr.sbin/usbdump
parent9d2ab4a62d6733c45958627ac113bdbd818d1e2a (diff)
parentb2ba55951383498f252746f618d513139da06e8e (diff)
downloadsrc-3b8f08459569bf0faa21473e5cec2491e95c9349.tar.gz
src-3b8f08459569bf0faa21473e5cec2491e95c9349.zip
Merge head
Notes
Notes: svn path=/projects/bmake/; revision=265044
Diffstat (limited to 'usr.sbin/usbdump')
-rw-r--r--usr.sbin/usbdump/usbdump.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.sbin/usbdump/usbdump.c b/usr.sbin/usbdump/usbdump.c
index 7e7eae923eea..43fde90e88f5 100644
--- a/usr.sbin/usbdump/usbdump.c
+++ b/usr.sbin/usbdump/usbdump.c
@@ -34,6 +34,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/sysctl.h>
#include <sys/utsname.h>
#include <sys/queue.h>
#include <net/if.h>
@@ -780,6 +781,23 @@ usage(void)
exit(EX_USAGE);
}
+static void
+check_usb_pf_sysctl(void)
+{
+ int error;
+ int no_pf_val = 0;
+ size_t no_pf_len = sizeof(int);
+
+ /* check "hw.usb.no_pf" sysctl for 8- and 9- stable */
+
+ error = sysctlbyname("hw.usb.no_pf", &no_pf_val,
+ &no_pf_len, NULL, 0);
+ if (error == 0 && no_pf_val != 0) {
+ warnx("The USB packet filter might be disabled.");
+ warnx("See the \"hw.usb.no_pf\" sysctl for more information.");
+ }
+}
+
int
main(int argc, char *argv[])
{
@@ -872,6 +890,8 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
+ check_usb_pf_sysctl();
+
p->fd = fd = open("/dev/bpf", O_RDONLY);
if (p->fd < 0)
err(EXIT_FAILURE, "Could not open BPF device");