Home | History | Annotate | Download | only in ping6
History log of /src/sbin/ping6/ping6.c
RevisionDateAuthorComments
 1.108  11-Jul-2025  andvar Fix various typos, mainly in comments and log/error messages.
 1.107  08-Apr-2022  andvar fix various typos, mainly in comments, but also log messages, docs, game text.
 1.106  11-Jun-2021  rillig ping, ping6: fix comment about ID field

Since ping.c 1.76 and ping6.c 1.58 from 2004-04-22, the ID field
contains random bits instead of a process ID.
 1.105  07-Jun-2021  dholland In ping6, there's no blank space in the ping packets by default.

- document that if you use -p to specify a fill pattern you need to
make the packets bigger with -s;

- warn if -p is used and there's not at least one byte of fill space.

PR 56057
 1.104  23-May-2021  thorpej Make sure the output packet buffer and the control message buffer
are aligned.

Fixes bin/56198.
 1.103  24-Apr-2018  maxv branches: 1.103.8;
Add code 3 of paramprob, part of RFC7112: "IPv6 First Fragment has
incomplete IPv6 Header Chain". Handle this code in ping6.
 1.102  24-Apr-2018  maxv Remove annoying (void) casts.
 1.101  23-Apr-2018  maxv Remove double include and unused macros.
 1.100  23-Apr-2018  maxv Remove the "-R" option. It uses IPV6_REACHCONF, but we've never had
this.
 1.99  23-Apr-2018  maxv Fix usage(), A/E don't exist.
 1.98  23-Apr-2018  maxv Simplify: remove #ifdefs for constants that are always defined, and
remove their #else's (some of which can't compile, since they use values
that since got removed).
 1.97  23-Apr-2018  maxv Remove dead/broken code, we want to favor RFC3542 over RFC2292. No
functional change. traceroute6 and rtadvd did the same.
 1.96  23-Apr-2018  wiz Sort options. Sort option descriptions. Remove Tn.
Sync usage (more) with man page.
 1.95  23-Apr-2018  maxv Remove the "hops" parameter, it uses RH0, which is deprecated by RFC5095,
and doesn't work on modern networks anymore.
 1.94  15-Apr-2018  maxv typo in comment
 1.93  18-Dec-2016  dholland branches: 1.93.12;
Merge the PR 36997 fixes into ping6. It already didn't accept too
small or wildly too large intervals, but it did allow intervals that
failed at poll(). Since that's signed integer overflow and thus UB,
better not to.
 1.92  29-Feb-2016  riastradh branches: 1.92.2;
#ifdef forward declaration of setpolicy like definition.
 1.91  04-Nov-2015  ozaki-r Fix rump.ping6 -c N (N > 1) doesn't work

2nd packet and subsequent packets are sent based on SIGALRM and
it depends on poll(2) returns with EINTR by the signal. However,
currently poll is rump-ified while signals aren't so the signal
doesn't wake up poll and ping6 doesn't work expectedly.

Rump-ifying signals is unsure (nobody does it for now) and the
combination use of signals and poll makes the logic a bit complex.
So let's fix the defect by stopping using signals for packet
transmissions. The new logic is derived from ping(8).

Bonus: ping6 -i 0.01 works as we expect now while the original
didn't work enough fast.
 1.90  04-Nov-2015  ozaki-r Fix exit status when -c and -X is used

It exited with status 0 when at least one packet was received
and timed out. However, when we specify -c N (while N > 0),
we expect that it fails if it times out before all sent requests
are replied.
 1.89  04-Nov-2015  knakahara rump.ping6 supports "-S" option.
 1.88  06-Aug-2015  ozaki-r Introduce rump.ping6

We use ping6 frequently in ATF tests so let's have rump-ified one.
 1.87  15-May-2015  kefren Add options -X for deadline and -x for reply maxwait (flag names matching
FreeBSD). Unline FreeBSD, currently -x doesn't count late packets to statistics.
After discussion with, and help from ozaki-r@
Should fix PR/49896
 1.86  24-Apr-2015  christos Add the once -o option like ping
 1.85  17-Sep-2014  ozaki-r Remove out-of-date comments
 1.84  16-Sep-2014  christos PR/49206: ping6 dies with SIGINT even when it just fails to ping
When reusing the same handler for SIGALRM, make don't pretend you
got SIGINT.
 1.83  22-Aug-2014  matt Rework to be avoid a conditional assignment which results in:
