Commit Graph

69 Commits

Author SHA1 Message Date
shin
7a373e4e50 Use CMSG_LEN() to compute ping SCM_TIMESTAMP cmsg_len.
Without this, cmsg_len size should be smaller than necessary on alpha.
(Though, no obvious error was seen on ping time value on beast.)
2000-03-14 17:37:19 +00:00
shin
d72ee94428 CMSG_XXX macros alignment fixes to follow RFC2292.
Approved by: jkh

Submitted by: Partly from tech@openbsd
Reviewed by: itojun
2000-03-03 11:13:12 +00:00
sheldonh
ad4c77c29e Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-01 11:27:47 +00:00
shin
00d2f9cf50 ping -S option was missing from IPsec merge, so enable it again.
Approved by: jkh

Submitted by: Matthew Reimer <mreimer@vpop.net>
2000-02-08 05:07:50 +00:00
billf
51ffa90cea Brucify:
add an upper limit to -t
	match the types of return values and the variables they are stuffed in
	make the man page and usage() a little more consistantly ugly
	less obfuscation.

Submitted by:	adrian, billf
2000-01-20 20:48:51 +00:00
billf
bca929cf37 Add '-t X' which times out after pinging for X seconds.
Submitted by:	adrian
2000-01-14 23:40:38 +00:00
msmith
6d6d5a84a7 Don't try to include ipsec support if we are building for the install
floppy image.
2000-01-07 19:06:54 +00:00
shin
268d3bca4c libipsec and IPsec related apps. (and some KAME related man pages)
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
2000-01-06 12:40:54 +00:00
pb
5a63bfde3b Make last commit bde-compliant:
- correct indentation
	- change data types for consistency with the rest of ping.c
	- create new variable separate from "answer" for clarity
1999-11-18 10:20:45 +00:00
pb
135966209b Fix aliasing bug causing in_cksum() to fail on odd packet sizes
due to compiler optimization.

PR:		bin/13292
Suggested by:	wollman
1999-11-15 20:04:53 +00:00
peter
e226894fa0 $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
chris
491518aed2 Re-add -Wmissing-prototypes to `COPTS'. I mistook -W for -Wno in this case. 1999-08-16 21:22:39 +00:00
chris
0f35d57b0b -Wmissing-prototypes is unnecessary here. There are no warnings produced
with this option disabled.
1999-08-16 08:13:17 +00:00
mckay
ceb213fcbf Make flood ping flood again. It hasn't worked since 2.2.6. Make the "-l"
option work as described in the manual, not as another flood ping variant.

Once discussed to death with: bde
1999-05-07 14:38:48 +00:00
imp
ffd449edec More egcs warning fixes:
o main returns int not void
	o use braces to avoid potentially ambiguous else

Note: The fix to natd is potentially functional in nature since I used
the indentation as the right thing rather than the struct semantics.
Someone more familiar with the code should double check me on this one.

Reviewed by: obrien and chuckr
1999-04-25 22:33:30 +00:00
imp
f8e9dc5f85 Finish documenting -S src-addr change.
Forgotten by: me
Forgotten for: Far Too Long
Gently Reminded by: Ruslan Ermilov <ru@ucb.crimea.ua>
Submitted by: Ruslan Ermilov <ru@ucb.crimea.ua>
1999-02-19 07:40:59 +00:00
imp
ebef8d6a91 Allow PINGing from any address on multihomed hosts
In the words of the submitter:
"The patch below allows to ping from any address on the multihomed host.
 The man page is also updated, the text was cutted from traceroute(8)."

Submitted by: Ruslan Ermilov
PR: 6832
1999-01-06 07:54:28 +00:00
bde
bad7dfcb77 Fixed non-use of .Nm and hard line breaks in rev.1.16-1.17: 1998-11-29 13:20:04 +00:00
obrien
04be6dc763 Remove useless `BINOWN=root' now that it is the default. 1998-09-19 22:42:06 +00:00
dfr
099f3df94e Disable gcc's builtin memcpy for alpha since it doesn't cope with unaligned
regions properly and this triggers an unaligned access trap.
1998-09-05 15:11:47 +00:00
dillon
75ad02e108 Updated manual page. Removed description of (now defunct) -c restrictions. 1998-08-27 16:34:38 +00:00
des
ce94c140d1 Remove -c restrictions from previous commit. 1998-08-26 18:51:37 +00:00
dillon
34564d7478 (well tested at BEST): -i option can now take FP values (e.g. -i 0.1),
extremely useful for networking testing.  Other options secured from
    user-level D.O.S. attacks.  -f, -s now root-only.  -i wait times < 1.0
    root-only.  -c count limited to 100 and defaults to 16 when ping run
    by non-root user.
1998-08-26 01:58:39 +00:00
charnier
89490d2ab5 Correct use of .Nm. Remove unused #includes. Use warn(). cosmetic in usage()
string.
Translate 0 sec 1000000 usec to 1 sec 0 usec.
1998-07-15 06:45:02 +00:00
jb
dcad314395 Fix an alignment problem on alpha by doing a bytewise copy. 1998-06-06 23:33:28 +00:00
fenner
79a7e310f2 Use select() timeouts instead of SIGALRM to schedule packet transmission.
Fixes bin/6649 and removes the last abusive signal handler.
Use SO_TIMESTAMP to get the kernel to timestamp packets on reception.
 Fixes bin/5658 and provides slightly better accuracy.
Explicitly zero and terminate the IP options when using -R.

