Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Nov 2018 17:47:40 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r340736 - releng/12.0/sbin/dumpon
Message-ID:  <201811211747.wALHlek0070752@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Nov 21 17:47:40 2018
New Revision: 340736
URL: https://svnweb.freebsd.org/changeset/base/340736

Log:
  MFstable/12 r340728:
  Change dumpon(8)'s handling of -g.
  
  Approved by:	re (gjb)

Modified:
  releng/12.0/sbin/dumpon/dumpon.8
  releng/12.0/sbin/dumpon/dumpon.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sbin/dumpon/dumpon.8
==============================================================================
--- releng/12.0/sbin/dumpon/dumpon.8	Wed Nov 21 17:33:19 2018	(r340735)
+++ releng/12.0/sbin/dumpon/dumpon.8	Wed Nov 21 17:47:40 2018	(r340736)
@@ -28,7 +28,7 @@
 .\"     From: @(#)swapon.8	8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd June 13, 2018
+.Dd November 17, 2018
 .Dt DUMPON 8
 .Os
 .Sh NAME
@@ -46,7 +46,7 @@
 .Op Fl k Ar pubkey
 .Op Fl Z
 .Op Fl z
-.Op Fl g Ar gateway | Li default
+.Op Fl g Ar gateway
 .Fl s Ar server
 .Fl c Ar client
 .Ar iface
@@ -140,21 +140,22 @@ The local IP address of the
 .Xr netdump 4
 client.
 .It Fl g Ar gateway
-Optional.
-If not specified, it is assumed that the
-.Ar server
-is on the same link as the
-.Ar client .
-.Pp
-If specified,
-.Ar gateway
-is the address of the first-hop router between the
+The first-hop router between
 .Ar client
-and the
+and
 .Ar server .
-The special value
-.Dv Dq default
-indicates that the currently configured system default route should be used.
+If the
+.Fl g
+option is not specified and the system has a default route, the default
+router is used as the
+.Xr netdump 4
+gateway.
+If the
+.Fl g
+option is not specified and the system does not have a default route,
+.Ar server
+is assumed to be on the same link as
+.Ar client .
 .It Fl s Ar server
 The IP address of the
 .Xr netdumpd 8

Modified: releng/12.0/sbin/dumpon/dumpon.c
==============================================================================
--- releng/12.0/sbin/dumpon/dumpon.c	Wed Nov 21 17:33:19 2018	(r340735)
+++ releng/12.0/sbin/dumpon/dumpon.c	Wed Nov 21 17:47:40 2018	(r340736)
@@ -88,7 +88,7 @@ usage(void)
 	fprintf(stderr,
     "usage: dumpon [-v] [-k <pubkey>] [-Zz] <device>\n"
     "       dumpon [-v] [-k <pubkey>] [-Zz]\n"
-    "              [-g <gateway>|default] -s <server> -c <client> <iface>\n"
+    "              [-g <gateway>] -s <server> -c <client> <iface>\n"
     "       dumpon [-v] off\n"
     "       dumpon [-v] -l\n");
 	exit(EX_USAGE);
@@ -109,8 +109,6 @@ find_gateway(const char *ifname)
 	size_t sz;
 	int error, i, ifindex, mib[7];
 
-	ret = NULL;
-
 	/* First look up the interface index. */
 	if (getifaddrs(&ifap) != 0)
 		err(EX_OSERR, "getifaddrs");
@@ -148,6 +146,7 @@ find_gateway(const char *ifname)
 		free(buf);
 	}
 
+	ret = NULL;
 	for (next = buf; next < buf + sz; next += rtm->rtm_msglen) {
 		rtm = (struct rt_msghdr *)(void *)next;
 		if (rtm->rtm_version != RTM_VERSION)
@@ -452,12 +451,16 @@ main(int argc, char *argv[])
 		if (inet_aton(client, &ndconf.ndc_client) == 0)
 			errx(EX_USAGE, "invalid client address '%s'", client);
 
-		if (gateway == NULL)
-			gateway = server;
-		else if (strcmp(gateway, "default") == 0 &&
-		    (gateway = find_gateway(argv[0])) == NULL)
-			errx(EX_NOHOST,
-			    "failed to look up next-hop router for %s", server);
+		if (gateway == NULL) {
+			gateway = find_gateway(argv[0]);
+			if (gateway == NULL) {
+				if (verbose)
+					printf(
+				    "failed to look up gateway for %s\n",
+					    server);
+				gateway = server;
+			}
+		}
 		if (inet_aton(gateway, &ndconf.ndc_gateway) == 0)
 			errx(EX_USAGE, "invalid gateway address '%s'", gateway);
 



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