sbin/ping6/ping6.c:1879:8: error: 'cbit.skip' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cur += ntohs(cbit.skip) * 32;
 1.82  19-Oct-2013  christos branches: 1.82.4;
avoit type punning
 1.81  10-Sep-2012  msaitoh branches: 1.81.2;
Accept "-s 0"
 1.80  04-Jan-2012  drochner branches: 1.80.2;
include <netipsec/ipsec.h> rather than <netinet6/ipsec.h> from userland
where possible, for consistency and compatibility to FreeBSD
(exception: KAME specific statistics gathering in netstat(1) and systat(1))
 1.79  04-Jan-2012  drochner -consistently use "char *" for the compiled policy buffer in the
ipsec_*_policy() functions, as it was documented and used by clients
-remove "ipsec_policy_t" which was undocumented and only present
in the KAME version of the ipsec.h header
-misc cleanup of historical artefacts, and to remove unnecessary
differences between KAME ans FAST_IPSEC
 1.78  16-Sep-2011  plunky branches: 1.78.2;
NULL does not need a cast, here
 1.77  31-Aug-2011  christos put back the byte swapping code, and remove the double byte swapping.
 1.76  31-Aug-2011  riz Remove erroneous seq=ntohs(seq) introduced in rev. 1.74, which caused
icmp_seq numbers to increment by 256 instead of 1 on LE platforms.
 1.75  27-Aug-2011  joerg static + __dead + G/C pathmtu
 1.74  14-Aug-2011  christos fix gcc warnings and eliminate duplicate code.
 1.73  20-Sep-2010  ahoka Avoid NaN when calculating std-dev, which fixes a crash on VAX.
 1.72  11-Apr-2009  lukem fix sign-compare issues
 1.71  13-Oct-2008  dholland branches: 1.71.4;
Fix reversed test in connection with combining -i and -l. If some
packets have already sent because of the preload count handling, we
shouldn't start off by sending another one right away. The reversed
test causes ping6 to wait one interval before sending anything at all
if you don't use -l. PR bin/39732.
 1.70  23-Sep-2006  elad branches: 1.70.2; 1.70.18;
PR/30226: Nino Dehne: ping6(8) and ping(8) are inconsistent in the output
of round-trip times.

okay rpaulo@
 1.69  18-May-2006  rpaulo Replace the way we calculate the standard deviation with the unbiased form
for non-related samples. There are several websites that explain why we
should use this form instead of the normal formula to compute the std. dev.
(Wikipedia is one of them).
Also, ping(8) (where this "new" formula came from) already does it this way
so, I'm trying to score some extra points by making both utilities behave
the same way.

Thanks to wrtstuden@ for the initial clarification.
 1.68  07-May-2006  rpaulo Remove support support for RFC 2292.
 1.67  05-May-2006  rpaulo len should be socklen_t, not size_t. Spotted by
Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>.
 1.66  05-May-2006  rpaulo Add support for RFC 3542 Adv. Socket API for IPv6 (which obsoletes 2292).
* RFC 3542 isn't binary compatible with RFC 2292.
* RFC 2292 support is on by default but can be disabled.
* update ping6, telnet and traceroute6 to the new API.

From the KAME project (www.kame.net).
Reviewed by core.
 1.65  17-Mar-2006  elad Fix an off-by-one found by Coverity, CID 1456.

I haven't looked, but I suggest security-officer@ looks into it to see if
this may be exploited passively?
 1.64  07-Jun-2005  he Add an initialization to appease -Wuninitialized.
Marked with XXXGCC for sun2 (found while building for it).

Reviewed by lukem.
 1.63  02-Jun-2005  lukem appease gcc -Wuninitialized
 1.62  09-Feb-2005  xtraeme Kill __P(), use ANSI function declarations; WARNS=3.
 1.61  29-Oct-2004  dsl Add (unsigned char) cast to ctype function
 1.60  09-Jun-2004  itojun correct mistake in usage(). Chris Pinnock
 1.59  13-May-2004  kleink There's no point in bringing PRNG output to network byteorder prior to
transmission.
 1.58  22-Apr-2004  itojun do not disclose endian. henning@openbsd
 1.57  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.56  25-Jul-2003  itojun fix packet loss rate computation
 1.55  06-Jun-2003  cjep Fix typo. Noted by Sean Boudreau on tech-net.
 1.54  27-Mar-2003  perry do proper rounded packet loss calculations.
