OpenBSD CVS

CVS log for src/sbin/ping/ping.c


[BACK] Up to [local] / src / sbin / ping

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.249 / (download) - annotate - [select for diffs], Tue Apr 23 13:34:50 2024 UTC (5 weeks, 4 days ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.248: +2 -2 lines
Diff to previous 1.248 (colored)

correct indentation; no functional change
ok tb@

Revision 1.248 / (download) - annotate - [select for diffs], Thu Dec 1 07:34:06 2022 UTC (18 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.247: +2 -2 lines
Diff to previous 1.247 (colored)

Oops, the tweak was not correct, go with my original version.
Pointed out by tb.

Revision 1.247 / (download) - annotate - [select for diffs], Thu Dec 1 07:11:17 2022 UTC (18 months ago) by florian
Branch: MAIN
Changes since 1.246: +6 -3 lines
Diff to previous 1.246 (colored)

Make sure the length of an unknown IP option is sensible.

For example, an unknown option with length 0 would result in an
infinite loop.
bluhm points out that the network stack in the kernel would not let
such packets through to userland.
tweak & OK miod
OK bluhm

Revision 1.246 / (download) - annotate - [select for diffs], Mon Feb 21 03:50:46 2022 UTC (2 years, 3 months ago) by jmatthew
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.245: +5 -2 lines
Diff to previous 1.245 (colored)

If the signature on an icmp echo reply doesn't match, don't count it as
a reply we've received, and print out the source address and sequence number
as that might help the user understand what's going on.

ok florian@ dlg@

Revision 1.245 / (download) - annotate - [select for diffs], Mon Jul 12 15:09:19 2021 UTC (2 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.244: +2 -2 lines
Diff to previous 1.244 (colored)

Change the error reporting pattern throughout the tree when unveil
fails to report the path that the failure occured on. Suggested by
deraadt@ after some tech discussion.

Work done and verified by Ashton Fagg <ashton@fagg.id.au>

ok deraadt@ semarie@ claudio@

Revision 1.244 / (download) - annotate - [select for diffs], Sun Feb 21 10:38:42 2021 UTC (3 years, 3 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.243: +27 -10 lines
Diff to previous 1.243 (colored)

Add ping -g, a concise display format similar to that used by other
network devices that shows one character per echo request (! for normal
response, . for timed out, D for duplicate, T for truncated) making
it easier to identify patterns of loss over periods of time.

ok remi@ kn@, feedback from deraadt@ chris@

!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!!!.........!!!!!!!!!!!!!!!!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!.........!!!!!!!!!!!!!!!!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!.........!!!!!!!!!!!!!!!!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!..........!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!..........!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!..........!!!!!!!!!!!!!!!!!!!!....!!!!!!!!!!!!!!!!!!!!!!!!!!.....!!!!!!!!!!!!!!

Revision 1.243 / (download) - annotate - [select for diffs], Tue Dec 29 16:40:47 2020 UTC (3 years, 5 months ago) by florian
Branch: MAIN
Changes since 1.242: +6 -4 lines
Diff to previous 1.242 (colored)

If we manage to send all "count" flood pings before receiving all
answers we would exit after receiving the first answer and claiming a
(huge) packet loss.
OK benno

Revision 1.242 / (download) - annotate - [select for diffs], Wed Oct 21 11:11:58 2020 UTC (3 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.241: +50 -1 lines
Diff to previous 1.241 (colored)

ICMP raw sockets start to receive packets as soon as they are created
by socket(2). They also receive all ICMP packets on the system, for
example from parallel running ping(8)s.

After creating the raw socket ping(8) sets various socket options with
setsockopt(2) and assumes that they apply to all packets it later
processes.

For example ping6(8) uses setsockopt(IPV6_RECVHOPLIMIT) to print the
IPv6 hop count. Packets received between the socket(2) and
setsockopt(2) call however do not have the hoplimit information and
ping6(8) prints a wrong and missleading warning.

To avoid this we have to drain our socket of packets we received
before we were fully setup.

Problem reported and testing by martijn
Input deraadt
OK benno

Revision 1.241 / (download) - annotate - [select for diffs], Mon Sep 21 12:19:08 2020 UTC (3 years, 8 months ago) by mglocker
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.240: +2 -2 lines
Diff to previous 1.240 (colored)

Missing space for '-i interval' option error message.

From <piotr (at) durlej (dot) net>.  Thanks!

Revision 1.240 / (download) - annotate - [select for diffs], Tue Feb 11 18:41:39 2020 UTC (4 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.239: +2 -2 lines
Diff to previous 1.239 (colored)

Simplify and unify wording for the -I sourceaddr option in various places.
This is somewhat related to the "-b bind_addr" option some programs have,
which should get some cleanup also...
input florian claudio jmc

Revision 1.239 / (download) - annotate - [select for diffs], Sat Jan 4 01:00:18 2020 UTC (4 years, 4 months ago) by cheloha
Branch: MAIN
Changes since 1.238: +22 -18 lines
Diff to previous 1.238 (colored)

ping(8): improve "-i wait" parsing and error-checking code

 - Never accept negative values.

 - Cap the interval at UINT_MAX seconds to avoid strange rounding
   behavior at the end of the input range.

 - Use error messages that resemble other parts of the tree where we
   are able to use strtonum(3).

 - Leverage modf(3) for cleaner code.

 - Call it "-i interval" to avoid accidental visual similarity to
   "-w maxwait".

With input from cjeker@, kettenis@, kn@.

ok kn@

Revision 1.238 / (download) - annotate - [select for diffs], Wed Aug 28 20:03:51 2019 UTC (4 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.237: +7 -1 lines
Diff to previous 1.237 (colored)

At startup, unveil entire filesystem to read-only. If after privdrop, some
implausible bug existed in the socket setup (mostly dns-related and
setsockopt) it would be largely neutered.  of course, a very restrictive
pledge is installed soon after that...
ok mestre brynet florian

Revision 1.237 / (download) - annotate - [select for diffs], Sat Jul 20 00:49:54 2019 UTC (4 years, 10 months ago) by cheloha
Branch: MAIN
Changes since 1.236: +1 -6 lines
Diff to previous 1.236 (colored)

ping(8): don't round inter-packet delay up to HZ

ping(8) doesn't know the value of HZ and shouldn't round the user's
packet wait up to whatever it thinks HZ is.  If the period is too small
the interrupt will simply fire less often than instructed.  The kernel
will do the right thing regardless.

Given the rarity of this usage we don't really need to print a warning,
either.

ok millert@

Revision 1.236 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:45 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.235: +25 -25 lines
Diff to previous 1.235 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.235 / (download) - annotate - [select for diffs], Tue Mar 19 23:27:49 2019 UTC (5 years, 2 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.234: +8 -3 lines
Diff to previous 1.234 (colored)

delay dropping privs a bit when root so that setrtable works.
traceroute bits from benno.
ok benno claudio

Revision 1.234 / (download) - annotate - [select for diffs], Tue Nov 13 14:30:36 2018 UTC (5 years, 6 months ago) by dhill
Branch: MAIN
Changes since 1.233: +2 -2 lines
Diff to previous 1.233 (colored)

Fix previous, which broke ping -T.

ok dlg@

Revision 1.233 / (download) - annotate - [select for diffs], Sun Nov 11 01:40:31 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.232: +37 -35 lines
Diff to previous 1.232 (colored)

make all the setsockopt calls consistent.

do not cast the arguments unnecessarily, and always err() on failure.

an earlier diff just tweaking the v6 calls was oked by bluhm@ kn@ deraadt@

Revision 1.232 / (download) - annotate - [select for diffs], Sat Nov 10 23:44:53 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.231: +10 -3 lines
Diff to previous 1.231 (colored)

let -D work on ping6 too.

the manpage was discussed with many

Revision 1.231 / (download) - annotate - [select for diffs], Sat Nov 10 05:03:23 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.230: +13 -4 lines
Diff to previous 1.230 (colored)

add support for setting the traffic class on ipv6 packets.

it reuses the toskeyword handling that ipv4 uses for setting the
tos field, which is equiavlent to traffic class.

ok florian@ denis@

Revision 1.230 / (download) - annotate - [select for diffs], Sun Oct 14 19:47:53 2018 UTC (5 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.229: +4 -4 lines
Diff to previous 1.229 (colored)

Fix ID comments

Left behind in revision 1.225.

OK benno

Revision 1.229 / (download) - annotate - [select for diffs], Sun Oct 14 11:00:56 2018 UTC (5 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.228: +1 -7 lines
Diff to previous 1.228 (colored)

Remove unneeded sockaddr size checks

With hints set appropiately and switching on address family, the actual
size of the socket address returned by getaddrinfo(3) and it's specified
length is guaranteed to match.

This is probably a leftover "from ping6 which was much more paranoid"
before merging it ping.

OK florian

Revision 1.228 / (download) - annotate - [select for diffs], Sat Jul 21 07:27:54 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.227: +8 -8 lines
Diff to previous 1.227 (colored)

There is no need to initialise global and static local variables to zero,
they are like that by default.
OK florian@

Revision 1.227 / (download) - annotate - [select for diffs], Wed Jul 18 15:46:49 2018 UTC (5 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.226: +3 -7 lines
Diff to previous 1.226 (colored)

replace manual zero initialization of various fields with memset;
makes the code shorter and easier to read.
suggested by & OK claudio

Revision 1.226 / (download) - annotate - [select for diffs], Wed Jul 18 13:55:39 2018 UTC (5 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.225: +20 -3 lines
Diff to previous 1.225 (colored)

When running flood ping with count packets (-c) set an alarm after
sending all packets otherwise ping will wait forever to see all
answers - which might not arrive on lossy links.

Problem pointed out by, input & OK claudio

Revision 1.225 / (download) - annotate - [select for diffs], Wed Apr 11 16:03:58 2018 UTC (6 years, 1 month ago) by zhuk
Branch: MAIN
Changes since 1.224: +4 -4 lines
Diff to previous 1.224 (colored)

Two fixes in ping:

1. Stop telling our PID to the world: the ident values could overlap
   anyway since PID space is larger than 16 bits for some time already.

2. No need for htons/ntohs dance with ident in IPv6 case.

okay benno@ deraadt@ florian@

Revision 1.224 / (download) - annotate - [select for diffs], Wed Nov 8 17:27:39 2017 UTC (6 years, 6 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.223: +2 -2 lines
Diff to previous 1.223 (colored)

Add a type cast to force signed comparison. This fixes a loop
termination issue that can arise when parsing IP options.

The bug was found by Hrvoje Popovski with ping -R.
Fix tested by Hrvoje, OK millert@

Revision 1.223 / (download) - annotate - [select for diffs], Sat Jul 8 16:22:29 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.222: +4 -4 lines
Diff to previous 1.222 (colored)

Consistently use if ((option & F_FOO) && (option & F_BAR)) instead of
if (option & F_FOO && option & F_BAR).

Prompted by a reverse diff from Klemens Nanni. Both forms are
equivalent due to operator precedence, I consider the later to be
easier on the eyes.

Revision 1.222 / (download) - annotate - [select for diffs], Sat Jul 8 16:21:51 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.221: +6 -6 lines
Diff to previous 1.221 (colored)

Consistently use if (option & F_FOO); from Klemens Nanni, thanks!

Revision 1.221 / (download) - annotate - [select for diffs], Wed Jul 5 07:15:40 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.220: +117 -117 lines
Diff to previous 1.220 (colored)

remove useless (void)printf casts, diff from Klemens Nanni, massaged
by me.

Revision 1.220 / (download) - annotate - [select for diffs], Tue Jul 4 15:55:22 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.219: +2 -2 lines
Diff to previous 1.219 (colored)

calculate multiples of 4 smarter; from Klemens Nanni

Revision 1.219 / (download) - annotate - [select for diffs], Tue Jul 4 15:43:38 2017 UTC (6 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.218: +3 -5 lines
Diff to previous 1.218 (colored)

replace perror(3) with err(3); from Klemens Nanni

Revision 1.218 / (download) - annotate - [select for diffs], Wed Feb 22 13:43:35 2017 UTC (7 years, 3 months ago) by renato
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.217: +9 -4 lines
Diff to previous 1.217 (colored)

Unbreak "ping6 -L"

$ ping6 -L ff02::1%em1
ping6: setsockopt IP6_MULTICAST_LOOP: Invalid argument

Unfortunately we have this inconsistency in the sockets API where we need
to pass an unsigned char for IP_MULTICAST_LOOP but we need an unsigned
int for IPV6_MULTICAST_LOOP.

While here, fix a typo in the error message.

OK millert@ florian@

Revision 1.217 / (download) - annotate - [select for diffs], Thu Oct 20 18:34:17 2016 UTC (7 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.216: +2 -2 lines
Diff to previous 1.216 (colored)

Only drop to _ping user if invoked as root. If invoked as an
unprivileged user just shed the setuid privs as previously.

sthen@ pointed out that you cannot kill(2) your own ping.
With this we rely on pledge(2) for unprivileged users.

OK sthen@, deraadt@ is happy with the middle ground

Revision 1.216 / (download) - annotate - [select for diffs], Wed Sep 28 06:39:12 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.215: +17 -11 lines
Diff to previous 1.215 (colored)

Always do the setgroups, setresgid and setresuid even if if the
unprivileged user is not present instead of erroring out. This lets
ping and traceroute work in restricted enviornments like the bgplg
chroot.
Problem reported by sthen@
input & prodding deraadt@

Revision 1.215 / (download) - annotate - [select for diffs], Mon Sep 26 16:42:46 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.214: +17 -12 lines
Diff to previous 1.214 (colored)

Drop privileges to newly added _ping user/group.
It does not buy us much when called as a unpriv user. But if run as
root we can now lose privileges.
OK natano@, deraadt@ is happy

Revision 1.214 / (download) - annotate - [select for diffs], Tue Sep 20 15:21:34 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.213: +3 -3 lines
Diff to previous 1.213 (colored)

whitespace

Revision 1.213 / (download) - annotate - [select for diffs], Mon Sep 19 07:08:30 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.212: +2 -12 lines
Diff to previous 1.212 (colored)

Only allow standard dot notation for IPv4 addresses.
We can get rid of inet_aton(3) and use the AF independent getaddrinfo(3).
OK natano@, krw@, millert@, claudio@

Revision 1.212 / (download) - annotate - [select for diffs], Sun Sep 18 17:27:25 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.211: +2 -2 lines
Diff to previous 1.211 (colored)

unbreak IPv6 source selection

Revision 1.211 / (download) - annotate - [select for diffs], Sun Sep 18 15:14:08 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.210: +12 -26 lines
Diff to previous 1.210 (colored)

simplify startup, since we know earlier which type of socket we need
ok florian

Revision 1.210 / (download) - annotate - [select for diffs], Sun Sep 18 14:52:14 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.209: +19 -19 lines
Diff to previous 1.209 (colored)

whitespace

Revision 1.209 / (download) - annotate - [select for diffs], Sun Sep 18 13:59:51 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.208: +2 -2 lines
Diff to previous 1.208 (colored)

If running in verbose mode and no source address has been specified
with -I find the kernel selected address and print it even for v4
addresses.
OK phessler@, natano@, mpi@, claudio@, benno@, sthen@, millert@

Revision 1.208 / (download) - annotate - [select for diffs], Sun Sep 18 13:56:15 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.207: +4 -15 lines
Diff to previous 1.207 (colored)

Do not print 'ping6' in reporting output, just 'ping'.
OK tom@, natano@, claudio@, sthen@, millert@

Revision 1.207 / (download) - annotate - [select for diffs], Sat Sep 17 21:30:02 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.206: +3 -3 lines
Diff to previous 1.206 (colored)

backwards if(v6flag); pointed out by naddy

Revision 1.206 / (download) - annotate - [select for diffs], Sat Sep 17 14:58:42 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.205: +805 -131 lines
Diff to previous 1.205 (colored)

The final merge ping6 into ping.
"why slow down?" deraadt@

Revision 1.205 / (download) - annotate - [select for diffs], Sat Sep 17 09:38:26 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.204: +2 -2 lines
Diff to previous 1.204 (colored)

Use ECHOTMLEN define; no functional change.

Revision 1.204 / (download) - annotate - [select for diffs], Sat Sep 17 09:37:19 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.203: +2 -3 lines
Diff to previous 1.203 (colored)

iov_base is already set in this case; reduce diff to ping6(8).

Revision 1.203 / (download) - annotate - [select for diffs], Sat Sep 17 09:36:42 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.202: +5 -3 lines
Diff to previous 1.202 (colored)

MAXPAYLOAD is different between ping and ping6.

Revision 1.202 / (download) - annotate - [select for diffs], Sat Sep 17 09:35:27 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.201: +2 -2 lines
Diff to previous 1.201 (colored)

Just use AF_INET like everywhere else.

Revision 1.201 / (download) - annotate - [select for diffs], Sat Sep 17 09:34:57 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.200: +2 -2 lines
Diff to previous 1.200 (colored)

malloc sets errno; use err not errx

Revision 1.200 / (download) - annotate - [select for diffs], Sat Sep 17 09:34:03 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.199: +2 -2 lines
Diff to previous 1.199 (colored)

whitespace

Revision 1.199 / (download) - annotate - [select for diffs], Sat Sep 17 09:33:32 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.198: +6 -7 lines
Diff to previous 1.198 (colored)

Make getting source address more AF independent.

Revision 1.198 / (download) - annotate - [select for diffs], Sat Sep 17 09:32:54 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.197: +37 -39 lines
Diff to previous 1.197 (colored)

If -I was not given hoist getting source address up.

Revision 1.197 / (download) - annotate - [select for diffs], Sat Sep 17 09:31:04 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.196: +15 -16 lines
Diff to previous 1.196 (colored)

Make source address selection more AF independent.

Revision 1.196 / (download) - annotate - [select for diffs], Sat Sep 17 09:30:26 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.195: +4 -4 lines
Diff to previous 1.195 (colored)

Introduce AF independent from.

Revision 1.195 / (download) - annotate - [select for diffs], Sat Sep 17 09:30:00 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.194: +7 -6 lines
Diff to previous 1.194 (colored)

Use AF independent dst where possible.

Revision 1.194 / (download) - annotate - [select for diffs], Sat Sep 17 09:29:27 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.193: +16 -16 lines
Diff to previous 1.193 (colored)

Blindly s/dst/dst4/ or s/dst/dst6/, AF independent dst will be
introduced next.

Revision 1.193 / (download) - annotate - [select for diffs], Sat Sep 17 09:26:49 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.192: +11 -10 lines
Diff to previous 1.192 (colored)

We will need the variable name "from" soon, so free it up by renaming
to peer. While here move declaration down to where it's needed. No
functional change.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Sep 17 09:26:07 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.191: +2 -2 lines
Diff to previous 1.191 (colored)

Reduce diff in pinger().

Revision 1.191 / (download) - annotate - [select for diffs], Sat Sep 17 09:22:31 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.190: +3 -4 lines
Diff to previous 1.190 (colored)

style

Revision 1.190 / (download) - annotate - [select for diffs], Sat Sep 17 09:21:59 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.189: +28 -27 lines
Diff to previous 1.189 (colored)

Move more AF independent initialization around to reduce diff.

Revision 1.189 / (download) - annotate - [select for diffs], Sat Sep 17 09:21:16 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.188: +3 -2 lines
Diff to previous 1.188 (colored)

Normalize receive packet allocation.

Revision 1.188 / (download) - annotate - [select for diffs], Sat Sep 17 09:19:44 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.187: +2 -2 lines
Diff to previous 1.187 (colored)

Use ECHOTMLEN define.

Revision 1.187 / (download) - annotate - [select for diffs], Sat Sep 17 09:17:55 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.186: +2 -2 lines
Diff to previous 1.186 (colored)

ping(8): The IPv6 header has a payload length field while IPv4 has a
length field for the whole packet. Make some room for IPv6 payload.
ping6(8): Sync to ping(8).

Revision 1.186 / (download) - annotate - [select for diffs], Sat Sep 17 09:16:32 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.185: +4 -1 lines
Diff to previous 1.185 (colored)

Bring over includes, we will need them in a merge anyway.

Revision 1.185 / (download) - annotate - [select for diffs], Sat Sep 17 09:14:30 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.184: +47 -3 lines
Diff to previous 1.184 (colored)

If no source address is specified and we are running in verbose mode
try to find it with getsockname(2) like ping6(8). Disable printing
for now though because scripts might depend on ping(8)'s output.

Revision 1.184 / (download) - annotate - [select for diffs], Tue Sep 13 07:17:40 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.183: +4 -4 lines
Diff to previous 1.183 (colored)

Rearange option handling to reduce diff between ping(8) and ping6(8).
While here be explicit that timing and timinginfo are initialized to
0.

Revision 1.183 / (download) - annotate - [select for diffs], Tue Sep 13 07:16:49 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.182: +11 -12 lines
Diff to previous 1.182 (colored)

Make the raw socket non-global and pass it to retransmit()/pinger().

Revision 1.182 / (download) - annotate - [select for diffs], Tue Sep 13 07:15:03 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.181: +2 -3 lines
Diff to previous 1.181 (colored)

No need to have the destination global.

Revision 1.181 / (download) - annotate - [select for diffs], Tue Sep 13 07:14:24 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.180: +2 -3 lines
Diff to previous 1.180 (colored)

No need to have this global.

Revision 1.180 / (download) - annotate - [select for diffs], Tue Sep 13 07:11:56 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.179: +2 -2 lines
Diff to previous 1.179 (colored)

timinginfo is a global flag that we got at least one packet back with
timing information for the summary line. Here we need to know if the
current echo reply was long enough to carry timing information.

Revision 1.179 / (download) - annotate - [select for diffs], Mon Sep 12 15:47:57 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.178: +30 -4 lines
Diff to previous 1.178 (colored)

Bring over KAME copyright, there is now code from ping in ping6. While
here nuke NetBSD, KAME and BSDI ids. With this the beginning of
ping.c and ping6.c are in sync.
prodding deraadt@

Revision 1.178 / (download) - annotate - [select for diffs], Mon Sep 12 06:02:43 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.177: +2 -2 lines
Diff to previous 1.177 (colored)

No need for have this unsigned, reduces diff to ping6(8).

Revision 1.177 / (download) - annotate - [select for diffs], Mon Sep 12 06:01:58 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.176: +11 -11 lines
Diff to previous 1.176 (colored)

Use ECHOLEN/ECHOTMLEN defines.

Revision 1.176 / (download) - annotate - [select for diffs], Sun Sep 11 19:59:25 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.175: +5 -3 lines
Diff to previous 1.175 (colored)

bring over LEN defines from ping6(8)

Revision 1.175 / (download) - annotate - [select for diffs], Sun Sep 11 19:44:43 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.174: +2 -2 lines
Diff to previous 1.174 (colored)

The canonical way to find out if we can have timing stats is timinginfo.

Revision 1.174 / (download) - annotate - [select for diffs], Sun Sep 11 18:28:31 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.173: +17 -16 lines
Diff to previous 1.173 (colored)

Normalize variable declarations in pr_pack. While here introduce seq
variable in ping and normalize it's usage.

Revision 1.173 / (download) - annotate - [select for diffs], Sun Sep 11 18:27:44 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.172: +2 -2 lines
Diff to previous 1.172 (colored)

use fputc to put in sync with ping6

Revision 1.172 / (download) - annotate - [select for diffs], Sun Sep 11 18:24:44 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.171: +28 -15 lines
Diff to previous 1.171 (colored)

Introduce pr_ipopt() to remove IPv4 specifics from pr_pack(); small
step to make this AF independent.

Revision 1.171 / (download) - annotate - [select for diffs], Sun Sep 11 18:21:09 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.170: +20 -20 lines
Diff to previous 1.170 (colored)

Hoist pr_addr() up, it's AF independent; no obj change.

Diff between ping and ping6 is easier to read if all identical
or as close as possible to being identical functions are in one place.

Revision 1.170 / (download) - annotate - [select for diffs], Sun Sep 11 18:19:32 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.169: +29 -29 lines
Diff to previous 1.169 (colored)

Hoist summary() up, it's AF independent; no obj change.

Diff between ping and ping6 is easier to read if all identical
or as close as possible to being identical functions are in one place.

Revision 1.169 / (download) - annotate - [select for diffs], Sun Sep 11 18:18:25 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.168: +31 -31 lines
Diff to previous 1.168 (colored)

Hoist fill() up, it's AF independent; no obj change.

Diff between ping and ping6 is easier to read if all identical
or as close as possible to being identical functions are in one place.

Revision 1.168 / (download) - annotate - [select for diffs], Sun Sep 11 18:04:07 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.167: +7 -7 lines
Diff to previous 1.167 (colored)

Pass from around as struct sockaddr.

Revision 1.167 / (download) - annotate - [select for diffs], Sun Sep 11 18:03:12 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.166: +3 -39 lines
Diff to previous 1.166 (colored)

Get rid of check_icmph(), it's just a convoluted way of saying: Is
this an ICMP echo reply. But we want to print things if it's not an
echo reply!

Revision 1.166 / (download) - annotate - [select for diffs], Sun Sep 11 18:01:24 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.165: +10 -10 lines
Diff to previous 1.165 (colored)

Move smsghdr initialization into main, another step towards AF
independent pinger().

Revision 1.165 / (download) - annotate - [select for diffs], Sun Sep 11 17:58:21 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.164: +14 -4 lines
Diff to previous 1.164 (colored)

Switch to sendmsg like ping6(8).

Revision 1.164 / (download) - annotate - [select for diffs], Sun Sep 11 17:55:05 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.163: +3 -4 lines
Diff to previous 1.163 (colored)

pinger() is no longer called in a sighandler since some time, just
printf(3).

Revision 1.163 / (download) - annotate - [select for diffs], Sun Sep 11 17:50:56 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.162: +1 -5 lines
Diff to previous 1.162 (colored)

Remove destination IP from mac, it's not helping anything.
Next step in making these functions AF independent. Note that before
rev 1.147 of ping6(8) it did not put the destination IP into the mac,
only ping(8) did.

Revision 1.162 / (download) - annotate - [select for diffs], Sun Sep 11 11:19:27 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.161: +7 -5 lines
Diff to previous 1.161 (colored)

normalize seq handling in pinger; little step to make this AF
independent

Revision 1.161 / (download) - annotate - [select for diffs], Sun Sep 11 11:18:11 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.160: +20 -24 lines
Diff to previous 1.160 (colored)

Correctly initialize source address for multicast pings. This got
broken 9 months ago in 1.136, sorry about that!

Revision 1.160 / (download) - annotate - [select for diffs], Sat Sep 10 07:47:00 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.159: +4 -2 lines
Diff to previous 1.159 (colored)

The getopt while loop is very long, put the body in {}.
Removes a "Huh, that's weird" diff to ping6. No object change.

Revision 1.159 / (download) - annotate - [select for diffs], Sat Sep 10 07:46:20 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.158: +3 -2 lines
Diff to previous 1.158 (colored)

reorder main variables, no object change, reduces diff to ping6

Revision 1.158 / (download) - annotate - [select for diffs], Sat Sep 10 07:42:20 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.157: +3 -3 lines
Diff to previous 1.157 (colored)

reorder main variables, reduces diff

Revision 1.157 / (download) - annotate - [select for diffs], Sat Sep 10 07:40:58 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.156: +2 -2 lines
Diff to previous 1.156 (colored)

reorder main variables; no obj change

Revision 1.156 / (download) - annotate - [select for diffs], Sat Sep 10 07:39:49 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.155: +5 -5 lines
Diff to previous 1.155 (colored)

packet is actually u_char, pass it around as one

Revision 1.155 / (download) - annotate - [select for diffs], Sat Sep 10 07:31:43 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.154: +16 -15 lines
Diff to previous 1.154 (colored)

reorder function declaration to reduce diff between ping and ping6; no
object change

Revision 1.154 / (download) - annotate - [select for diffs], Thu Sep 8 13:59:33 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.153: +2 -1 lines
Diff to previous 1.153 (colored)

normalize option defines; reduces diff between ping(8) and ping6(8)

Revision 1.153 / (download) - annotate - [select for diffs], Thu Sep 8 13:58:15 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.152: +2 -1 lines
Diff to previous 1.152 (colored)

We need this for struct iovec; reduces diff to ping6(8)

Revision 1.152 / (download) - annotate - [select for diffs], Wed Sep 7 17:56:00 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.151: +1 -2 lines
Diff to previous 1.151 (colored)

whitespace

Revision 1.151 / (download) - annotate - [select for diffs], Wed Sep 7 17:55:14 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.150: +2 -2 lines
Diff to previous 1.150 (colored)

normalize code to send preload packets

Revision 1.150 / (download) - annotate - [select for diffs], Wed Sep 7 17:53:53 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.149: +4 -4 lines
Diff to previous 1.149 (colored)

move header printing down; reduces diff to ping6

Revision 1.149 / (download) - annotate - [select for diffs], Wed Sep 7 17:52:56 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.148: +4 -4 lines
Diff to previous 1.148 (colored)

move arc4random down; reduces diff to ping6

Revision 1.148 / (download) - annotate - [select for diffs], Sun Sep 4 09:36:37 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.147: +45 -17 lines
Diff to previous 1.147 (colored)

Switch ping to getaddrinfo while retaining inet_aton functionality as
has been done in the traceroute merge.

Revision 1.147 / (download) - annotate - [select for diffs], Sat Sep 3 21:50:52 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.146: +3 -7 lines
Diff to previous 1.146 (colored)

How can this not be AF_INET?!

Revision 1.146 / (download) - annotate - [select for diffs], Sat Sep 3 21:49:55 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.145: +12 -14 lines
Diff to previous 1.145 (colored)

s/to/dst/

Revision 1.145 / (download) - annotate - [select for diffs], Sat Sep 3 21:48:51 2016 UTC (7 years, 8 months ago) by florian
Branch: MAIN
Changes since 1.144: +10 -10 lines
Diff to previous 1.144 (colored)

s/whereto/dst/

Revision 1.144 / (download) - annotate - [select for diffs], Fri Sep 2 21:46:18 2016 UTC (7 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.143: +42 -32 lines
Diff to previous 1.143 (colored)

In preparation for merging of ping(8) and ping6(8) the -n flag needs to
become the default. That means no DNS reverse look ups per default.
In practice this doesn't change anything since ping(8) only did
reverse DNS look ups per for weird corner cases:
1) Something that's not an echo reply and -v was specified
2) LSRR or RR IP options

With this pr_addr() can become the default address printing mechanism
and can be made AF independent. With that we get ping(8)'s -H option
for free.

OK sthen@, benno@
OK deraadt@ for the -H a long time ago when this were two diffs.
man page tweak jmc@ a long time ago
deraadt@ softened up and has no objections to -n per default
beck@ is in favor of no look ups per default.

Revision 1.143 / (download) - annotate - [select for diffs], Fri Sep 2 14:15:58 2016 UTC (7 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.142: +2 -2 lines
Diff to previous 1.142 (colored)

timinginfo is a flag to track if the received icmp packet is big
enough to carry timing information.
Do not treat it as a counter as it could overflow.

Revision 1.142 / (download) - annotate - [select for diffs], Tue Aug 30 14:28:31 2016 UTC (7 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.141: +10 -28 lines
Diff to previous 1.141 (colored)

summary() is no longer called from a signal handler, so it can use
stdio and does not need the workarounds.
ok florian millert

Revision 1.141 / (download) - annotate - [select for diffs], Tue Aug 30 13:58:12 2016 UTC (7 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.140: +19 -36 lines
Diff to previous 1.140 (colored)

Avoid calling summary() from a signal handler.  This will allow us
to go back to using stdio there.  OK florian@ deraadt@

Revision 1.140 / (download) - annotate - [select for diffs], Tue Aug 30 12:10:10 2016 UTC (7 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.139: +3 -3 lines
Diff to previous 1.139 (colored)

usage() is __dead.
While here remove one useless call to usage() that's covered by the
very next line.

Revision 1.139 / (download) - annotate - [select for diffs], Thu Mar 3 18:30:48 2016 UTC (8 years, 3 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.138: +14 -12 lines
Diff to previous 1.138 (colored)

ping(8) and ping6(8) use different types for packet counters. In
preparation of a merge just use int64_t and be done with it.
OK deraadt

Revision 1.138 / (download) - annotate - [select for diffs], Sat Jan 30 05:38:26 2016 UTC (8 years, 4 months ago) by semarie
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.137: +7 -7 lines
Diff to previous 1.137 (colored)

ping, ping6: corrects -E (audible beep when no packet is received before the
next packet is transmitted) regression

with help and ok florian@

Revision 1.137 / (download) - annotate - [select for diffs], Sun Nov 29 22:42:13 2015 UTC (8 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.136: +175 -121 lines
Diff to previous 1.136 (colored)

use ping6(8)'s engine; next step in unification
OK benno@

Revision 1.136 / (download) - annotate - [select for diffs], Sun Nov 29 22:41:20 2015 UTC (8 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.135: +29 -23 lines
Diff to previous 1.135 (colored)

Reimplement source address selection. Inspired by the previous
traceroute / traceroute6 merge. Next step in unification.
OK benno@

Revision 1.135 / (download) - annotate - [select for diffs], Sun Nov 29 12:32:10 2015 UTC (8 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.134: +2 -2 lines
Diff to previous 1.134 (colored)

Doubles are not reals. Imprecision might lead to trying to
calculate square root of a negative number. Just use 0 in this case.
Pointed out by and fix from Nathanael Rensen ( nathanael AT list DOT
polymorpheus DOT com ), thanks!
OK deraadt@

(Funnily this bug was in ping6 for many years, only discovered once I
synced ping to the ping6 implementation recently.)

Revision 1.134 / (download) - annotate - [select for diffs], Tue Nov 10 18:36:33 2015 UTC (8 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.133: +9 -10 lines
Diff to previous 1.133 (colored)

Reduce diff between ping and ping6.
- increase MAX_DUP_CHK in ping to ping6' value, we should have enough
  ram these days.
- sync -l, -s and -V option handling
- rename MAXDATALEN to MAXPAYLOAD in ping6
no (intendet) functional change.
OK benno@

Revision 1.133 / (download) - annotate - [select for diffs], Thu Nov 5 21:53:35 2015 UTC (8 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.132: +10 -10 lines
Diff to previous 1.132 (colored)

Reorder #includes to reduce diff between ping and ping6.

Revision 1.132 / (download) - annotate - [select for diffs], Wed Nov 4 21:26:30 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.131: +2 -2 lines
Diff to previous 1.131 (colored)

replace setbuf with setvbuf, from Frederic Nowak

Revision 1.131 / (download) - annotate - [select for diffs], Fri Oct 30 11:00:52 2015 UTC (8 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.130: +19 -42 lines
Diff to previous 1.130 (colored)

Use double variables and sqrt(3) from libm to calculate statistics like
ping6 does.
OK benno@

Revision 1.130 / (download) - annotate - [select for diffs], Thu Oct 29 13:01:29 2015 UTC (8 years, 7 months ago) by florian
Branch: MAIN
Changes since 1.129: +5 -23 lines
Diff to previous 1.129 (colored)

Backout chacha.
It's getting in the way of the merge and it's not supposed to pull in
a private header.
Prodding deraadt@

Revision 1.129 / (download) - annotate - [select for diffs], Tue Oct 27 13:58:45 2015 UTC (8 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.128: +4 -4 lines
Diff to previous 1.128 (colored)

fix fallout from chacha changes.

Revision 1.128 / (download) - annotate - [select for diffs], Sun Oct 11 00:20:29 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.127: +2 -4 lines
Diff to previous 1.127 (colored)

Prefer dprintf() over snprintf()+write()

ok beck@ deraadt@

Revision 1.127 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:06 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.126: +5 -5 lines
Diff to previous 1.126 (colored)

Change all tame callers to namechange to pledge(2).

Revision 1.126 / (download) - annotate - [select for diffs], Sat Oct 3 00:44:37 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.125: +9 -1 lines
Diff to previous 1.125 (colored)

ping is a setuid root priv-drop which holds a sockraw.  we can tame it
substantially with "stdio inet", plus "dns" if the -n option is missing.
a successful exploit against it then cannot create files, or perform a
variety of other operations, as described in the tame(2) man page.
work with florian a while back
ok doug

Revision 1.125 / (download) - annotate - [select for diffs], Thu Sep 3 17:59:54 2015 UTC (8 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.124: +28 -28 lines
Diff to previous 1.124 (colored)

Move tricky system calls up and sensitive data calculations down so
that tame(2) can sit in the middle.
diff from deraadt@
"you can commit that diff" deraadt@

Revision 1.124 / (download) - annotate - [select for diffs], Wed Aug 5 12:46:12 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.123: +3 -3 lines
Diff to previous 1.123 (colored)

repair buffer size checks around chacha block, spotted by Dimitris Papastamos
ok florian

Revision 1.123 / (download) - annotate - [select for diffs], Sat May 2 18:03:37 2015 UTC (9 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.122: +7 -11 lines
Diff to previous 1.122 (colored)

de-castify strtonum to make it consistent again.
Pointed out by bluhm@; no object change.
OK bluhm@, krw@

Revision 1.122 / (download) - annotate - [select for diffs], Sat May 2 17:16:07 2015 UTC (9 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.121: +2 -2 lines
Diff to previous 1.121 (colored)

A ttl of 0 is valid. While here use MAXTTL instead of 255.
Input bluhm@, OK krw@

Revision 1.121 / (download) - annotate - [select for diffs], Mon Apr 20 00:36:51 2015 UTC (9 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.120: +4 -1 lines
Diff to previous 1.120 (colored)

fold the icmp seq number into the mac.

i dont know why i missed this before.

Revision 1.120 / (download) - annotate - [select for diffs], Sun Apr 19 12:56:42 2015 UTC (9 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.119: +24 -5 lines
Diff to previous 1.119 (colored)

by default fill the ping payload with a chacha stream instead of
an unvarying payload.

each ping process generates a random key, and each packet then uses
the timestamps mac as the IV for the stream.

this allows us to have a different payload per packet that we can
recalculate and compare in the same was as the static payload was
checked before. by aggressively varying the payload we hope to
generate more opportunities for dodgy network equipment to show
errors.

note that we do siphash before chacha because we want to be strict
about the timestamp payload, but we want to be able to recognise
errors in the rest of the payload and where those errors were. doing
chacha before siphash would have us than fail the whole packet if
a checksum doesnt match.

discussed with jp aumasson
ok florian@

Revision 1.119 / (download) - annotate - [select for diffs], Sun Apr 19 12:45:37 2015 UTC (9 years, 1 month ago) by dlg
Branch: MAIN
Changes since 1.118: +56 -19 lines
Diff to previous 1.118 (colored)

add a mac to the timestamp payload and calculate it with siphash.

this lets us have some confidence that the timestamp hasnt been
damaged or tampered with in transit.

discussed with jp aumasson
ok florian@

Revision 1.118 / (download) - annotate - [select for diffs], Mon Mar 23 09:36:25 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.117: +13 -5 lines
Diff to previous 1.117 (colored)

obfuscate the monotonic clock values we put on the wire by offsetting
them with a random value.

picking between ^ and +- as the operator for the obfuscation has
turned out to be a great bikeshed. im picking + and - cos it prevents
observers seeing high bits roll over which can indicate the magnitude
of the current clock value.

discussed with many.

Revision 1.117 / (download) - annotate - [select for diffs], Thu Mar 12 09:54:11 2015 UTC (9 years, 2 months ago) by florian
Branch: MAIN
Changes since 1.116: +8 -7 lines
Diff to previous 1.116 (colored)

Only read time information from the received packet if it is big
enough.
OK deraadt@

Revision 1.116 / (download) - annotate - [select for diffs], Thu Mar 12 00:14:29 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.115: +22 -26 lines
Diff to previous 1.115 (colored)

bump the size of the time types on the wire to 64bit, and use nsec
instead of usec so its easier to translate to/from timespecs instead
of timevals.

ok deraadt@ florian@

Revision 1.115 / (download) - annotate - [select for diffs], Wed Mar 11 03:35:17 2015 UTC (9 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.114: +9 -3 lines
Diff to previous 1.114 (colored)

use clock_gettime(CLOCK_MONOTONIC) to get timestamps to measure the
interval between sending a ping and getting a reply for it.

this makes it resistant against local wall clock changes, which can
skew the intervals reported or make them go negative.

ok deraadt@ florian@
makes sense to lots of others

Revision 1.114 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:00 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.113: +4 -3 lines
Diff to previous 1.113 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.113 / (download) - annotate - [select for diffs], Thu Nov 20 15:22:39 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.112: +1 -2 lines
Diff to previous 1.112 (colored)

remove sys/file.h includes in favor of fcntl.h where needed.
ok deraadt guenther

Revision 1.112 / (download) - annotate - [select for diffs], Sat Oct 25 03:18:13 2014 UTC (9 years, 7 months ago) by lteo
Branch: MAIN
Changes since 1.111: +1 -2 lines
Diff to previous 1.111 (colored)

Remove unnecessary netinet/in_systm.h include.

ok millert@

Revision 1.111 / (download) - annotate - [select for diffs], Fri Jul 11 15:30:47 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.110: +3 -4 lines
Diff to previous 1.110 (colored)

__dead for finish()
OK benno@

Revision 1.110 / (download) - annotate - [select for diffs], Fri Jul 11 15:29:46 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (colored)

Silence compiler warning and build with -Wall etc.
OK benno@

Revision 1.109 / (download) - annotate - [select for diffs], Fri Jul 11 15:26:55 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.108: +5 -5 lines
Diff to previous 1.108 (colored)

use optval for setsockopt; sync with ping6
OK benno@

Revision 1.108 / (download) - annotate - [select for diffs], Wed Jul 9 15:24:19 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.107: +1 -25 lines
Diff to previous 1.107 (colored)

We do have icmp_data; no obj change.
OK benno@

Revision 1.107 / (download) - annotate - [select for diffs], Wed Jul 9 15:23:29 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.106: +1 -5 lines
Diff to previous 1.106 (colored)

We do have ICMP_MASKREQ & ICMP_MASKREPLY; no obj change.
OK benno@

Revision 1.106 / (download) - annotate - [select for diffs], Wed Jul 9 15:22:36 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.105: +1 -17 lines
Diff to previous 1.105 (colored)

notdef is notdef since the beginning of time; no obj change.
OK benno@

Revision 1.105 / (download) - annotate - [select for diffs], Wed Jul 9 15:21:41 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.104: +1 -3 lines
Diff to previous 1.104 (colored)

We do have SIGINFO; no obj change.
OK benno@

Revision 1.104 / (download) - annotate - [select for diffs], Wed Jul 9 15:20:51 2014 UTC (9 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.103: +1 -7 lines
Diff to previous 1.103 (colored)

We do have IP_OPTIONS; no obj change.
OK benno@

Revision 1.103 / (download) - annotate - [select for diffs], Mon Apr 28 15:25:34 2014 UTC (10 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.102: +3 -10 lines
Diff to previous 1.102 (colored)

Do not sleep after poll returning an error. Blindly copied over from
ping6 to ping by me without thinking clearly.
pointed out by deraadt@
OK jca@

Revision 1.102 / (download) - annotate - [select for diffs], Wed Apr 23 18:16:36 2014 UTC (10 years, 1 month ago) by jca
Branch: MAIN
Changes since 1.101: +16 -13 lines
Diff to previous 1.101 (colored)

Better name for fdmaskp, reduce the scope of some variables, don't abuse
cc for poll()'s return value, and indent decls.  ok florian@

Revision 1.101 / (download) - annotate - [select for diffs], Wed Apr 23 12:27:31 2014 UTC (10 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.100: +18 -17 lines
Diff to previous 1.100 (colored)

Replace malloc / memset / select song and dance with poll(2) like
ping6.
Prompted by and initial diff from Peter Malone (peter _AT_
petermalone _DOT_ org), thanks!
OK jca@

Revision 1.100 / (download) - annotate - [select for diffs], Mon Mar 24 11:11:49 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.99: +4 -10 lines
Diff to previous 1.99 (colored)

Remove "-r" option from ping(8) and traceroute{,6}(8).  You've probably
never heard about it, it was to bypass the routing tables, not available
for IPv6 and we're going to always use the routing tables soon.

ok florian@, man pages ok jmc@

Revision 1.99 / (download) - annotate - [select for diffs], Fri Jan 10 21:57:44 2014 UTC (10 years, 4 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

Fix the unitialized rtableid bug discovered and fixed in the previous
commit by brad@ by calling setsockopt SO_RTABLE only when -V is
present. As a bonus drop privileges very early in main, before option
parsing.
This brings ping6 more in line with what ping does and will make
eventual unification easier.

OK deraadt@
"works for me" brad@

Revision 1.98 / (download) - annotate - [select for diffs], Fri Jan 10 06:18:40 2014 UTC (10 years, 4 months ago) by brad
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

Fix a bug found in ping6 when rebuilding with stack protector strong.
rtableid is unitialized; the stack protector strong binary would fail
to set the routing table id. Copy the rtableid initialization over to
ping to keep what is essentially similar code in sync.

ok deraadt@

Revision 1.97 / (download) - annotate - [select for diffs], Fri Nov 22 04:12:48 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

Whole bunch of (unsigned char) casts carefully added for ctype calls.
Careful second audit by millert

Revision 1.96 / (download) - annotate - [select for diffs], Mon Oct 28 15:05:35 2013 UTC (10 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

use %d instead of %i in a few fprintf for clarity

Revision 1.95 / (download) - annotate - [select for diffs], Thu Sep 12 23:06:44 2013 UTC (10 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.94: +2 -2 lines
Diff to previous 1.94 (colored)

Misc time_t tweaks. %ld / (long)tv_sec -> %lld / (long long)tv_sec.
Eliminate unneeded casts. suggestions from & ok millert@ guenther@

Revision 1.94 / (download) - annotate - [select for diffs], Tue Apr 16 22:10:34 2013 UTC (11 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.93: +19 -19 lines
Diff to previous 1.93 (colored)

improve name of the 32-bit timeval that ping uses, and bound the use
a bit better.  discussed with guenther

Revision 1.93 / (download) - annotate - [select for diffs], Tue Dec 4 02:24:47 2012 UTC (11 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.92: +2 -2 lines
Diff to previous 1.92 (colored)

remove some unnecessary sys/param.h inclusions

Revision 1.92 / (download) - annotate - [select for diffs], Sat Mar 17 10:16:40 2012 UTC (12 years, 2 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.91: +2 -9 lines
Diff to previous 1.91 (colored)

remove IP_JUMBO, SO_JUMBO, and RTF_JUMBO.

no objection from mcbride@ krw@ markus@ deraadt@

Revision 1.91 / (download) - annotate - [select for diffs], Tue Sep 20 09:46:19 2011 UTC (12 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.90: +3 -3 lines
Diff to previous 1.90 (colored)

rev 1.80 added calls from the signal handler to stdio.  bad bad bad!
use system calls directly, instead.

Revision 1.90 / (download) - annotate - [select for diffs], Sat Sep 17 14:10:05 2011 UTC (12 years, 8 months ago) by haesbaert
Branch: MAIN
Changes since 1.89: +73 -6 lines
Diff to previous 1.89 (colored)

Standarize the ToS option across nc/ping/traceroute so that they'll
accept the same values as pf.conf. It accepts decimal, hexadecimal and
the dscp/tos keywords. The ping option was ripped of in SMALL.

ok mcbride@ sthen@

Revision 1.89 / (download) - annotate - [select for diffs], Tue Jun 21 17:31:07 2011 UTC (12 years, 11 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

Convert SO_RTABLE's protocol level to the SOL_SOCKET;  ok claudio

Revision 1.88 / (download) - annotate - [select for diffs], Sat Jul 3 04:44:51 2010 UTC (13 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.87: +8 -8 lines
Diff to previous 1.87 (colored)

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains.  This changes the name of the
system calls, socket option, and ioctl.  After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me

Revision 1.87 / (download) - annotate - [select for diffs], Sat Jun 26 18:30:03 2010 UTC (13 years, 11 months ago) by phessler
Branch: MAIN
Changes since 1.86: +3 -2 lines
Diff to previous 1.86 (colored)

allow a user to set a -c count of 0.
while here, change ping6 to use strtonum instead of strtol.

OK claudio@

Revision 1.86 / (download) - annotate - [select for diffs], Thu Dec 24 10:06:35 2009 UTC (14 years, 5 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.85: +2 -2 lines
Diff to previous 1.85 (colored)

spelling fixes, from Brad Tilley; we will not fix src/sbin/dump/dump.h
as neither arrayified not arrayfied exist -- sanctioned dictionaries
like Merriam-Webster ones suggest a few alternatives (e.g., arrayed),
however these made up words are easy to understand and we are not
certain that current ones are not ok.

ok jmc@

Revision 1.85 / (download) - annotate - [select for diffs], Tue Dec 15 21:09:43 2009 UTC (14 years, 5 months ago) by mpf
Branch: MAIN
Changes since 1.84: +7 -4 lines
Diff to previous 1.84 (colored)

Let ping handle truncated echo replies.
Instead of a false data mismatch report, we now print (TRUNC!).
This also fixes two out of bounds accesses.
The "wrong data byte #XXX" counter was also wrong and off by 8 bytes.
OK djm@ on an earlier version, OK deraadt@.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:34 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.83: +1 -15 lines
Diff to previous 1.83 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.83 / (download) - annotate - [select for diffs], Fri Jun 5 00:11:26 2009 UTC (15 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (colored)

Fix usage.

Revision 1.82 / (download) - annotate - [select for diffs], Fri Jun 5 00:07:47 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.81: +17 -4 lines
Diff to previous 1.81 (colored)

Allow ping to use an alternate routing domain by using the -V flag.

Revision 1.81 / (download) - annotate - [select for diffs], Mon Jun 1 14:16:02 2009 UTC (15 years ago) by jmc
Branch: MAIN
Changes since 1.80: +3 -3 lines
Diff to previous 1.80 (colored)

tweak previous;

Revision 1.80 / (download) - annotate - [select for diffs], Sun May 31 17:33:39 2009 UTC (15 years ago) by ckuethe
Branch: MAIN
Changes since 1.79: +23 -4 lines
Diff to previous 1.79 (colored)

add audible output to ping and ping6: -e beeps when pings are replied, -E beeps when
pings are dropped.

suggestion to make ping and ping6 use the same flag from deraadt & sthen.
reminder to not forget about ping6 from todd and naddy.

ok deraadt, sthen
"well, i don't object..." from a few others.

Revision 1.79 / (download) - annotate - [select for diffs], Thu Apr 23 23:18:35 2009 UTC (15 years, 1 month ago) by sthen
Branch: MAIN
Changes since 1.78: +3 -4 lines
Diff to previous 1.78 (colored)

ping -v can segfault when displaying received icmp packets that aren't
echo replies. it's because the pointer arithmetic is scaled to the size
of struct icmp, so 28*28 bytes are added rather than just 28. fortunately
a correct value was calculated 2 lines earlier, so we can just use that.

"thats a cool fix" dlg, ok deraadt

Revision 1.78 / (download) - annotate - [select for diffs], Tue Feb 6 15:25:18 2007 UTC (17 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

remove -j from usage();

Revision 1.77 / (download) - annotate - [select for diffs], Thu Apr 13 00:49:15 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.76: +5 -6 lines
Diff to previous 1.76 (colored)

fix more signal races; ok moritz

Revision 1.76 / (download) - annotate - [select for diffs], Mon Apr 10 08:05:13 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.75: +7 -7 lines
Diff to previous 1.75 (colored)

minimal cleanups prompted by lint; ok otto

Revision 1.75 / (download) - annotate - [select for diffs], Thu Mar 23 03:30:49 2006 UTC (18 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.74: +7 -7 lines
Diff to previous 1.74 (colored)

sloppy style to cast the sockaddrs backwards, and then potentially wrong size; ok cloder

Revision 1.74 / (download) - annotate - [select for diffs], Mon Mar 6 10:45:56 2006 UTC (18 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.73: +6 -4 lines
Diff to previous 1.73 (colored)

convert permanent privilege revocation to use setresuid/setresgid;
ok henning@

Revision 1.73 / (download) - annotate - [select for diffs], Mon Jan 9 22:42:35 2006 UTC (18 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.72: +18 -21 lines
Diff to previous 1.72 (colored)

some minor types house cleaning, ok otto

Revision 1.72 / (download) - annotate - [select for diffs], Thu Sep 1 17:59:13 2005 UTC (18 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.71: +5 -5 lines
Diff to previous 1.71 (colored)

Comment fix and make description of -c and -w match reality more
closely. ok millert@ deraadt@

Revision 1.71 / (download) - annotate - [select for diffs], Fri May 27 04:55:27 2005 UTC (19 years ago) by mcbride
Branch: MAIN
Changes since 1.70: +24 -16 lines
Diff to previous 1.70 (colored)

Experimental support for opportunitic use of jumbograms where only some hosts
on the local network support them.

This adds a new socket option, SO_JUMBO, and a new route flag,
RTF_JUMBO. If _both_ the socket option is set and the route for the host
has RTF_JUMBO set, ip_output will fragment the packet to the largest
possible size for the link, ignoring the card's MTU.

The semantics of this feature will be evolving rapidly; talk to us
if you intend to use it.

ok deraadt@ marius@

Revision 1.70 / (download) - annotate - [select for diffs], Wed Jan 19 13:40:47 2005 UTC (19 years, 4 months ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.69: +6 -3 lines
Diff to previous 1.69 (colored)

Don't ignore a provided source address, when building an own IP header.
This makes the -I option work together with -D, -T and -t.
OK deraadt@, hshoexer@, markus@

Revision 1.69 / (download) - annotate - [select for diffs], Tue Sep 14 23:52:46 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.68: +6 -6 lines
Diff to previous 1.68 (colored)

df is a flag, not some u_char thing with -1 value; millert ok

Revision 1.68 / (download) - annotate - [select for diffs], Tue Sep 14 23:51:34 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.67: +4 -2 lines
Diff to previous 1.67 (colored)

ARGSUSED before signal handler with unused signo

Revision 1.67 / (download) - annotate - [select for diffs], Mon May 3 20:55:46 2004 UTC (20 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.66: +26 -34 lines
Diff to previous 1.66 (colored)

Use libc strtonum, not private copy.  Based on a diff from tedu@.
OK otto@

Revision 1.66 / (download) - annotate - [select for diffs], Wed Apr 7 14:09:35 2004 UTC (20 years, 1 month ago) by aaron
Branch: MAIN
Changes since 1.65: +3 -3 lines
Diff to previous 1.65 (colored)

Remove those option letters from the getopt string which do not have a case
handler below. millert@ ok

Revision 1.65 / (download) - annotate - [select for diffs], Sun Mar 21 20:00:55 2004 UTC (20 years, 2 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.64: +3 -2 lines
Diff to previous 1.64 (colored)

don't leak the stack on -R; ok deraadt@

Revision 1.64 / (download) - annotate - [select for diffs], Sun Feb 29 05:19:37 2004 UTC (20 years, 3 months ago) by tedu
Branch: MAIN
Changes since 1.63: +44 -35 lines
Diff to previous 1.63 (colored)

better strtol with consistent usage, unsigned where appropriate, -Wall clean.
with some help and ok tdeval@

Revision 1.63 / (download) - annotate - [select for diffs], Thu Jul 24 03:10:04 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.62: +4 -4 lines
Diff to previous 1.62 (colored)

make packet loss double and print using %.1lf; based on diff from jeffi@rcn.com

Revision 1.62 / (download) - annotate - [select for diffs], Wed Jul 2 21:44:58 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.61: +3 -2 lines
Diff to previous 1.61 (colored)

missing protos

Revision 1.61 / (download) - annotate - [select for diffs], Wed Jun 11 06:22:14 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.60: +3 -4 lines
Diff to previous 1.60 (colored)

ansification

Revision 1.60 / (download) - annotate - [select for diffs], Mon Jun 2 20:06:16 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.59: +3 -7 lines
Diff to previous 1.59 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.59 / (download) - annotate - [select for diffs], Mon Apr 14 19:57:38 2003 UTC (21 years, 1 month ago) by cloder
Branch: MAIN
Changes since 1.58: +5 -3 lines
Diff to previous 1.58 (colored)

Defer incrementing ntransmitted until we are sure sendto succeeds.

Revision 1.58 / (download) - annotate - [select for diffs], Mon Apr 14 10:21:03 2003 UTC (21 years, 1 month ago) by itojun
Branch: MAIN
Changes since 1.57: +3 -3 lines
Diff to previous 1.57 (colored)

permit -s0.  from Maxim Konovalov

Revision 1.57 / (download) - annotate - [select for diffs], Fri Sep 6 21:17:39 2002 UTC (21 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.56: +12 -10 lines
Diff to previous 1.56 (colored)

socklen_t and various other minor tweaks

Revision 1.56 / (download) - annotate - [select for diffs], Wed Jul 3 09:39:28 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.55: +30 -36 lines
Diff to previous 1.55 (colored)

convert to ansi.  suddenly realise that means yet another function is a
signal handler in some cases, and make it cope with the termination race.

Revision 1.55 / (download) - annotate - [select for diffs], Sat Jun 29 07:56:44 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.54: +4 -7 lines
Diff to previous 1.54 (colored)

IPPROTO_ICMP will not change in our life; itojun ok

Revision 1.54 / (download) - annotate - [select for diffs], Sat Jun 22 22:47:45 2002 UTC (21 years, 11 months ago) by jakob
Branch: MAIN
Changes since 1.53: +4 -4 lines
Diff to previous 1.53 (colored)

document -T option, PR#2766. ok deraadt@

Revision 1.53 / (download) - annotate - [select for diffs], Fri May 31 04:54:36 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.52: +34 -38 lines
Diff to previous 1.52 (colored)

KNF

Revision 1.52 / (download) - annotate - [select for diffs], Fri May 31 04:53:10 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.51: +43 -22 lines
Diff to previous 1.51 (colored)

kill the signal races

Revision 1.51 / (download) - annotate - [select for diffs], Fri May 31 01:11:31 2002 UTC (22 years ago) by itojun
Branch: MAIN
Changes since 1.50: +3 -3 lines
Diff to previous 1.50 (colored)

clarify comment when nreceived > ntransmitted.  from deraadt

Revision 1.50 / (download) - annotate - [select for diffs], Sun Feb 17 02:04:38 2002 UTC (22 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.49: +4 -4 lines
Diff to previous 1.49 (colored)

correct arithmetic brain damage; maxim@macomnet.ru

Revision 1.49 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:37 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.48: +10 -10 lines
Diff to previous 1.48 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.48 / (download) - annotate - [select for diffs], Mon Jan 28 08:08:20 2002 UTC (22 years, 4 months ago) by hugh
Branch: MAIN
Changes since 1.47: +5 -6 lines
Diff to previous 1.47 (colored)

Request enough buffer space to fit the maximum size of a packet.
Problem noticed by Art, and fix checked by Markus and Niels.

Revision 1.47 / (download) - annotate - [select for diffs], Mon Nov 5 07:39:17 2001 UTC (22 years, 7 months ago) by mpech
Branch: MAIN
Changes since 1.46: +14 -14 lines
Diff to previous 1.46 (colored)

kill more registers;

millert@ ok

Revision 1.46 / (download) - annotate - [select for diffs], Thu Oct 4 07:37:24 2001 UTC (22 years, 8 months ago) by jakob
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored)

trim warnx output

Revision 1.45 / (download) - annotate - [select for diffs], Wed Oct 3 19:36:49 2001 UTC (22 years, 8 months ago) by jakob
Branch: MAIN
Changes since 1.44: +13 -3 lines
Diff to previous 1.44 (colored)

try to increase receive buffer size, <ft@pi.se>. ok deraadt@

Revision 1.44 / (download) - annotate - [select for diffs], Fri Jan 12 20:07:05 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

remove extra + character in status output

Revision 1.43 / (download) - annotate - [select for diffs], Thu Jan 11 19:22:09 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.42: +3 -2 lines
Diff to previous 1.42 (colored)

comment on a signal race

Revision 1.42 / (download) - annotate - [select for diffs], Thu Dec 21 00:25:17 2000 UTC (23 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.41: +3 -4 lines
Diff to previous 1.41 (colored)

use strlcpy

Revision 1.41 / (download) - annotate - [select for diffs], Sat Jan 22 20:25:04 2000 UTC (24 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.40: +2 -4 lines
Diff to previous 1.40 (colored)

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)

Revision 1.40 / (download) - annotate - [select for diffs], Tue Oct 12 18:10:16 1999 UTC (24 years, 7 months ago) by hugh
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

avoid an infinite loop

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jul 18 16:21:55 1999 UTC (24 years, 10 months ago) by hugh
Branch: MAIN
Changes since 1.38: +52 -13 lines
Diff to previous 1.38 (colored)

support fine timing interval and calculate std dev

Revision 1.38 / (download) - annotate - [select for diffs], Wed Feb 24 21:02:41 1999 UTC (25 years, 3 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

fix default payload alignment error; hugh@

Revision 1.37 / (download) - annotate - [select for diffs], Tue Feb 23 20:04:37 1999 UTC (25 years, 3 months ago) by kjell
Branch: MAIN
Changes since 1.36: +6 -6 lines
Diff to previous 1.36 (colored)

Fix a buffer overrun with very large ICMP packets.

Revision 1.36 / (download) - annotate - [select for diffs], Wed Nov 18 16:50:05 1998 UTC (25 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored)

obvious typo

Revision 1.35 / (download) - annotate - [select for diffs], Sun May 17 01:46:51 1998 UTC (26 years ago) by angelos
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.34: +8 -26 lines
Diff to previous 1.34 (colored)

Unroll that last patch, Theo thinks there's a better way of solving
the problem.

Revision 1.34 / (download) - annotate - [select for diffs], Sat May 16 21:14:17 1998 UTC (26 years ago) by angelos
Branch: MAIN
Changes since 1.33: +26 -8 lines
Diff to previous 1.33 (colored)

Avoid the SIGALRM/ping DOS attack. From FreeBSD patch by Jason Young.

Revision 1.33 / (download) - annotate - [select for diffs], Sat May 16 05:57:46 1998 UTC (26 years ago) by deraadt
Branch: MAIN
Changes since 1.32: +6 -6 lines
Diff to previous 1.32 (colored)

put time in network byte order. I thought I fixed this!

Revision 1.32 / (download) - annotate - [select for diffs], Sat May 16 05:52:36 1998 UTC (26 years ago) by deraadt
Branch: MAIN
Changes since 1.31: +33 -17 lines
Diff to previous 1.31 (colored)

on 64 bit architectures, tv_sec and tv_usec cause problems when we
move them onto the wire - so don't put them on the wire. i thought i
fixed this  ages ago..

Revision 1.31 / (download) - annotate - [select for diffs], Thu Apr 30 23:34:12 1998 UTC (26 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.30: +9 -8 lines
Diff to previous 1.30 (colored)

certain variables are in msec not usec now

Revision 1.30 / (download) - annotate - [select for diffs], Fri Apr 3 11:27:58 1998 UTC (26 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.29: +5 -3 lines
Diff to previous 1.29 (colored)

handle unknown option too. All this ipoption handling needs rewriting, I now see a whole bunch more flaws

Revision 1.29 / (download) - annotate - [select for diffs], Thu Apr 2 20:52:53 1998 UTC (26 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.28: +18 -10 lines
Diff to previous 1.28 (colored)

do not run off end of option buffer for LSRR either; tqbf

Revision 1.28 / (download) - annotate - [select for diffs], Tue Mar 31 23:04:10 1998 UTC (26 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.27: +14 -4 lines
Diff to previous 1.27 (colored)

possible buf oflow in -R; reported by tqbf, fixed by me.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Mar 3 19:06:11 1998 UTC (26 years, 3 months ago) by provos
Branch: MAIN
Changes since 1.26: +4 -6 lines
Diff to previous 1.26 (colored)

make ping work for large packet sizes. closing pr# 417.

Revision 1.26 / (download) - annotate - [select for diffs], Thu Feb 5 04:56:47 1998 UTC (26 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.25: +7 -2 lines
Diff to previous 1.25 (colored)

Don't count DNS lookup time in ping -R.  Problem noted by
Bill Fenner <fenner@FreeBSD.ORG>, fix from Theo <deraadt@openbsd.org>.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Aug 6 01:45:24 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.24: +7 -2 lines
Diff to previous 1.24 (colored)

do not clobber errno in signal handlers

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jun 29 19:23:07 1997 UTC (26 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.23: +9 -8 lines
Diff to previous 1.23 (colored)

Don't assume sizeof(in_addr_t) == 4 and don't coerce an in_addr_t
to struct in_addr.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jun 23 22:45:53 1997 UTC (26 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +6 -6 lines
Diff to previous 1.22 (colored)

64 bit clean and Wall

Revision 1.22 / (download) - annotate - [select for diffs], Wed Jun 11 10:04:24 1997 UTC (26 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +13 -6 lines
Diff to previous 1.21 (colored)

dynamic fd_set

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jun 5 10:02:31 1997 UTC (27 years ago) by deraadt
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

getpid() is going to be OK in a few minutes

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jun 2 08:08:01 1997 UTC (27 years ago) by deraadt
Branch: MAIN
Changes since 1.19: +8 -8 lines
Diff to previous 1.19 (colored)

network byte order for icmp_seq; obfuscate ident (pid) more

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jun 1 21:35:55 1997 UTC (27 years ago) by deraadt
Branch: MAIN
Changes since 1.18: +10 -9 lines
Diff to previous 1.18 (colored)

i think this solves a number of byte order problems in the icmp code.
If these are right, I also want to note that if a host pings me I can
tell what it's byte order is (because if the seq numbers)

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jun 1 21:19:08 1997 UTC (27 years ago) by deraadt
Branch: MAIN
Changes since 1.17: +75 -21 lines
Diff to previous 1.17 (colored)

kill fp, fix unterminated buf, add lots of icmp code; denny1@home.com, PR#205

Revision 1.17 / (download) - annotate - [select for diffs], Thu May 29 15:55:34 1997 UTC (27 years ago) by kstailey
Branch: MAIN
Changes since 1.16: +38 -11 lines
Diff to previous 1.16 (colored)

print stats on SIGINFO

Revision 1.16 / (download) - annotate - [select for diffs], Tue Feb 4 16:44:14 1997 UTC (27 years, 4 months ago) by kstailey
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

Changed ICMP "unreachable" code #defines to match the ones in
tcpdump/print-icmp.c since they were in BSD first.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Feb 4 14:52:56 1997 UTC (27 years, 4 months ago) by kstailey
Branch: MAIN
Changes since 1.14: +5 -2 lines
Diff to previous 1.14 (colored)

RFC-1812 addtion

Revision 1.14 / (download) - annotate - [select for diffs], Thu Jan 30 22:43:14 1997 UTC (27 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +4 -4 lines
Diff to previous 1.13 (colored)

deal with IP_HDRINCL option network byte order change; lidl@va.pubnix.com

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jan 15 23:41:36 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.12 / (download) - annotate - [select for diffs], Sun Dec 22 03:00:52 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.11: +3 -2 lines
Diff to previous 1.11 (colored)

Deal with _POSIX_SAVED_IDS when relinquishing privileges

Revision 1.11 / (download) - annotate - [select for diffs], Sat Dec 14 15:35:26 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.10: +22 -30 lines
Diff to previous 1.10 (colored)

indent correctly

Revision 1.10 / (download) - annotate - [select for diffs], Sat Dec 14 02:16:42 1996 UTC (27 years, 5 months ago) by bitblt
Branch: MAIN
Changes since 1.9: +50 -4 lines
Diff to previous 1.9 (colored)

Now does not display responses to other peoples stuff, like UDP packets
or other peoples network unreachables when you do a ping -v.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Dec 10 08:37:06 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +14 -2 lines
Diff to previous 1.8 (colored)

crank SO_SNDBUF if needed, kml@nas.nasa.gov

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 23 10:36:41 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored)

treat -l and -f the same

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jul 23 10:31:28 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +13 -9 lines
Diff to previous 1.6 (colored)

ptrace is safe; limit preload to root

Revision 1.6 / (download) - annotate - [select for diffs], Tue Jul 23 08:36:44 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +7 -9 lines
Diff to previous 1.5 (colored)

skip until ptrace problem is resolved

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jul 23 02:30:22 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +11 -9 lines
Diff to previous 1.4 (colored)

open socket as soon as possible, and then revoke privs

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jul 22 21:12:23 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +6 -5 lines
Diff to previous 1.3 (colored)

no overflow; from brian@saturn.net

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jun 23 14:32:02 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

update rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jun 19 11:18:58 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +89 -34 lines
Diff to previous 1.1 (colored)

let user set TOS, DF bit, and TTL. also use strtol() instead of atoi() so
that other bases work; netbsd pr#2017; jhawk@mit.edu

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:43:45 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:43:45 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.