diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2015-10-16 18:17:13 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2015-10-16 18:17:13 +0000 |
commit | 6d4ee4c888f902925d4082a8e4a57de2006a2a44 (patch) | |
tree | 2ba8b8c680b57ad94aa82d3d36ce19c3b3228661 | |
parent | a15c321a70fe169b83f8a2454677a1d1196ad773 (diff) |
Move -t and -w functionality to -a. Both flags are in the way for a
merge with ping(8). Let's see if we can shove every weird and special v6
functionality into -a.
suggested by and OK sthen@
-rw-r--r-- | sbin/ping6/ping6.8 | 32 | ||||
-rw-r--r-- | sbin/ping6/ping6.c | 27 |
2 files changed, 26 insertions, 33 deletions
diff --git a/sbin/ping6/ping6.8 b/sbin/ping6/ping6.8 index 7a3ec388b5b..2510ce35273 100644 --- a/sbin/ping6/ping6.8 +++ b/sbin/ping6/ping6.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ping6.8,v 1.52 2015/10/14 17:26:01 florian Exp $ +.\" $OpenBSD: ping6.8,v 1.53 2015/10/16 18:17:12 florian Exp $ .\" $KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: October 14 2015 $ +.Dd $Mdocdate: October 16 2015 $ .Dt PING6 8 .Os .Sh NAME @@ -36,8 +36,8 @@ .Nd send ICMPv6 ECHO_REQUEST packets to network hosts .Sh SYNOPSIS .Nm ping6 -.Op Fl dEefHmNnqtvw -.Op Fl a Ar addrtype +.Op Fl dEefHmNnqv +.Op Fl a Ar querytype .Op Fl c Ar count .Op Fl g Ar gateway .Op Fl h Ar hoplimit @@ -66,10 +66,10 @@ ICMPv6 header formatted as documented in RFC 4443. The options are as follows: .Bl -tag -width Ds -.It Fl a Ar addrtype -Generate an ICMPv6 Node Information Node Addresses query, +.It Fl a Ar querytype +Generate an ICMPv6 Node Information query, rather than an echo-request. -.Ar addrtype +.Ar querytype must be a string constructed of the following characters: .Pp .Bl -tag -width Ds -compact @@ -87,10 +87,14 @@ only those addresses which belong to the interface which has the responder's address are requests. .It Ic c Requests responder's IPv4-compatible and IPv4-mapped addresses. +.It Ic d +Generate an ICMPv6 Node Information DNS Name query. .It Ic g Requests responder's global-scope addresses. .It Ic l Requests responder's link-local addresses. +.It Ic n +Generate an ICMPv6 Node Information query. .It Ic s Requests responder's site-local addresses. .El @@ -240,26 +244,12 @@ to extend the socket buffer size. This option is ignored if any of the flags .Op Fl tWw are specified. -.It Fl t -Generate an ICMPv6 Node Information query, -rather than echo-request. -.Fl s -has no effect if -this option -is specified. .It Fl V Ar rtable Set the routing table to be used for outgoing packets. .It Fl v Verbose output. All ICMP packets that are received are listed. -.It Fl w -Generate an ICMPv6 Node Information DNS Name query, -rather than echo-request. -.Fl s -has no effect if -this option -is specified. .It Ar host The IPv6 address of the final destination node. .El diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index c855950b066..80313a29c99 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping6.c,v 1.123 2015/10/14 17:26:01 florian Exp $ */ +/* $OpenBSD: ping6.c,v 1.124 2015/10/16 18:17:12 florian Exp $ */ /* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */ /* @@ -267,36 +267,47 @@ main(int argc, char *argv[]) preload = 0; datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN]; while ((ch = getopt(argc, argv, - "a:c:dEefHg:h:I:i:l:mnNp:qS:s:tvV:w")) != -1) { + "a:c:dEefHg:h:I:i:l:mnNp:qS:s:vV:")) != -1) { switch (ch) { case 'a': { char *cp; options &= ~F_NOUSERDATA; - options |= F_NODEADDR; for (cp = optarg; *cp != '\0'; cp++) { switch (*cp) { case 'a': + options |= F_NODEADDR; naflags |= NI_NODEADDR_FLAG_ALL; break; case 'c': case 'C': + options |= F_NODEADDR; naflags |= NI_NODEADDR_FLAG_COMPAT; break; + case 'd': + options |= F_FQDN; + break; case 'l': case 'L': + options |= F_NODEADDR; naflags |= NI_NODEADDR_FLAG_LINKLOCAL; break; + case 'n': + options |= F_SUPTYPES; + break; case 's': case 'S': + options |= F_NODEADDR; naflags |= NI_NODEADDR_FLAG_SITELOCAL; break; case 'g': case 'G': + options |= F_NODEADDR; naflags |= NI_NODEADDR_FLAG_GLOBAL; break; case 'A': /* experimental. not in the spec */ + options |= F_NODEADDR; naflags |= NI_NODEADDR_FLAG_ANYCAST; break; default: @@ -412,10 +423,6 @@ main(int argc, char *argv[]) errx(1, "datalen value is %s: %s", errstr, optarg); break; - case 't': - options &= ~F_NOUSERDATA; - options |= F_SUPTYPES; - break; case 'v': options |= F_VERBOSE; break; @@ -429,10 +436,6 @@ main(int argc, char *argv[]) sizeof(rtableid)) == -1) err(1, "setsockopt SO_RTABLE"); break; - case 'w': - options &= ~F_NOUSERDATA; - options |= F_FQDN; - break; default: usage(); /*NOTREACHED*/ @@ -2314,7 +2317,7 @@ usage(void) (void)fprintf(stderr, "usage: ping6 [-dEefH" "m" - "Nnqtvw" + "Nnqv" "] [-a addrtype] [-c count] [-g gateway]\n\t" "[-h hoplimit] [-I sourceaddr] [-i wait] [-l preload] [-p pattern]" "\n\t[-s packetsize] [-V rtable] host\n"); |