Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 2014 07:09:48 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r261222 - stable/9/usr.sbin/usbdump
Message-ID:  <201401280709.s0S79m5s040468@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Jan 28 07:09:48 2014
New Revision: 261222
URL: http://svnweb.freebsd.org/changeset/base/261222

Log:
  MFC r260978:
  Add check for "hw.usb.no_pf" sysctl value.

Modified:
  stable/9/usr.sbin/usbdump/usbdump.c
Directory Properties:
  stable/9/usr.sbin/   (props changed)
  stable/9/usr.sbin/usbdump/   (props changed)

Modified: stable/9/usr.sbin/usbdump/usbdump.c
==============================================================================
--- stable/9/usr.sbin/usbdump/usbdump.c	Tue Jan 28 03:09:57 2014	(r261221)
+++ stable/9/usr.sbin/usbdump/usbdump.c	Tue Jan 28 07:09:48 2014	(r261222)
@@ -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[])
 {
@@ -870,6 +888,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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401280709.s0S79m5s040468>