From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 28 07:09:49 2014 Return-Path: Delivered-To: svn-src-stable-9@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 0A48B15F; Tue, 28 Jan 2014 07:09:49 +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 E985B1EEC; Tue, 28 Jan 2014 07:09:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0S79mkb040469; Tue, 28 Jan 2014 07:09:48 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0S79m5s040468; Tue, 28 Jan 2014 07:09:48 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401280709.s0S79m5s040468@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 28 Jan 2014 07:09:48 +0000 (UTC) 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 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2014 07:09:49 -0000 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 #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[]) { @@ -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");