svn commit: r332568 - in user/markj/netdump: sbin/dumpon sys/netinet/netdump

Mark Johnston markj at FreeBSD.org
Mon Apr 16 14:41:13 UTC 2018


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;


More information about the svn-src-user mailing list