diff options
author | Alan Somers <asomers@FreeBSD.org> | 2019-08-22 18:57:24 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2019-08-22 18:57:24 +0000 |
commit | 299e2c58b71c1c2a790182de57c36f98ba1e1df9 (patch) | |
tree | 950d12ca67d3a5d8809cf8d15ea1d78e8da2d4a0 /sbin/ping | |
parent | 206b73d0429edb7c49b612537544e677fa568e83 (diff) | |
download | src-299e2c58b71c1c2a790182de57c36f98ba1e1df9.tar.gz src-299e2c58b71c1c2a790182de57c36f98ba1e1df9.zip |
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
Notes
Notes:
svn path=/head/; revision=351398
Diffstat (limited to 'sbin/ping')
-rw-r--r-- | sbin/ping/ping.8 | 13 | ||||
-rw-r--r-- | sbin/ping/ping.c | 2 | ||||
-rw-r--r-- | sbin/ping/tests/ping_c1_s56_t1.out | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/sbin/ping/ping.8 b/sbin/ping/ping.8 index 14dff3414eb3..60858337cec2 100644 --- a/sbin/ping/ping.8 +++ b/sbin/ping/ping.8 @@ -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 diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 445b418699d9..5c55056b42cf 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -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 diff --git a/sbin/ping/tests/ping_c1_s56_t1.out b/sbin/ping/tests/ping_c1_s56_t1.out index e2c8ddaa7b3d..24eca478c96b 100644 --- a/sbin/ping/tests/ping_c1_s56_t1.out +++ b/sbin/ping/tests/ping_c1_s56_t1.out @@ -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 |