Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2018 14:41:12 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r332568 - in user/markj/netdump: sbin/dumpon sys/netinet/netdump
Message-ID:  <201804161441.w3GEfCLQ042030@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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