From Robert Elz in PR #20885
XXX This should be sent back to KAME
 1.53  05-Dec-2002  itojun correct the use of sizeof() on memset(). sync w/kame
 1.52  16-Nov-2002  itojun use strlcpy. sync w/kame
 1.51  25-Oct-2002  itojun be more picky about numeric arg parsing. sync w/kame
 1.50  23-Sep-2002  itojun reduce diff w/ kame
 1.49  21-Sep-2002  mycroft Touch up error/warning messages.
 1.48  21-Sep-2002  mycroft select() -> poll()
 1.47  08-Sep-2002  itojun ansi pedantic. sync w/kame
 1.46  31-May-2002  itojun clarify comment when nreceived > ntransmitted. from deraadt
 1.45  30-May-2002  itojun typo, from openbsd
 1.44  30-May-2002  thorpej Fix Missing %s in format string.
 1.43  26-May-2002  itojun KNF. remove unused variable "signo". from deraadt
 1.42  26-May-2002  itojun s/IPSec/IPsec/
 1.41  26-May-2002  itojun sync with kame.
- use bind(2) to select source.
- KNF.
- -g option to specify intermediate gateway.
 1.40  11-Mar-2002  itojun branches: 1.40.2;
no \n to warnx(3). From: Mike Pechkin <mpech@prosoft.org.lv>
 1.39  09-Jan-2002  darrenr should be using htons() to convert from a host byte order into a network
byte order, not ntohs().
 1.38  02-Nov-2001  lukem fix -Wshadow warning
 1.37  19-Aug-2001  itojun use bind(2) to support -S. snprintf return value audit from deraadt
 1.36  22-Jun-2001  itojun sync with latest kame.
- sync usage/manpage with reality.
- stop pinging on "-f -c N".
 1.35  09-May-2001  itojun correct -n handling.
 1.34  09-May-2001  itojun fix signal handling on ping6 -f <nonexisting peer>. from hash@iij.ad.jp.
sync with kame
 1.33  07-May-2001  kleink getopt(3): EOF -> -1.
 1.32  04-Feb-2001  itojun correct recvmsg() validation.
 1.31  26-Jan-2001  itojun more simpler signal handling. be more friendly with 4.3BSD-ish socket API
(linux/USAGI folks are using the code). sync with kame.
 1.30  12-Jan-2001  itojun avoid signal handler race. help from deraadt
 1.29  12-Jan-2001  itojun correct use of howmany() for fd_set. commented by deraadt
 1.28  31-Dec-2000  itojun indent and pedant. from deraadt. sync with kame
 1.27  22-Dec-2000  itojun call seteuid(getuid) too
 1.26  22-Dec-2000  itojun revoke root privilege earlierst possible.
 1.25  02-Dec-2000  itojun sync with latest kame.
- validate strdup() error on argument parsing.
- use strlcat on complex string manipulation.
 1.24  11-Nov-2000  itojun improve spec conformance of node information query (07).
sync with kame.
 1.23  08-Nov-2000  itojun - fix -s with small number (like < 8). kame 1.97 -> 1.99
- add fflush. kame 1.96 -> 1.97
- alpha friendly (printf format - %ld and others) kame 1.93 -> 1.94
sync with kame
 1.22  12-Oct-2000  itojun do not segv on too many args. sync with kame
 1.21  10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.20  08-Oct-2000  itojun fix truncated response handling; sync with kame
 1.19  07-Oct-2000  itojun repair fd_set size attack. from deraadt.
some of cleanups from kame (inet_ntop error check, unnecessary headers,
stddev computation like ping(8)).
$NetBSD$.
 1.18  14-Aug-2000  itojun - bugfix: truncated FQDN printing
- allow < 1 second interval on -i (root only). from openbsd
 1.17  09-Aug-2000  itojun DNS compression support.
be more picky about DNS label validation.
(sync with kame)
 1.16  07-Jul-2000  itojun warnx?/errx? audit. don't pass variable/function return value alone.
use with "%s". from openbsd.
 1.15  12-Jun-2000  itojun branches: 1.15.2;
better conformance to draft-ietf-ipngwg-icmp-name-lookups-05.
the old code was chimera of 03 and 05 draft.

-n by default, since IPv6 reverse lookup takes too much time.
use -H to enable reverse name lookup.
 1.14  08-Jun-2000  itojun make sure to clear ni_flags field on -w.
 1.13  28-Feb-2000  itojun branches: 1.13.2;
