Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Aug 2019 18:57:25 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351398 - in head/sbin/ping: . tests
Message-ID:  <201908221857.x7MIvPuN040376@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Thu Aug 22 18:57:24 2019
New Revision: 351398
URL: https://svnweb.freebsd.org/changeset/base/351398

Log:
  ping: By default, don't reverse lookup IP addresses
  
  ping's default is now not to attempt reverse DNS lookups.  The -H flag will
  enable them.  This change is not quite a reversion of r351330.  That change
  made the happy path and error path do reverse lookups consistently; this
  change changes the default for both paths.
  
  Submitted by:	Ján Sučan <sucanjan@gmail.com>
  Discussed with:	cem
  MFC after:	2 weeks
  MFC-With:	351330
  Sponsored by:	Google LLC (Google Summer of Code 2019)
  Differential Revision:	https://reviews.freebsd.org/D21364

Modified:
  head/sbin/ping/ping.8
  head/sbin/ping/ping.c
  head/sbin/ping/tests/ping_c1_s56_t1.out

Modified: head/sbin/ping/ping.8
==============================================================================
--- head/sbin/ping/ping.8	Thu Aug 22 18:52:30 2019	(r351397)
+++ head/sbin/ping/ping.8	Thu Aug 22 18:57:24 2019	(r351398)
@@ -28,7 +28,7 @@
 .\"     @(#)ping.8	8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd August 21, 2019
+.Dd August 22, 2019
 .Dt PING 8
 .Os
 .Sh NAME
@@ -160,11 +160,9 @@ The default value is 0.
 .It Fl H
 Hostname output.
 Try to do a reverse DNS lookup when displaying addresses.
-This is the opposite of
-.Fl n ,
-and it is the default behavior.
-.Nm
-utility tries reverse-lookup by default.
+This is the opposite of the
+.Fl n
+option.
 .It Fl h Ar sweepincrsize
 Specify the number of bytes to increment the size of
 .Tn ICMP
@@ -228,6 +226,9 @@ MIB variable.
 .It Fl n
 Numeric output only.
 No attempt will be made to lookup symbolic names for host addresses.
+This is the opposite of
+.Fl H ,
+and it is the default behavior.
 .It Fl o
 Exit successfully after receiving one reply packet.
 .It Fl P Ar policy

Modified: head/sbin/ping/ping.c
==============================================================================
--- head/sbin/ping/ping.c	Thu Aug 22 18:52:30 2019	(r351397)
+++ head/sbin/ping/ping.c	Thu Aug 22 18:57:24 2019	(r351398)
@@ -261,6 +261,8 @@ main(int argc, char *const *argv)
 #endif
 	cap_rights_t rights;
 
+	options |= F_NUMERIC;
+
 	/*
 	 * Do the stuff that we need root priv's for *first*, and
 	 * then drop our setuid bit.  Save error reporting for

Modified: head/sbin/ping/tests/ping_c1_s56_t1.out
==============================================================================
--- head/sbin/ping/tests/ping_c1_s56_t1.out	Thu Aug 22 18:52:30 2019	(r351397)
+++ head/sbin/ping/tests/ping_c1_s56_t1.out	Thu Aug 22 18:57:24 2019	(r351398)
@@ -1,5 +1,5 @@
 PING localhost: 56 data bytes
-64 bytes from localhost: icmp_seq=0 ttl= time= ms
+64 bytes from: icmp_seq=0 ttl= time= ms
 
 --- localhost ping statistics ---
 1 packets transmitted, 1 packets received, 0.0% packet loss



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