From nobody Sat Feb 03 04:08:06 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TRfJ73116z58yMn; Sat, 3 Feb 2024 04:08:07 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TRfJ70RnPz4ncx; Sat, 3 Feb 2024 04:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706933287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dmcBT9SOULNv2YFrWLwfftVNjYTBGSUgEtvIQzEiGTM=; b=JmKgBUeFNBHF+7i+4mPnPPq6MSBTN7AGYDUNLJBWJ7B+ACOa2LtHIR7wGa04ITjLf/IrcU rBVNoGThnusk0vtaP3DQssX0xRNDU9/fqgSi+K5xS6iDxCGhg+uQvb/Wt462TmYfwSCLKy lYcNH6IjYM1s+qyvtD5gkubDdbYMuMYih+kv6uXNyLR1gqlbTOPJ/EUMxX6N2DR+V50WtY 5Yv6yh2KgTFYLyzRMHYeqMuLQK92anidaZVfMAvzPZ9VONJB/E2a3IYZnAqh7JQgcnGX6k cXfSCuzpUDRyATq7Ddf2mh+EMF9PvSySiy7ACDK6YJmVmGkYXupWptNiDU2C5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706933287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dmcBT9SOULNv2YFrWLwfftVNjYTBGSUgEtvIQzEiGTM=; b=erFAk+zZciMwN5+ELzADjwxD8j2cSceUEW/cpOQlzk5lur4QkXskLRFEb7ny3aOcZP2sbD gFXcD60MQWLYdcHCc+sn4eJNWtWHs8brkDe4LAQLydRZYjr82cjHRiH6NbMRa1mh4GksdN 0H7c5xdMO3Kv99/i2h3iO/M69wEOYKMzLjUohfMG0stjgoHZ4OxvFyqWDeLkGUWlgZf3LE 35pYn6wVg1gzRb/Q5QBBqAlVgV+g0L8lHOhM11yjVq+5JP/HwCuxDrvL0/NyxSclR5V8IX 1oUCTLJsbbtcbIyJJGjOGgyL3fZkkHXf6x5K9lLeaHf+56/dEa/HB6YWlMPg4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706933287; a=rsa-sha256; cv=none; b=Zv3LxyFADuNEQki1w5KBLsL6i9oMFCaAdezOm2XioXiNr9GXMgaQBIrQppAMxxvcOf+xQ/ jeQ6ux6W49TacOeqNJvP+Gwyc6jgRm88UILw2mJyDnW8OLRCJ6yiY2JQLymWb2MJTIjWQe O3AOCl+6rpAIBGhMsHdgoECWesXYKrB5yB6KjBKZMC/u8lq+1VwwGnlscetmbsnxNfsde8 tksLN/PbIkY5wxFaenaX18yLosqqBDxnZeixIisXCpHMQV9XhbrDxlDODrQw+YFITSg4Be applHWb0uySRSG8Gnzqk7mhPcfclg/25QbWt9WCkkNVuLfcNXzKw0e9lrlDE6w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TRfJ66g3Gzy4b; Sat, 3 Feb 2024 04:08:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4134865D065494; Sat, 3 Feb 2024 04:08:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 413486Nv065491; Sat, 3 Feb 2024 04:08:06 GMT (envelope-from git) Date: Sat, 3 Feb 2024 04:08:06 GMT Message-Id: <202402030408.413486Nv065491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ba09352b7323 - main - traceroute: Standardize usage List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba09352b73238bb4f1ca8586aab95cb2d9544bdc Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba09352b73238bb4f1ca8586aab95cb2d9544bdc commit ba09352b73238bb4f1ca8586aab95cb2d9544bdc Author: Jose Luis Duran AuthorDate: 2023-11-05 18:35:23 +0000 Commit: Warner Losh CommitDate: 2024-02-03 03:14:09 +0000 traceroute: Standardize usage Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/901 --- contrib/traceroute/traceroute.8 | 55 +++++++++++++++++++------------------- contrib/traceroute/traceroute.c | 7 ++--- usr.sbin/traceroute6/traceroute6.8 | 6 ++--- usr.sbin/traceroute6/traceroute6.c | 7 +++-- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/contrib/traceroute/traceroute.8 b/contrib/traceroute/traceroute.8 index e19fb23f43b9..1ba11b75e37d 100644 --- a/contrib/traceroute/traceroute.8 +++ b/contrib/traceroute/traceroute.8 @@ -25,17 +25,18 @@ .Nm .Bk -words .Op Fl adDeEFISnrvx +.Op Fl A Ar as_server .Op Fl f Ar first_ttl .Op Fl g Ar gateway -.Op Fl M Ar first_ttl +.Op Fl i Ar iface .Op Fl m Ar max_ttl -.Op Fl P Ar proto +.Op Fl M Ar first_ttl .Op Fl p Ar port +.Op Fl P Ar proto .Op Fl q Ar nprobes .Op Fl s Ar src_addr .Op Fl t Ar tos .Op Fl w Ar waittime -.Op Fl A Ar as_server .Op Fl z Ar pausemsecs .Ar host .Op Ar packetlen @@ -62,6 +63,19 @@ Turn on AS# lookups for each hop encountered. .It Fl A Ar as_server Turn on AS# lookups and use the given server instead of the default. +.It Fl d +Enable socket level debugging. +.It Fl D +When an ICMP response to our probe datagram is received, +print the differences between the transmitted packet and +the packet quoted by the ICMP response. +A key showing the location of fields within the transmitted packet is printed, +followed by the original packet in hex, +followed by the quoted packet in hex. +Bytes that are unchanged in the quoted packet are shown as underscores. +Note, +the IP checksum and the TTL of the quoted packet are not expected to match. +By default, only one probe per hop is sent with this option. .It Fl e Firewall evasion mode. Use fixed destination ports for UDP, UDP-Lite, TCP and SCTP probes. @@ -86,19 +100,6 @@ is also specified, the corresponding ECN bits will be replaced. Set the initial time-to-live used in the first outgoing probe packet. .It Fl F Set the "don't fragment" bit. -.It Fl d -Enable socket level debugging. -.It Fl D -When an ICMP response to our probe datagram is received, -print the differences between the transmitted packet and -the packet quoted by the ICMP response. -A key showing the location of fields within the transmitted packet is printed, -followed by the original packet in hex, -followed by the quoted packet in hex. -Bytes that are unchanged in the quoted packet are shown as underscores. -Note, -the IP checksum and the TTL of the quoted packet are not expected to match. -By default, only one probe per hop is sent with this option. .It Fl g Ar gateway Specify a loose source route gateway (8 maximum). .It Fl i Ar iface @@ -109,9 +110,6 @@ host. (See the flag for another way to do this.) .It Fl I Use ICMP ECHO instead of UDP datagrams. (A synonym for "-P icmp"). -.It Fl M Ar first_ttl -Set the initial time-to-live value used in outgoing probe packets. -The default is 1, i.e., start with the first hop. .It Fl m Ar max_ttl Set the max time-to-live (max number of hops) used in outgoing probe packets. The default is the value of the @@ -119,18 +117,13 @@ packets. The default is the value of the .Xr sysctl 8 (the same default used for TCP connections). +.It Fl M Ar first_ttl +Set the initial time-to-live value used in outgoing probe packets. +The default is 1, i.e., start with the first hop. .It Fl n Print hop addresses numerically rather than symbolically and numerically (saves a nameserver address-to-name lookup for each gateway found on the path). -.It Fl P Ar proto -Send packets of specified IP protocol. The currently supported protocols -are: UDP, UDP-Lite, TCP, SCTP, GRE and ICMP. Other protocols may also be -specified (either by name or by number), though -.Nm -does not implement any special knowledge of their packet formats. This -option is useful for determining which router along a path may be -blocking packets based on IP protocol number. But see BUGS below. .It Fl p Ar port Protocol specific. For UDP, UDP-Lite, TCP and SCTP, sets the base @@ -147,6 +140,14 @@ at the destination host (so an ICMP PORT_UNREACHABLE message will be returned to terminate the route tracing). If something is listening on a port in the default range, this option can be used to pick an unused port range. +.It Fl P Ar proto +Send packets of specified IP protocol. The currently supported protocols +are: UDP, UDP-Lite, TCP, SCTP, GRE and ICMP. Other protocols may also be +specified (either by name or by number), though +.Nm +does not implement any special knowledge of their packet formats. This +option is useful for determining which router along a path may be +blocking packets based on IP protocol number. But see BUGS below. .It Fl q Ar nprobes Set the number of probes per hop (default is 3, unless diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c index 144b6fd80928..ab744c47bed6 100644 --- a/contrib/traceroute/traceroute.c +++ b/contrib/traceroute/traceroute.c @@ -2152,8 +2152,9 @@ usage(void) Fprintf(stderr, "Version %s\n", version); Fprintf(stderr, - "Usage: %s [-adDeEFInrSvx] [-f first_ttl] [-g gateway] [-i iface]\n" - "\t[-m max_ttl] [-p port] [-P proto] [-q nqueries] [-s src_addr]\n" - "\t[-t tos] [-w waittime] [-A as_server] [-z pausemsecs] host [packetlen]\n", prog); + "Usage: %s [-adDeEFInrSvx] [-A as_server] [-f first_ttl] [-g gateway]\n" + "\t[-i iface] [-m max_ttl] [-M first_ttl] [-p port] [-P proto]\n" + "\t[-q nprobes] [-s src_addr] [-t tos] [-w waittime]\n" + "\t[-z pausemsecs] host [packetlen]\n", prog); exit(1); } diff --git a/usr.sbin/traceroute6/traceroute6.8 b/usr.sbin/traceroute6/traceroute6.8 index 1d71895fcde3..5abd4ba01c5b 100644 --- a/usr.sbin/traceroute6/traceroute6.8 +++ b/usr.sbin/traceroute6/traceroute6.8 @@ -41,6 +41,9 @@ .Op Fl adEIlnNrSTUv .Ek .Bk -words +.Op Fl A Ar as_server +.Ek +.Bk -words .Op Fl f Ar firsthop .Ek .Bk -words @@ -65,9 +68,6 @@ .Op Fl w Ar waittime .Ek .Bk -words -.Op Fl A Ar as_server -.Ek -.Bk -words .Ar target .Op Ar datalen .Ek diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index f5e5f341e19a..dfe1d9565b94 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1818,10 +1818,9 @@ tcp_chksum(struct sockaddr_in6 *src, struct sockaddr_in6 *dst, void usage(void) { - fprintf(stderr, -"usage: traceroute6 [-adEIlnNrSTUv] [-A as_server] [-f firsthop] [-g gateway]\n" -" [-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target\n" -" [datalen]\n"); +"Usage: traceroute6 [-adEIlnNrSTUv] [-A as_server] [-f firsthop] [-g gateway]\n" +"\t[-m hoplimit] [-p port] [-q probes] [-s src] [-t tclass]\n" +"\t[-w waittime] target [datalen]\n"); exit(1); }