From owner-svn-src-head@FreeBSD.ORG Tue Jan 21 08:24:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A8755F1; Tue, 21 Jan 2014 08:24:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EA118101F; Tue, 21 Jan 2014 08:24:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0L8OC4F058542; Tue, 21 Jan 2014 08:24:12 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0L8OC83058541; Tue, 21 Jan 2014 08:24:12 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401210824.s0L8OC83058541@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 21 Jan 2014 08:24:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260978 - head/usr.sbin/usbdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 08:24:13 -0000 Author: hselasky Date: Tue Jan 21 08:24:12 2014 New Revision: 260978 URL: http://svnweb.freebsd.org/changeset/base/260978 Log: Add check for "hw.usb.no_pf" sysctl value. Submitted by: Warren Block MFC after: 1 week Modified: head/usr.sbin/usbdump/usbdump.c Modified: head/usr.sbin/usbdump/usbdump.c ============================================================================== --- head/usr.sbin/usbdump/usbdump.c Tue Jan 21 05:56:35 2014 (r260977) +++ head/usr.sbin/usbdump/usbdump.c Tue Jan 21 08:24:12 2014 (r260978) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -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");