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
This commit is contained in:
Alan Somers 2019-08-22 18:57:24 +00:00
parent 206b73d042
commit 299e2c58b7
3 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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