Implement -R support, similar to ping(8)'s -A.
ping(8)'s -a was mapped to -e, but -E was already taken in ping6 (old option) so rename -e to -r. Now: ping -a => ping6 -r ping -A => ping6 -R MFC after: 2 days
This commit is contained in:
parent
248e5e18af
commit
865bdc6208
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182276
@ -29,7 +29,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd August 26, 2008
|
.Dd August 27, 2008
|
||||||
.Dt PING6 8
|
.Dt PING6 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -40,7 +40,7 @@ packets to network hosts
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.\" without ipsec, or new ipsec
|
.\" without ipsec, or new ipsec
|
||||||
.Op Fl defHmnNoqtvwW
|
.Op Fl dfHmnNoqrRtvwW
|
||||||
.\" old ipsec
|
.\" old ipsec
|
||||||
.\" .Op Fl AdEfmnNqRtvwW
|
.\" .Op Fl AdEfmnNqRtvwW
|
||||||
.Bk -words
|
.Bk -words
|
||||||
@ -148,12 +148,6 @@ option on the socket being used.
|
|||||||
.\" .It Fl E
|
.\" .It Fl E
|
||||||
.\" Enables transport-mode IPsec encapsulated security payload
|
.\" Enables transport-mode IPsec encapsulated security payload
|
||||||
.\" (experimental).
|
.\" (experimental).
|
||||||
.It Fl e
|
|
||||||
Audible.
|
|
||||||
Include a bell
|
|
||||||
.Tn ( ASCII
|
|
||||||
0x07)
|
|
||||||
character in the output when any packet is received.
|
|
||||||
.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,
|
||||||
@ -250,6 +244,22 @@ specifies IPsec policy to be used for the probe.
|
|||||||
Quiet output.
|
Quiet output.
|
||||||
Nothing is displayed except the summary lines at startup time and
|
Nothing is displayed except the summary lines at startup time and
|
||||||
when finished.
|
when finished.
|
||||||
|
.It Fl r
|
||||||
|
Audible.
|
||||||
|
Include a bell
|
||||||
|
.Tn ( ASCII
|
||||||
|
0x07)
|
||||||
|
character in the output when any packet is received.
|
||||||
|
.It Fl R
|
||||||
|
Audible.
|
||||||
|
Output a bell
|
||||||
|
.Tn ( ASCII
|
||||||
|
0x07)
|
||||||
|
character when no packet is received before the next packet
|
||||||
|
is transmitted.
|
||||||
|
To cater for round-trip times that are longer than the interval
|
||||||
|
between transmissions, further missing packets cause a bell only
|
||||||
|
if the maximum number of unreceived packets has increased.
|
||||||
.It Fl S Ar sourceaddr
|
.It Fl S Ar sourceaddr
|
||||||
Specifies the source address of request packets.
|
Specifies the source address of request packets.
|
||||||
The source address must be one of the unicast addresses of the sending node,
|
The source address must be one of the unicast addresses of the sending node,
|
||||||
|
@ -190,6 +190,7 @@ struct tv32 {
|
|||||||
#define F_NOMINMTU 0x100000
|
#define F_NOMINMTU 0x100000
|
||||||
#define F_ONCE 0x200000
|
#define F_ONCE 0x200000
|
||||||
#define F_AUDIBLE 0x400000
|
#define F_AUDIBLE 0x400000
|
||||||
|
#define F_MISSED 0x800000
|
||||||
#define F_NOUSERDATA (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
|
#define F_NOUSERDATA (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
|
||||||
u_int options;
|
u_int options;
|
||||||
|
|
||||||
@ -225,6 +226,7 @@ int hoplimit = -1; /* hoplimit */
|
|||||||
int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */
|
int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */
|
||||||
|
|
||||||
/* counters */
|
/* counters */
|
||||||
|
long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
|
||||||
long npackets; /* max packets to transmit */
|
long npackets; /* max packets to transmit */
|
||||||
long nreceived; /* # of packets we got back */
|
long nreceived; /* # of packets we got back */
|
||||||
long nrepeats; /* number of duplicates */
|
long nrepeats; /* number of duplicates */
|
||||||
@ -347,7 +349,7 @@ main(argc, argv)
|
|||||||
#endif /*IPSEC_POLICY_IPSEC*/
|
#endif /*IPSEC_POLICY_IPSEC*/
|
||||||
#endif
|
#endif
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
"a:b:c:defHg:h:I:i:l:mnNop:qS:s:tvwW" ADDOPTS)) != -1) {
|
"a:b:c:dfHg:h:I:i:l:mnNop:qrRS:s:tvwW" ADDOPTS)) != -1) {
|
||||||
#undef ADDOPTS
|
#undef ADDOPTS
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
@ -416,9 +418,6 @@ main(argc, argv)
|
|||||||
case 'd':
|
case 'd':
|
||||||
options |= F_SO_DEBUG;
|
options |= F_SO_DEBUG;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
|
||||||
options |= F_AUDIBLE;
|
|
||||||
break;
|
|
||||||
case 'f':
|
case 'f':
|
||||||
if (getuid()) {
|
if (getuid()) {
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
@ -501,6 +500,12 @@ main(argc, argv)
|
|||||||
case 'q':
|
case 'q':
|
||||||
options |= F_QUIET;
|
options |= F_QUIET;
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
options |= F_AUDIBLE;
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
options |= F_MISSED;
|
||||||
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
memset(&hints, 0, sizeof(struct addrinfo));
|
memset(&hints, 0, sizeof(struct addrinfo));
|
||||||
hints.ai_flags = AI_NUMERICHOST; /* allow hostname? */
|
hints.ai_flags = AI_NUMERICHOST; /* allow hostname? */
|
||||||
@ -1179,6 +1184,11 @@ main(argc, argv)
|
|||||||
if (((options & F_ONCE) != 0 && nreceived > 0) ||
|
if (((options & F_ONCE) != 0 && nreceived > 0) ||
|
||||||
(npackets > 0 && nreceived >= npackets))
|
(npackets > 0 && nreceived >= npackets))
|
||||||
break;
|
break;
|
||||||
|
if (ntransmitted - nreceived - 1 > nmissedmax) {
|
||||||
|
nmissedmax = ntransmitted - nreceived - 1;
|
||||||
|
if (options & F_MISSED)
|
||||||
|
(void)write(STDOUT_FILENO, &BBELL, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
summary();
|
summary();
|
||||||
exit(nreceived == 0 ? 2 : 0);
|
exit(nreceived == 0 ? 2 : 0);
|
||||||
@ -2770,7 +2780,7 @@ usage()
|
|||||||
"A"
|
"A"
|
||||||
#endif
|
#endif
|
||||||
"usage: ping6 [-"
|
"usage: ping6 [-"
|
||||||
"de"
|
"d"
|
||||||
#if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC)
|
#if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC)
|
||||||
"E"
|
"E"
|
||||||
#endif
|
#endif
|
||||||
@ -2778,7 +2788,7 @@ usage()
|
|||||||
#ifdef IPV6_USE_MIN_MTU
|
#ifdef IPV6_USE_MIN_MTU
|
||||||
"m"
|
"m"
|
||||||
#endif
|
#endif
|
||||||
"nNoqtvwW] "
|
"nNoqrRtvwW] "
|
||||||
"[-a addrtype] [-b bufsiz] [-c count] [-g gateway]\n"
|
"[-a addrtype] [-b bufsiz] [-c count] [-g gateway]\n"
|
||||||
" [-h hoplimit] [-I interface] [-i wait] [-l preload]"
|
" [-h hoplimit] [-I interface] [-i wait] [-l preload]"
|
||||||
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
|
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
|
||||||
|
Loading…
Reference in New Issue
Block a user