From owner-svn-src-head@freebsd.org Wed Aug 21 21:05:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27FC7D43E6; Wed, 21 Aug 2019 21:05:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46DKth06MXz4Y7T; Wed, 21 Aug 2019 21:05:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAD3F21839; Wed, 21 Aug 2019 21:05:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7LL5F2q063637; Wed, 21 Aug 2019 21:05:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7LL5Frr063636; Wed, 21 Aug 2019 21:05:15 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201908212105.x7LL5Frr063636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Aug 2019 21:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351354 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 351354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2019 21:05:16 -0000 Author: asomers Date: Wed Aug 21 21:05:15 2019 New Revision: 351354 URL: https://svnweb.freebsd.org/changeset/base/351354 Log: ping: add -H option for enabling reverse DNS lookup This is the reverse of the -n flag. Submitted by: Ján Sučan Sponsored by: Google LLC (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21356 Modified: head/sbin/ping/ping.8 head/sbin/ping/ping.c Modified: head/sbin/ping/ping.8 ============================================================================== --- head/sbin/ping/ping.8 Wed Aug 21 20:44:42 2019 (r351353) +++ head/sbin/ping/ping.8 Wed Aug 21 21:05:15 2019 (r351354) @@ -28,7 +28,7 @@ .\" @(#)ping.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd March 11, 2016 +.Dd August 21, 2019 .Dt PING 8 .Os .Sh NAME @@ -38,7 +38,7 @@ packets to network hosts .Sh SYNOPSIS .Nm -.Op Fl AaDdfnoQqRrv +.Op Fl AaDdfHnoQqRrv .Op Fl c Ar count .Op Fl G Ar sweepmaxsize .Op Fl g Ar sweepminsize @@ -56,7 +56,7 @@ packets to network hosts .Op Fl z Ar tos .Ar host .Nm -.Op Fl AaDdfLnoQqRrv +.Op Fl AaDdfHLnoQqRrv .Op Fl c Ar count .Op Fl I Ar iface .Op Fl i Ar wait @@ -157,6 +157,14 @@ Specify the size of .Tn ICMP payload to start with when sending sweeping pings. 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. .It Fl h Ar sweepincrsize Specify the number of bytes to increment the size of .Tn ICMP Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Wed Aug 21 20:44:42 2019 (r351353) +++ head/sbin/ping/ping.c Wed Aug 21 21:05:15 2019 (r351354) @@ -297,7 +297,7 @@ main(int argc, char *const *argv) outpack = outpackhdr + sizeof(struct ip); while ((ch = getopt(argc, argv, - "Aac:DdfG:g:h:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" + "Aac:DdfG:g:Hh:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC "P:" @@ -363,6 +363,9 @@ main(int argc, char *const *argv) options |= F_SWEEP; sweepmin = ltmp; break; + case 'H': + options &= ~F_NUMERIC; + break; case 'h': /* Packet size increment for ping sweep */ ltmp = strtol(optarg, &ep, 0); if (*ep || ep == optarg || ltmp < 1) @@ -1743,11 +1746,11 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]", +"usage: ping [-AaDdfHnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]", " [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]", " " SECOPT " [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]", " [-W waittime] [-z tos] host", -" ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", +" ping [-AaDdfHLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", " [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]", " [-s packetsize] [-T ttl] [-t timeout] [-W waittime]", " [-z tos] mcast-group");