PR:		bin/5658
PR:		bin/6649
1998-05-25 20:16:05 +00:00
steve
073c6847ed Revert the previous fix. As it turns out Warner Losh is
working a better fix.
1998-05-25 06:53:17 +00:00
steve
8d9f04aa01 Attempt to stop another DoS attack related to ping flooding.
PR:		6649
Submitted by:	Jason Young <doogie@forbidden-donut.anet-stl.com>
1998-05-25 03:50:51 +00:00
jb
e6c17f9ef1 When a timeval is stored at the beginning of icmp_data, the fields
are unaligned for access by the alpha, so copy the value to a variable
that is aligned.

When checking the returned data, be careful to avoid confusing the
size of the icmp header with the size of a timeval. On i386 these
are both 8, but on alpha, a timeval is 16 bytes. This means that
a packet sent from an alpha contains 48 bytes of data, not 56 like
on i386.
1998-05-16 00:19:27 +00:00
phk
c382097833 If ping write fails with short packet count, the
error message prints the two numbers backwards.
PR:		6313
Reviewed by:	phk
Submitted by:	Archie Cobbs
1998-04-15 19:55:14 +00:00
imp
ddf6f1e470 Add aback in a line a accidentally killed in my last commit.
Submitted by:	Bill Fenner
1998-04-02 04:33:18 +00:00
eivind
8834541bd1 Make this compile (and seemingly work). 1998-04-02 01:12:55 +00:00
imp
a2a9192ad7 A fairly rare possible buffer overflow:
Theo fixed this and tqbf reported it
Obtained from: OpenBSD
1998-04-01 00:32:18 +00:00
charnier
44e4eb0c65 .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-19 07:46:04 +00:00
imp
690fb81274 Minor style nit noticed by bde. 1997-12-24 00:59:02 +00:00
bde
dca2f080ae Fixed DPADD. 1997-12-16 15:03:14 +00:00
fenner
1cd8b9ab71 Add an ntohs() and format an IP address with inet_ntoa() when
printing the details of a received ICMP packet.

PR:		bin/3766
Submitted by:	denny1@home.com (Denton Gentry)
1997-08-11 04:33:07 +00:00
julian
a49d8c3a6a don't lose track of how many packets we've sent
if we get 'host unreachable'. (or any other errors than ENOBUFS)
makes -c work again even if you can't get there..
This really needs a rework..
1997-08-07 02:41:15 +00:00
bde
ea276c7c15 Cleaned up revisions 1.22 and 1.23.
Fixed minor bugs in revisions 1.12 and 1.23 (variables assigned to in signal
handlers weren't declared as volatile).
1997-07-20 06:09:55 +00:00
wollman
c7082456ed Calculate and print out the standard deviation of the round trip times.
This isn't necessarily the best statistic, but it is by far the easiest to
calculate.  Update the man page to be more explicit about precisely which
statistics are printed out.  Revert some of jmg's bogus man page changes from
rev 1.11.
1997-07-18 17:52:05 +00:00
sef
37b914af36 Fix a problem introduced with a recent change that caused a hang with
unreachable hosts.  Note that most of this consists of telling SIGINT
and SIGALRM to interrupt the system call, instead of restarting them.
Also try to get rid of some potential races Bruce didn't like; hopefully
they aren't a problem (potential or otherwise) now.

Reviewed by:	julian
1997-07-13 06:16:44 +00:00
julian
a2d2f3d081 don't count packets as being transmitted when we know that the sendto()
failed (e.g. ENOBUFS)
1997-07-09 20:33:58 +00:00
julian
e3cb78a6fc ping called printf() from a signal handler..
this is a NO-NO

re-arange to just set a "please die immediatly" flag in the signal handler
and handle this in the normal thread.

also handle ping -f better on slow links by backing off a bit when
we get a ENOBUFFS from the sendto().
1997-07-09 19:40:43 +00:00
imp
ae42d89bd0 Fix typo introduced in 1.17.
Submitted by:	"Philippe Charnier" <charnier@xp11.frmug.org>
1997-03-04 22:05:49 +00:00
imp
80366dfd4d Check the size of the IP address reutrned from gethostbyname2, per PR
2578 from Julian A.  Likely not strictly needed, but it doesn't hurt
and protects ping against possible buffer overflows if the resolver
were to return large IP addresses.
1997-03-03 09:50:21 +00:00
jmg
25b363b535 fix man page to use marcos instead of parens, quotes and braces
plus other minor fixes
1997-03-02 23:38:05 +00:00
imp
3ab0b22d25 1) Minor nits in the usage message from bde. I took out the hard tabs and
used spaces to align the second line under the program name.
2) Cache uid after call to setuid(getuid()) so we don't waste a system call
   for each packet with a call to getuid for the -v case.
3) Update manual to reflect new restriction on -l from last delta.

Suggested by:	bde, Bill Fenner
1997-03-02 20:01:13 +00:00
imp
cb45714b32 1) Fix usage to match convention and manual. Fix manual to match usage.
2) Must be root to run preload (OpenBSD ping.c 1.8)
3) Don't print all replies unless verbose and root (from idea in
   OpenBSD ping.c 1.10 and 1.11) to avoid leaking information available
   only to root.
4) Remove unused h: from option string to getopt.
5) Make the compiler happy with exit(0) (Lite-2?)

Reviewed by: Dan Cross <tenser@spitfire.ecsel.psu.edu>

Good candidate for 2.2 and 2.1 (as are many of the 1.17 changes).
1997-03-02 06:32:42 +00:00
wollman
2ccf3145fa Make ping -Wall clean (except for one warning).
Do a better job of argument parsing.
Don't permit ping -f to a multicast address (very antisocial).
Don't permit -L, -I, -T options with unicast addresses.
Ensure that we ask for only AF_INET addresses (should close PR#2584).
Return <sysexits.h> error codes for failures.  Document this.
Fix man page to identify the author and put sections in correct order.
1997-03-01 20:19:18 +00:00
peter
4997d39dce Revert $FreeBSD$ to $Id$ 1997-02-22 14:40:44 +00:00