support ping6 -a c
(request IPv4 mapped/compatible addrs from
draft-ietf-ipngwg-icmp-name-lookups-05.txt)
 1.12  16-Feb-2000  itojun use getnameinfo(), instead inet_ntop(), as much as possible.
(sync with latest kame)
 1.11  31-Jan-2000  itojun sync with latest libipsec and kernel.
 1.10  22-Jan-2000  tron Remove bogus declarations of "errno", "optind" and "optarg".
 1.9  13-Dec-1999  itojun provide -S for source address specifier.
enable KAME scopeid hack.
cleanups in node information query.
(sync with latest KAME)
 1.8  05-Dec-1999  jdolecek usage(): wrap lines so that they don't exceed 80 characters
 1.7  03-Dec-1999  itojun rcsid police
 1.6  04-Jul-1999  itojun branches: 1.6.4;
add NetBSD RCS ID.
 1.5  04-Jul-1999  itojun be friendly with non-IPsec kernel.
don't exit even if ipsec policy config fails.
 1.4  02-Jul-1999  itojun stop using __RCSID from UCB comment.
Hope this fixes PR 7892.
 1.3  02-Jul-1999  thorpej Fix some printf format problems.
 1.2  01-Jul-1999  thorpej Fix LP64 printf format problem.
 1.1  01-Jul-1999  itojun ping for IPv6. try
ping6 ::1
on you node.
 1.6.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.7  15-Dec-2002  he Pull up revision 1.53 (requested by itojun):
Correct the use of sizeof() on memset().
 1.15.2.6  09-May-2001  he Pull up revisions 1.33-1.35 (requested by he and itojun):
Use -1 instead of EOF with getopt(3).
Correct signal handling on ping6 -f <nonexisting peer>.
 1.15.2.5  11-Mar-2001  he Pull up revisions 1.23-1.24,1.26-1.32 (via patch, requested by itojun):
Correct buffer management. Fix handling of short packets. More
robust signal handling. Print icmp6 name lookup packets better.
This syncs up to the current head of the trunk.
 1.15.2.4  15-Dec-2000  he Pull up revision 1.25 (requested by itojun):
Validate strdup() error on argument parsing. Also, use strlcat()
on complex string manipulation.
 1.15.2.3  18-Oct-2000  tv Pullup by patch (sync with HEAD) [itojun]:
Format string cleanups by Bill Sommerfeld.
 1.15.2.2  16-Oct-2000  tv Pullup 1.22 (with -Wunused fix) [itojun]:
do not segv on too many args. sync with kame
 1.15.2.1  27-Jul-2000  itojun pullup (approved by releng-1-5)
printf-like format pedant. do not pass string variable alone. use "%s".
from openbsd.

/cvsroot/basesrc/sbin/swapctl/swapctl.c 1.14 -> 1.15
/cvsroot/basesrc/sbin/ping6/ping6.c 1.15 -> 1.16
/cvsroot/basesrc/sbin/disklabel/disklabel.c 1.84 -> 1.85
/cvsroot/basesrc/sbin/ccdconfig/ccdconfig.c 1.30 -> 1.31
 1.40.2.1  12-Dec-2002  he Pull up revision 1.53 (requested by itojun in ticket #1026):
Correct the use of sizeof() in memset().
 1.70.18.1  17-Jan-2009  mjf Sync with HEAD.
 1.70.2.1  31-Oct-2008  snj Pull up following revision(s) (requested by dholland in ticket #1214):
sbin/ping6/ping6.c: revision 1.71
Fix reversed test in connection with combining -i and -l. If some
packets have already sent because of the preload count handling, we
shouldn't start off by sending another one right away. The reversed
test causes ping6 to wait one interval before sending anything at all
if you don't use -l. PR bin/39732.
 1.71.4.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.78.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.78.2.2  30-Oct-2012  yamt sync with head
 1.78.2.1  17-Apr-2012  yamt sync with head
 1.80.2.1  22-Oct-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #614):
sbin/ping6/ping6.c: revision 1.81
Accept "-s 0"
 1.81.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.4.1  04-Feb-2015  martin Pull up following revision(s) (requested by chs in ticket #493):
sbin/ping6/ping6.c: revision 1.83
Rework to avoid a conditional assignment which results in a
"maybe-uninitialized" warning
 1.92.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.93.12.2  02-May-2018  pgoyette Synch with HEAD
 1.93.12.1  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.103.8.1  31-May-2021  cjep sync with head

RSS XML Feed