From owner-svn-src-user@freebsd.org Mon Apr 16 14:41:13 2018 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75C51F8846D for ; Mon, 16 Apr 2018 14:41:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2671F749ED; Mon, 16 Apr 2018 14:41:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E94C1EB43; Mon, 16 Apr 2018 14:41:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3GEfCZQ042032; Mon, 16 Apr 2018 14:41:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3GEfCLQ042030; Mon, 16 Apr 2018 14:41:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804161441.w3GEfCLQ042030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 16 Apr 2018 14:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r332568 - in user/markj/netdump: sbin/dumpon sys/netinet/netdump X-SVN-Group: user X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in user/markj/netdump: sbin/dumpon sys/netinet/netdump X-SVN-Commit-Revision: 332568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 14:41:13 -0000 Author: markj Date: Mon Apr 16 14:41:12 2018 New Revision: 332568 URL: https://svnweb.freebsd.org/changeset/base/332568 Log: Don't attempt configuration when the interface is not up. We need to interrogate the driver for its cluster size, which is not available until the interface is configured. Modified: user/markj/netdump/sbin/dumpon/dumpon.8 user/markj/netdump/sys/netinet/netdump/netdump_client.c Modified: user/markj/netdump/sbin/dumpon/dumpon.8 ============================================================================== --- user/markj/netdump/sbin/dumpon/dumpon.8 Mon Apr 16 14:39:34 2018 (r332567) +++ user/markj/netdump/sbin/dumpon/dumpon.8 Mon Apr 16 14:41:12 2018 (r332568) @@ -120,6 +120,8 @@ configuration is not automatically updated if any netw invocation. The name of the interface to be used must be specified as .Ar iface . +The interface must be up in order to configure +.Xr netdump 4 . .Pp The .Fl k Ar pubkey Modified: user/markj/netdump/sys/netinet/netdump/netdump_client.c ============================================================================== --- user/markj/netdump/sys/netinet/netdump/netdump_client.c Mon Apr 16 14:39:34 2018 (r332567) +++ user/markj/netdump/sys/netinet/netdump/netdump_client.c Mon Apr 16 14:41:12 2018 (r332568) @@ -1057,14 +1057,12 @@ netdump_configure(struct netdump_conf *conf) /* XXX ref */ IFNET_RUNLOCK_NOSLEEP(); - if (ifp == NULL) { - printf("netdump: unknown interface '%s'\n", conf->ndc_iface); - return (1); - } else if (!netdump_supported_nic(ifp) || ifp->if_type != IFT_ETHER) { - printf("netdump: unsupported interface '%s'\n", - conf->ndc_iface); - return (1); - } + if (ifp == NULL) + return (ENOENT); + if ((if_getflags(ifp) & IFF_UP) == 0) + return (ENXIO); + if (!netdump_supported_nic(ifp) || ifp->if_type != IFT_ETHER) + return (EINVAL); nd_ifp = ifp; netdump_reinit(ifp); @@ -1159,10 +1157,9 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c break; } - if (netdump_configure(conf) != 0) { - error = EINVAL; + error = netdump_configure(conf); + if (error != 0) break; - } dumper.dumper_start = netdump_start; dumper.dumper_hdr = netdump_write_headers;