- Use err, warn, errx
- Don't use floor, because we would need libm - Add maxwait option from old ping - Add a centralized gethost() to get hostnames - Fix PR/1014 and PR/2017; (adds -D, -T options, and -I and -t for unicast) - Document exit status
This commit is contained in:
parent
f64034e8f6
commit
203dfd3486
@ -1,9 +1,10 @@
|
|||||||
# $NetBSD: Makefile,v 1.7 1995/03/18 14:59:13 cgd Exp $
|
# $NetBSD: Makefile,v 1.8 1997/03/11 21:22:49 christos Exp $
|
||||||
# @(#)Makefile 8.1 (Berkeley) 6/5/93
|
# @(#)Makefile 8.1 (Berkeley) 6/5/93
|
||||||
|
|
||||||
PROG= ping
|
PROG= ping
|
||||||
MAN= ping.8
|
MAN= ping.8
|
||||||
BINOWN= root
|
BINOWN= root
|
||||||
BINMODE=4555
|
BINMODE=4555
|
||||||
|
CFLAGS+=-g
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: ping.8,v 1.11 1996/11/06 20:42:14 cgd Exp $
|
.\" $NetBSD: ping.8,v 1.12 1997/03/11 21:22:51 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1985, 1991, 1993
|
.\" Copyright (c) 1985, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -33,7 +33,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
|
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
|
||||||
.\"
|
.\"
|
||||||
.Dd December 11, 1993
|
.Dd March 11, 1997
|
||||||
.Dt PING 8
|
.Dt PING 8
|
||||||
.Os BSD 4.3
|
.Os BSD 4.3
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -43,16 +43,18 @@
|
|||||||
packets to network hosts
|
packets to network hosts
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm ping
|
.Nm ping
|
||||||
.Op Fl dfLnqRrv
|
.Op Fl dfnqrvDPQRL
|
||||||
.Op Fl c Ar count
|
.Op Fl c Ar count
|
||||||
.Op Fl I Ar ifaddr
|
.Op Fl g Ar gateway
|
||||||
.Op Fl i Ar wait
|
.Op Fl i Ar wait
|
||||||
.Op Fl l Ar preload
|
.Op Fl l Ar preload
|
||||||
.Op Fl p Ar pattern
|
.Op Fl p Ar pattern
|
||||||
.Op Fl S Ar ifaddr
|
|
||||||
.Op Fl s Ar packetsize
|
.Op Fl s Ar packetsize
|
||||||
.Op Fl t Ar ttl
|
.Op Fl t Ar ttl
|
||||||
.Op Fl w Ar maxwait
|
.Op Fl w Ar maxwait
|
||||||
|
.Op Fl I Ar ifaddr
|
||||||
|
.Op Fl S Ar ifaddr
|
||||||
|
.Op Fl T Ar tos
|
||||||
.Ar host
|
.Ar host
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Ping
|
.Nm Ping
|
||||||
@ -82,6 +84,10 @@ packets.
|
|||||||
Set the
|
Set the
|
||||||
.Dv SO_DEBUG
|
.Dv SO_DEBUG
|
||||||
option on the socket being used.
|
option on the socket being used.
|
||||||
|
.It Fl D
|
||||||
|
Set the
|
||||||
|
.Dv Don't Fragment
|
||||||
|
bit.
|
||||||
.It Fl f
|
.It Fl f
|
||||||
Flood ping.
|
Flood ping.
|
||||||
Outputs packets as fast as they come back or one hundred times per second,
|
Outputs packets as fast as they come back or one hundred times per second,
|
||||||
@ -101,10 +107,11 @@ Wait
|
|||||||
.Ar wait
|
.Ar wait
|
||||||
seconds
|
seconds
|
||||||
.Em between sending each packet .
|
.Em between sending each packet .
|
||||||
The default is to wait for one second between each packet.
|
The default is to wait for one second between each packet,
|
||||||
This option is incompatible with the
|
except when the -f option is used the wait interval is 0.01 seconds.
|
||||||
.Fl f
|
.It Fl I Ar ifaddr
|
||||||
option.
|
Send multicast datagrams on the network interface specified by the
|
||||||
|
interface's hostname or IP address.
|
||||||
.It Fl l Ar preload
|
.It Fl l Ar preload
|
||||||
If
|
If
|
||||||
.Ar preload
|
.Ar preload
|
||||||
@ -153,7 +160,20 @@ The default is 56, which translates into 64
|
|||||||
data bytes when combined
|
data bytes when combined
|
||||||
with the 8 bytes of
|
with the 8 bytes of
|
||||||
.Tn ICMP
|
.Tn ICMP
|
||||||
header data.
|
header data. The maximum allowed value is 65468 bytes.
|
||||||
|
header data. If the
|
||||||
|
.Fl D
|
||||||
|
or
|
||||||
|
.Fl T
|
||||||
|
options are specified, or the
|
||||||
|
.Fl t
|
||||||
|
option to a unicast destination, a raw socket will be used and the 8 bytes of
|
||||||
|
header data are included in
|
||||||
|
.Ar packetsize .
|
||||||
|
.It Fl t Ar ttl
|
||||||
|
Use the specified time-to-live.
|
||||||
|
.It Fl T Ar tos
|
||||||
|
Use the specified type of service.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Verbose output.
|
Verbose output.
|
||||||
.Tn ICMP
|
.Tn ICMP
|
||||||
@ -167,13 +187,14 @@ before transmitting the next one. The default is 10.
|
|||||||
.Pp
|
.Pp
|
||||||
In addition, the following options may be used for multicast pings:
|
In addition, the following options may be used for multicast pings:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl I Ar ifaddr
|
|
||||||
Transmit using the specified interface address.
|
|
||||||
.It Fl L
|
.It Fl L
|
||||||
Disable the loopback, so the transmitting host doesn't see the ICMP
|
Disable the loopback, so the transmitting host doesn't see the ICMP
|
||||||
requests.
|
requests.
|
||||||
.It Fl t Ar ttl
|
.It Fl R
|
||||||
Use the specified time-to-live.
|
Record Route. Includes the RECORD_ROUTE option in the ECHO_REQUEST
|
||||||
|
packet and displays the route buffer on returned packets. Note that
|
||||||
|
the IP header is only large enough for six such routes. Many hosts
|
||||||
|
ignore or discard this option.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
When using
|
When using
|
||||||
@ -199,6 +220,31 @@ argument for
|
|||||||
.Xr stty 1
|
.Xr stty 1
|
||||||
for more information).
|
for more information).
|
||||||
.Pp
|
.Pp
|
||||||
|
.Nm
|
||||||
|
continually sends one datagram per second, and prints one line of
|
||||||
|
output for every ECHO_RESPONSE returned. On a trusted system with IP
|
||||||
|
Security Options enabled, if the network idiom is not MONO,
|
||||||
|
.Nm
|
||||||
|
also prints a second line containing the hexadecimal representation
|
||||||
|
of the IP security option in the ECHO_RESPONSE. If the
|
||||||
|
.Fl c
|
||||||
|
count option is given, only that number of requests is sent. No
|
||||||
|
output is produced if there is no response. Round-trip times and
|
||||||
|
packet loss statistics are computed. If duplicate packets are
|
||||||
|
received, they are not included in the packet loss calculation,
|
||||||
|
although the round trip time of these packets is used in calculating
|
||||||
|
the minimum/average/maximum round-trip time numbers. When the
|
||||||
|
specified number of packets have been sent (and received) or if
|
||||||
|
the program is terminated with an interrupt (SIGINT), a brief
|
||||||
|
summary is displayed. When not using the
|
||||||
|
.Fl -f
|
||||||
|
(flood) option, the first interrupt, usually generated by control-C or DEL,
|
||||||
|
causes
|
||||||
|
.Nm
|
||||||
|
to wait for its outstanding requests to return. It will wait no longer
|
||||||
|
than the longest round trip time encountered by previous, successful pings.
|
||||||
|
The second interrupt stops ping immediately.
|
||||||
|
.Pp
|
||||||
This program is intended for use in network testing, measurement and
|
This program is intended for use in network testing, measurement and
|
||||||
management.
|
management.
|
||||||
Because of the load it can impose on the network, it is unwise to use
|
Because of the load it can impose on the network, it is unwise to use
|
||||||
@ -336,6 +382,10 @@ packets that they use for
|
|||||||
packets, for example either 30 or 60.
|
packets, for example either 30 or 60.
|
||||||
Others may use completely wild values.
|
Others may use completely wild values.
|
||||||
.El
|
.El
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Nm
|
||||||
|
returns 0 on success (the host is alive), and non zero if the arguments are
|
||||||
|
incorrect or the host is not responding.
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
Many Hosts and Gateways ignore the
|
Many Hosts and Gateways ignore the
|
||||||
.Tn RECORD_ROUTE
|
.Tn RECORD_ROUTE
|
||||||
|
2015
sbin/ping/ping.c
2015
sbin/ping/ping.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user