Compare commits
269
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
979bcfd515 | ||
|
|
097c701fe5 | ||
|
|
46852d6394 | ||
|
|
d4bd91c11a | ||
|
|
24fdc7958e | ||
|
|
0b071caa89 | ||
|
|
202c38e84b | ||
|
|
26d8fb5108 | ||
|
|
32cd7febe0 | ||
|
|
005624f44f | ||
|
|
8fc9fa37c7 | ||
|
|
3d74b33f4c | ||
|
|
9949c92c2b | ||
|
|
0706f68bdf | ||
|
|
d01d280f84 | ||
|
|
625793935e | ||
|
|
c8c6e8db5d | ||
|
|
e2896d390f | ||
|
|
f6c3cbdf64 | ||
|
|
558c123e35 | ||
|
|
333a16bdbf | ||
|
|
b72256a8fc | ||
|
|
3313c3619d | ||
|
|
97705a649c | ||
|
|
964941f7fa | ||
|
|
99e498d8db | ||
|
|
21d568457f | ||
|
|
f02cebfd3a | ||
|
|
e7b6b7ecb6 | ||
|
|
23dbb92e0b | ||
|
|
075be180fe | ||
|
|
396a32017d | ||
|
|
d91066ceeb | ||
|
|
860fbadf6a | ||
|
|
c996044f2a | ||
|
|
8854e99994 | ||
|
|
9c3133fead | ||
|
|
3cc482f2d3 | ||
|
|
8f66bac4ec | ||
|
|
a1e9d8240b | ||
|
|
0f36dddffd | ||
|
|
e042466b9a | ||
|
|
3aed2604bb | ||
|
|
609f4f17c4 | ||
|
|
4d6861c2c3 | ||
|
|
314b8debd9 | ||
|
|
fe12f0dbab | ||
|
|
a07e244a57 | ||
|
|
7b8899043d | ||
|
|
c4c3068bbb | ||
|
|
2b5d9ef795 | ||
|
|
e79444f09a | ||
|
|
b779e14db6 | ||
|
|
3aa530c2ff | ||
|
|
c9f276b3cd | ||
|
|
1d576326ba | ||
|
|
f35f4a8cc4 | ||
|
|
75101dd843 | ||
|
|
c1fe95f7b7 | ||
|
|
bdca2c4b07 | ||
|
|
ea026f3ba4 | ||
|
|
3ec68c8a3f | ||
|
|
9a5c6589b2 | ||
|
|
a7f351fb8e | ||
|
|
51cc41a2c1 | ||
|
|
d35f7072b5 | ||
|
|
ab006a5113 | ||
|
|
c524813889 | ||
|
|
86f0b1e380 | ||
|
|
d4e0a6c89b | ||
|
|
3cf9a8a3cd | ||
|
|
f65d335ecf | ||
|
|
c6f37022a4 | ||
|
|
c786c34334 | ||
|
|
cd21d0bb91 | ||
|
|
b359c0e7a3 | ||
|
|
9d71f4e809 | ||
|
|
af0446b046 | ||
|
|
930af0fc54 | ||
|
|
00e3384d5c | ||
|
|
6fa8c4c175 | ||
|
|
8cda80898e | ||
|
|
56c431df13 | ||
|
|
def79d3590 | ||
|
|
0990bf1c61 | ||
|
|
a6721ac2d2 | ||
|
|
49f24acda6 | ||
|
|
37158fe9fe | ||
|
|
86ecd82263 | ||
|
|
382ab64e5c | ||
|
|
3f37397c58 | ||
|
|
8bd200905d | ||
|
|
91130ebd28 | ||
|
|
358ac75c21 | ||
|
|
c5e7e911b0 | ||
|
|
e2705a01c1 | ||
|
|
d9506b335f | ||
|
|
782524e489 | ||
|
|
956b851d47 | ||
|
|
e27fd71935 | ||
|
|
4989d94eb7 | ||
|
|
ff44de71b1 | ||
|
|
e7ace04516 | ||
|
|
18aa33e13a | ||
|
|
71bf72527b | ||
|
|
e07a6e9dfc | ||
|
|
71616ec77e | ||
|
|
42574667d6 | ||
|
|
2604b40743 | ||
|
|
e39e24e933 | ||
|
|
bd768a44f8 | ||
|
|
e9daacdf81 | ||
|
|
2f9cd95bbd | ||
|
|
219dbd893d | ||
|
|
7dd45384e4 | ||
|
|
f9c68a6dc7 | ||
|
|
540057dfd9 | ||
|
|
fdddda1c22 | ||
|
|
a2ac03c210 | ||
|
|
3eccad8ee1 | ||
|
|
c6d311a7d4 | ||
|
|
5851422798 | ||
|
|
57595638ec | ||
|
|
801051eeec | ||
|
|
806ad042b8 | ||
|
|
5dc8afb265 | ||
|
|
f27a89d40d | ||
|
|
b973451021 | ||
|
|
63c73e0697 | ||
|
|
5dd8c5de50 | ||
|
|
0decb829d8 | ||
|
|
3e8eb6c613 | ||
|
|
85abf34b0a | ||
|
|
bda0744d2c | ||
|
|
d6808efd81 | ||
|
|
3a714b275f | ||
|
|
d141744adb | ||
|
|
e1cdf8e1d3 | ||
|
|
d862dd962b | ||
|
|
5c68d6f338 | ||
|
|
a2ac5d0fae | ||
|
|
b01f282727 | ||
|
|
0ab66f80de | ||
|
|
741236e576 | ||
|
|
9fca2a141b | ||
|
|
9ee22bd46a | ||
|
|
f55397336b | ||
|
|
82722a31fe | ||
|
|
4aad0b2c14 | ||
|
|
fb5f5779cc | ||
|
|
a0252f6e79 | ||
|
|
3dee903b41 | ||
|
|
7e55f0b073 | ||
|
|
8daad08e1d | ||
|
|
b7343ed256 | ||
|
|
ecba31b2dd | ||
|
|
28eea9c273 | ||
|
|
121bea1d24 | ||
|
|
5d6db6f08d | ||
|
|
543d22122d | ||
|
|
70a29a11af | ||
|
|
b0e09ce6fe | ||
|
|
6400ffb339 | ||
|
|
98d44d02bb | ||
|
|
69fff78ca4 | ||
|
|
5b6784a4ea | ||
|
|
25dc120355 | ||
|
|
f906225fbd | ||
|
|
3e29f0631c | ||
|
|
10d0a54c07 | ||
|
|
ad4ca1609d | ||
|
|
e0edbf28fc | ||
|
|
1c85a422c1 | ||
|
|
86cfc7cf74 | ||
|
|
fd020977b5 | ||
|
|
81c96c0807 | ||
|
|
aff259bbd0 | ||
|
|
4cab2f8598 | ||
|
|
aa5f849c5d | ||
|
|
1bb43dc07f | ||
|
|
02ac0090e1 | ||
|
|
b4d0a93b70 | ||
|
|
a19c537fc5 | ||
|
|
6af4d71188 | ||
|
|
ed4202f84f | ||
|
|
a4ef8142b3 | ||
|
|
421abc41b1 | ||
|
|
67d7a10f83 | ||
|
|
bdef483f4b | ||
|
|
e92a68dc4d | ||
|
|
13ce2eae48 | ||
|
|
b16d117a17 | ||
|
|
0e3e404a3d | ||
|
|
5f3ab12ca9 | ||
|
|
4a5c82f6a5 | ||
|
|
7d4eeb403a | ||
|
|
88d54f4505 | ||
|
|
5cf3f7fa4d | ||
|
|
2f09ff2d40 | ||
|
|
2a53cdc62b | ||
|
|
a5828a2795 | ||
|
|
546ba7eb93 | ||
|
|
f062f00568 | ||
|
|
3f0f49da64 | ||
|
|
780865c8ee | ||
|
|
063ee44417 | ||
|
|
70b8d7e21e | ||
|
|
967266168d | ||
|
|
2cbac9f893 | ||
|
|
c3e8dbc649 | ||
|
|
ecaca317d7 | ||
|
|
74066a00ea | ||
|
|
293a632056 | ||
|
|
2f94a50ae6 | ||
|
|
d4c853f4b1 | ||
|
|
2176f2a19f | ||
|
|
754feb217c | ||
|
|
940cbed179 | ||
|
|
8cb74ebcce | ||
|
|
973a48096b | ||
|
|
19b041904b | ||
|
|
d433646025 | ||
|
|
6f919ed54b | ||
|
|
bc28412671 | ||
|
|
adf7be95fd | ||
|
|
6161a0552d | ||
|
|
d4d4106faa | ||
|
|
c4ba6af7b3 | ||
|
|
bb21654691 | ||
|
|
2134d569b4 | ||
|
|
8047122e85 | ||
|
|
c3c0eca384 | ||
|
|
457c9818d0 | ||
|
|
9b82b5e716 | ||
|
|
01db781375 | ||
|
|
5018cb8234 | ||
|
|
ac6bbc8b19 | ||
|
|
007d8c4c5c | ||
|
|
227adfd3c7 | ||
|
|
7f35a34eb5 | ||
|
|
d731dfc5b1 | ||
|
|
b788ca80ef | ||
|
|
de94a7d0ff | ||
|
|
9d23ce7a11 | ||
|
|
7f70bc3343 | ||
|
|
95d1200994 | ||
|
|
65cfc7bc89 | ||
|
|
38e93966d5 | ||
|
|
49d56451d4 | ||
|
|
54bcc5665d | ||
|
|
1ad4e3a4d9 | ||
|
|
26bc736025 | ||
|
|
14f45a6872 | ||
|
|
23848d5481 | ||
|
|
80122ac930 | ||
|
|
02b3289e69 | ||
|
|
e372ac97bc | ||
|
|
2b7a05c66b | ||
|
|
051e4876e5 | ||
|
|
c081790bf8 | ||
|
|
daefc3e852 | ||
|
|
c5a8931c39 | ||
|
|
7e162406e2 | ||
|
|
66909a30c5 | ||
|
|
11184c5cef | ||
|
|
fdae03d016 | ||
|
|
57650049fb | ||
|
|
af8103e055 | ||
|
|
873bc1df2d |
@@ -0,0 +1,3 @@
|
||||
Makefile
|
||||
*.o
|
||||
*.kdev4
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# travis-ci.org configuration
|
||||
#
|
||||
language: c
|
||||
env:
|
||||
global:
|
||||
- secure: "CoI8hwHH1yfQoQxIfWGRS0WfTyScox+5aJn0fDDgz2uKrrIxmBvIw/WKX8wcSiV6fLmLuwgNkKqSM3hdO4qaG+JxfWcuEiZZHm+kxSGMkWbGb/fvAI+gHg8ldKyYttcIX71O5rlZiC2QpNKQi2v18S6pI5p8eqnx7DYx4YrmguQ="
|
||||
compiler:
|
||||
- gcc
|
||||
before_install:
|
||||
- sudo apt-get install libcap2-bin
|
||||
- sudo apt-get install traceroute
|
||||
- traceroute google.com
|
||||
install:
|
||||
- ci/build-1-autotools.sh
|
||||
- curl -L http://cpanmin.us | perl - --sudo App::cpanminus
|
||||
- cpanm --sudo Test::Command
|
||||
script:
|
||||
- ci/build-2-install.sh
|
||||
- env PATH=`pwd`/src:$PATH prove ci/test-*.pl
|
||||
- ci/test-tarball.sh
|
||||
after_success:
|
||||
- ci/coveralls.sh
|
||||
- ci/deploy-bintray.sh
|
||||
@@ -1,3 +1,285 @@
|
||||
2015-10-21 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.13
|
||||
* (bugfix) Fix ICMP errors sometimes causing crashes with fping >= 3.11
|
||||
(fixes #85, reported by Jamie Heilman and Bill Blough)
|
||||
|
||||
2015-10-14 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.12
|
||||
* (bugfix) Fix fping6 -R (fixes #84, reported by Stuart Henderson)
|
||||
|
||||
2015-10-12 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.11
|
||||
* (feature) New option -R to use random bytes instead of NULLs (#72, Anthony DeRobertis)
|
||||
* (feature) Small documentation and performance improvements (Ryan Underwood)
|
||||
* (bugfix) Fix double entries with fping -u and unreachable hosts
|
||||
* (internal) Use sockaddr_storage and simplify code, so that we can one day support both IPv4 and IPv6 with the same binary
|
||||
|
||||
2014-05-03 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.10
|
||||
* Fix confusing error message with -g and IPv6 addresses (#58, reported by Axel Beckert)
|
||||
* Allow option '-f' also for non-root (since setuid privileges are dropped)
|
||||
* Do not retry twice DNS lookup on DNS lookup problem
|
||||
* Remove support for NIS groups
|
||||
* Better document -B backoff-factor and when it can be used (#33, Oleksiy Zagorskyi)
|
||||
* More tests added
|
||||
|
||||
2014-03-08 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.9
|
||||
* Fix random output on socket error (reported by Aleksandrs Saveljevs, #56)
|
||||
* Support ppc64le architecture by including alpha libtool version
|
||||
(reported by Amit Kumar Gupta and Aravinda B Thunug)
|
||||
* Fix compilation problem on FreeBSD (#57)
|
||||
* Initial test suite and continous intergration (with travis-ci.org / coveralls.io)
|
||||
* Don't output usage information on error
|
||||
|
||||
2013-11-08 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.8
|
||||
* Fix segmentation fault introduced in version 3.7 with loop mode (reported
|
||||
by Vlad Glagolev, #55)
|
||||
|
||||
2013-11-04 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.7
|
||||
* Allow running as non-root on Mac OS X by using non-privileged ICMP (#7)
|
||||
* Remove unnecessary IPv6 socket options
|
||||
* Fix again compatibility issue with FreeBSD (Shawn Chu)
|
||||
* Fix fping hanging forever on permanent sendto failure (Shawn Chu)
|
||||
* Fix duplicate echo reply packets causing early stop in count mode
|
||||
(reported by Ramon Schwammberger, #53)
|
||||
|
||||
2013-10-10 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.6
|
||||
* Fix loop issue after 65536 pings (reported by Peter Folk and GBert, #12)
|
||||
* Minimum ping data size is now 0
|
||||
* Removed setsockopt IPV6_CHECKSUM, which shouldn't be set and breaks
|
||||
compiling on Solaris (reported by Juergen Arndt)
|
||||
* Fix wrong min RTT value with -Q option (reported by Alexander Ivanov, #51)
|
||||
|
||||
2013-05-22 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.5
|
||||
* Fix sprint_tm buffer size crash (reported by Japheth Cleaver)
|
||||
* Addded -D flag to print timestamps (Toke Høiland-Jørgensen)
|
||||
* Fix fping6 build on OS X 10.8 (unknown contributor)
|
||||
* Fix compatibility issue with FreeBSD (Alexandre Raynaud, Jason Harris, #39)
|
||||
* Fping.spec: fix setuid permissions and provides fping6 (Marcus Vinicius Ferreira)
|
||||
* Re-create configure script with autoconf 2.69 for aarch64 support (Chuck Anderson, #45)
|
||||
|
||||
2012-09-04 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.4
|
||||
* Revert "Output statistics to stdout instead of stderr", because it breaks
|
||||
tools assuming the output goes to stderr
|
||||
|
||||
2012-08-19 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.3
|
||||
* Do not output icmp errors with -q (#1)
|
||||
* Add --enable-ipv4 and --enable-ipv6 options to configure (Niclas Zeising)
|
||||
* Fix removing of unreachable hosts when doing loop (Thomas Liske, #13 #23)
|
||||
* Fix -A for fping6 (reported by Matt LaPlante, #14)
|
||||
* Fix "options inet6" breaking IPv4 name resolution (reported by Matt LaPlante, #17)
|
||||
* Output statistics to stdout instead of stderr (suggested by Simon Leinen, #9)
|
||||
* Set default data size to 56 bytes on all architectures (#18)
|
||||
* Added contrib/fping.spec (Stephen Schaefer, #24)
|
||||
* Convert man-page source to POD for easier maintenance
|
||||
* Fix error message on DNS error for IPv6 hosts (#27)
|
||||
* Fix -n flag in fping6 (#28)
|
||||
* Man-page fix: TOS option typo (Thomas Liske, #23)
|
||||
* Man-page fix: inconsistency in regards to numeric arguments (Robert Henney)
|
||||
* Man-page fix: better description of option -q (#15)
|
||||
|
||||
2012-05-29 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.2
|
||||
* Improve documentation for -g option (G.W. Haywood)
|
||||
* Performance optimization for big select timeouts (#10, Andrey Bondarenko)
|
||||
* Fix restart of select call after interrupt signal (#8, Boian Bonev)
|
||||
* Fix infinite loop caused by linked list corruption (#11, Boian Bonev)
|
||||
|
||||
2012-04-26 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.1
|
||||
* -g option (generate): exclude network and broadcast address for cidr
|
||||
ranges (idea by Eric Brander)
|
||||
* do not explicitely check if running as root, to make it possible to
|
||||
install fping with linux capabilities instead of making it setuid
|
||||
(setcap cap_net_raw+ep fping)
|
||||
* ANSI C (C89) compiler now a requirement
|
||||
* Portability fixes
|
||||
* Reorganized source directory
|
||||
* Bugfix: fix timeout issue on Solaris (Sandor Geller)
|
||||
* Man-page fixes (Axel Beckert)
|
||||
* Added -H option to specify number of hops (Paul Duda)
|
||||
* Output usage information to stdout when called with -h (Paul Duda)
|
||||
|
||||
2011-12-28 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.0
|
||||
* rewritten main loop for improved performance
|
||||
* -T parameter (select timeout) now obsolete
|
||||
* Maintenance taken over from unresponsive previous maintainer
|
||||
(anybody please step up, if you disagree)
|
||||
* New homepage: www.fping.org
|
||||
|
||||
2009-12-21 Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Version v2.4b2-to3-ipv6
|
||||
* added -On option to set the TOS octet
|
||||
* Removed unused variables from code
|
||||
* updated to current autoconf standards
|
||||
* Merged Debian changes (see below)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
fping (2.4b2-to-ipv6-16.1) unstable; urgency=low
|
||||
|
||||
* NMU during Moenchengladbach BSP
|
||||
* Fixes FTBFS on kfreebsd (Closes: #555398)
|
||||
* Fixes typo "Paramter" in binary
|
||||
|
||||
-- Axel Beckert <abe@deuxchevaux.org> Sat, 23 Jan 2010 16:22:02 +0100
|
||||
|
||||
fping (2.4b2-to-ipv6-16) unstable; urgency=low
|
||||
|
||||
* Fix the following bugs
|
||||
- Network byte order sensitivity was missing completely.
|
||||
Added hopefully all missing calls.
|
||||
- The sequence numbering scheme used led to packet drops.
|
||||
Changed it to a more senseful numbering scheme.
|
||||
- Some minor C programming mistakes ('=' instead of '==').
|
||||
Patch by Stephan Fuhrmann; closes: #502569
|
||||
* Add support for command line select timeout setting
|
||||
Patch by Marton Balint; closes: #502575
|
||||
* Remove symlinks in /usr/sbin; closes: #377732
|
||||
* Standards-Version is 3.8.0
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Sat, 18 Oct 2008 12:04:52 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-15) unstable; urgency=low
|
||||
|
||||
* Added interface binding (-I) for fping
|
||||
Patch by Peter Naulls <peter@mushroomnetworks.com>
|
||||
Closes: #439014
|
||||
* Fixed a couple of typos in fping.8. Closes: #423180
|
||||
* Added homepage control header
|
||||
* Bumped Standards-Version to 3.7.3
|
||||
* Fixed the following lintian issue:
|
||||
- debian-rules-sets-DH_COMPAT
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Mon, 03 Mar 2008 17:46:17 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-13) unstable; urgency=low
|
||||
|
||||
* Fixed stdout flush problem, closes: #340146.
|
||||
Patch by Bart Martens <bart.martens@advalvas.be>.
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Fri, 30 Dec 2005 08:30:09 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-12) unstable; urgency=low
|
||||
|
||||
* Fixed "problem with option -r (retry limit)", closes: #318402.
|
||||
Patch by Qingning Huo <qingningh@lanware.co.uk>.
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Sat, 08 Oct 2005 21:26:35 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-11) unstable; urgency=low
|
||||
|
||||
* Fixed "would be useful to specify 'source address' like ping for multi
|
||||
homed machines", closes: #198486.
|
||||
Patch by Marc Haber <mh+debian-bugs@zugschlus.de>.
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Thu, 02 Jun 2005 08:14:54 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-10) unstable; urgency=low
|
||||
|
||||
* Fixed "unnecessary delay with the -c option after the last packet"
|
||||
(Closes: #293856). Patch by Niko Tyni <ntyni@iki.fi>
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Sun, 06 Feb 2005 23:25:57 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-9) unstable; urgency=low
|
||||
|
||||
* Fixed "fping6 always does reverse lookup" (Closes: #273647).
|
||||
Patch by Jeroen Massar and forwarded by Bernhard Schmidt <berni@birkenwald.de>
|
||||
|
||||
-- Anibal Monsalve Salazar <A.Monsalve.Salazar@IEEE.org> Mon, 10 Jan 2005 00:01:32 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-7) unstable; urgency=low
|
||||
|
||||
* Build fping in build/ipv[46] instead of build and build-ipv6.
|
||||
* Made DNS errors non-fatal for IPv6 (closes: #198056).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Fri, 20 Jun 2003 21:36:30 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-6) unstable; urgency=low
|
||||
|
||||
* Do not use incorrect linux.h file (closes: #85468).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 17 May 2003 14:13:11 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-5) unstable; urgency=low
|
||||
|
||||
* Fixed yet another divide by zero bug (closes: #148445).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Tue, 4 Jun 2002 12:18:03 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-4) unstable; urgency=low
|
||||
|
||||
* Made fping6 setuid (closes: #136386).
|
||||
* Moved fping back into bin.
|
||||
* Partially applied IPv6 patch to fix IPv6 checksums (closes: #136479).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sun, 7 Apr 2002 20:36:56 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-3) unstable; urgency=low
|
||||
|
||||
* Added compatibility symlink for fping (closes: #135203).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 23 Feb 2002 08:34:11 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-2) unstable; urgency=low
|
||||
|
||||
* Fixed another divide by zero error (closes: #132370).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Thu, 7 Feb 2002 20:10:48 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
* Install fping into sbin as done by upstream.
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Fri, 1 Feb 2002 22:11:59 +1100
|
||||
|
||||
fping (2.2b2-3) unstable; urgency=low
|
||||
|
||||
* Removed INSTALL file from package (closes: #84050).
|
||||
* Fixed alignment bug.
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 10 Feb 2001 19:25:18 +1100
|
||||
|
||||
fping (2.2b2-2) unstable; urgency=low
|
||||
|
||||
* Made changes for dpkg-statoverride (closes: #83838).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sun, 28 Jan 2001 21:53:05 +1100
|
||||
|
||||
fping (2.2b2-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
* Fixed typo that prevented -d from working (closes: #83255).
|
||||
* Drop root privileges after opening the socket (closes: #81589).
|
||||
* Fixed the options [tip], they were out by a factor of 10
|
||||
(Richard Kettlewell, closes: #83742).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sun, 28 Jan 2001 00:09:41 +1100
|
||||
|
||||
fping (2.2b1-2) unstable; urgency=low
|
||||
|
||||
* Fixed typo in control file, spotted by William Ono (closes: #49909).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Mon, 15 May 2000 12:27:03 +1000
|
||||
|
||||
fping (2.2b1-1) unstable; urgency=low
|
||||
|
||||
* Initial release.
|
||||
* Fixed divide by zero error (closes: #29902).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 30 Oct 1999 16:36:19 +1000
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Wed Jan 16 2002
|
||||
Jeroen Massar
|
||||
- Revision v2.4b2-to-IPv6
|
||||
@@ -9,304 +291,304 @@ Jeroen Massar
|
||||
- num_unreachable was counted twice when a sendto() generated errors.
|
||||
- See http://unfix.org/projects/ipv6/
|
||||
|
||||
Tue Mar 14 2001
|
||||
Jason Ewasiuk <jasone@remote.net>
|
||||
- Revision v2.4b1
|
||||
- added -g option for generating IPs from a start to an end value
|
||||
- two available options, generate IPs from start IP to end IP
|
||||
or from a passed netmask, such as 192.168.1.0/24
|
||||
|
||||
Thu Feb 15 2001
|
||||
Jason Ewasiuk <jasone@remote.net>
|
||||
- Revision v2.3b1
|
||||
- formatting changes to code layout (fping.c)
|
||||
NOTE: Best viewed with a tab stop of 4
|
||||
- merged in changes from Debian c/o Herbert Xu
|
||||
<herbert@gondor.apana.org.au>
|
||||
- Compilation fix on alphas with glibc
|
||||
- Alignment issues (note from JE: in wait_for_reply())
|
||||
- A typo with the time specified on the command line
|
||||
(note from JE: bug was using 10 instead of 100)
|
||||
- Drop privileges after obtaining socket
|
||||
(note from JE: might be moot, since prog exits if
|
||||
user is not root)
|
||||
- touched all files in package to this date
|
||||
- couple new #ifdefs added for future WIN32 support
|
||||
(Haven't got to adding this yet, will take a lot of rewriting.)
|
||||
|
||||
Fri Dec 8 10:33:13 2000 Roland Schemers <schemers@stanford.edu>
|
||||
|
||||
* stop using sys_errlist and start using strerror
|
||||
fixed bug in output of -C
|
||||
|
||||
Wed Jan 8 11:18:37 1997 Roland Schemers <schemers@stanford.edu>
|
||||
|
||||
* Created ChangeLog file. What follows was from the CHANGES file.
|
||||
|
||||
* Revision 2.0 1994/10/31 21:26:23 morgan
|
||||
|
||||
Substantial rewrite, including new features:
|
||||
|
||||
support some traditional ping features:
|
||||
loop mode
|
||||
specify size of data packets
|
||||
specify how many pings to send
|
||||
show per-response data
|
||||
interpret ICMPs other than ICMP Echo response
|
||||
|
||||
also
|
||||
|
||||
rewrote main loop completely
|
||||
make timings in tenths of milliseconds
|
||||
do exponential backoff on retries
|
||||
port to more systems
|
||||
add some debugging stuff
|
||||
do better checking on whether received ICMP is for us
|
||||
|
||||
* Revision 1.24 1993/12/10 23:11:39 schemers
|
||||
|
||||
commented out seteuid(getuid()) since it isn't needed
|
||||
|
||||
* Revision 1.23 1993/12/10 18:33:41 schemers
|
||||
|
||||
Took out the -f option for non-root users. This can be enabled by
|
||||
defining ENABLE_F_OPTION before compiling. There is a call to
|
||||
access before opening the file, but there is a race condition.
|
||||
Reading from stdin is much safer.
|
||||
|
||||
|
||||
* Revision 1.22 1993/11/16 19:49:24 schemers
|
||||
|
||||
Took out setuid(getuid()) and used access() system call to
|
||||
check for access to the file specified with "-f".
|
||||
|
||||
* Revision 1.21 1993/07/20 18:08:19 schemers
|
||||
|
||||
commented out the test to make sure the ping packet came from the
|
||||
same IP address as the one we sent to. This could cause problems on
|
||||
multi-homed hosts.
|
||||
|
||||
* Revision 1.20 1993/02/23 00:16:38 schemers
|
||||
|
||||
fixed syntax error (should have compiled before checking in...)
|
||||
|
||||
* Revision 1.19 1993/02/23 00:15:15 schemers
|
||||
|
||||
turned off printing of "is alive" when -a is specified.
|
||||
|
||||
* Revision 1.18 1992/07/28 15:16:44 schemers
|
||||
|
||||
added a fflush(stdout) call before the summary is sent to stderr, so
|
||||
everything shows up in the right order.
|
||||
|
||||
* Revision 1.17 1992/07/23 03:29:42 schemers
|
||||
* Revision 1.16 1992/07/22 19:24:37 schemers
|
||||
|
||||
Fixed declaration of timeval_diff. Didn't notice the problem because
|
||||
I use 'cc' in stead of gcc under Ultrix. Time to switch? :-)
|
||||
|
||||
Modified file reaing so it would skip blank lines or lines starting
|
||||
with a '#'. Now you can do something like:
|
||||
|
||||
fping -ad < /etc/hosts
|
||||
|
||||
* Revision 1.15 1992/07/21 17:07:18 schemers
|
||||
|
||||
Put in sanity checks so only root can specify "dangerous" options.
|
||||
Changed usage to show switchs in alphabetical order.
|
||||
* Revision 1.14 1992/07/21 16:40:52 schemers
|
||||
* Revision 1.13 1992/07/17 21:02:17 schemers
|
||||
|
||||
Changed the default timeout to 2500 msec, and retry to 3. This was
|
||||
due to suggestions from people with slow (WAN) networks. The default
|
||||
1 sec timeout was too fast.
|
||||
|
||||
|
||||
Added '-e' option for showing elapsed (round-trip) times on pakets, and
|
||||
modified the -s option to include min, max, and average round-trip times,
|
||||
and over all elapsed time.
|
||||
|
||||
Modified action taken when a error is returned from sendto. The action
|
||||
taken now considers the host unreachable and prints the hostname
|
||||
followed by the errno message. The program will not exit and will continue
|
||||
to try other hosts.
|
||||
|
||||
* Revision 1.12 1992/07/17 16:38:54 schemers
|
||||
* Revision 1.11 1992/07/17 16:28:38 schemers
|
||||
|
||||
move socket create call so I could do a setuid(getuid()) before the
|
||||
fopen call is made. Once the socket is created root privs aren't needed
|
||||
to send stuff out on it.
|
||||
|
||||
moved num_timeout counter. It really was for debug purposes and didn't
|
||||
make sense to the general public :-) Now it is the number of timeouts
|
||||
(pings that didn't get received with the time limit).
|
||||
|
||||
|
||||
* Revision 1.10 1992/07/16 16:24:38 schemers
|
||||
* Revision 1.9 1992/07/16 16:00:04 schemers
|
||||
* Revision 1.8 1992/07/16 05:44:41 schemers
|
||||
|
||||
Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE
|
||||
for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added
|
||||
check for __cplusplus.
|
||||
|
||||
Now compiles ok under Ultrix 3.1, and Sun4 using cc. Also compiled
|
||||
ok using g++ 2.2.2.
|
||||
|
||||
Changed '-a' and '-u' flags to be mutually exclusive (makes sense, since
|
||||
specifiying both '-a' and '-u' is the same as not specifiying anything.
|
||||
Since '-a' and '-u' are mutually exclusive, these options now only print
|
||||
the hostname, and not the 'is alive' or 'is unreachable' messages.
|
||||
This makes it much easier to do stuff like:
|
||||
|
||||
#!/usr/local/bin/perl
|
||||
$hosts_to_backup=`cat /etc/hosts.backup|fping -a`;
|
||||
|
||||
Since you don't have to strip off the 'is alive' messages.
|
||||
|
||||
Changed usage to and stats to print to stderr instead of stdout.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
RCS header info from original fping.c package (no longer required)
|
||||
|
||||
/*
|
||||
***************************************************
|
||||
*
|
||||
* Standard RCS Header information (see co(1))
|
||||
*
|
||||
* $Author: schemers $
|
||||
*
|
||||
* $Date: 1997/01/08 20:29:33 $
|
||||
*
|
||||
* $Revision: 2.2 $
|
||||
*
|
||||
* $Locker: $
|
||||
*
|
||||
* $Source: /afs/ir/group/networking/src/fping/fping-2.2/src/RCS/fping.c,v $
|
||||
*
|
||||
* $State: Exp $
|
||||
*
|
||||
* $Log: fping.c,v $
|
||||
*
|
||||
* Revision 2.2 1997/01/08 20:29:33 schemers
|
||||
* changes for autoconf/automake
|
||||
*
|
||||
* Revision 2.1 1997/01/08 19:07:18 schemers
|
||||
* checked in RL "Bob"'s changes before configure'ing
|
||||
*
|
||||
* Revision 2.0 1994/10/31 21:26:23 schemers
|
||||
* many changes by RL "Bob" Morgan
|
||||
* add timing data collection, loop mode, per-packet output, etc
|
||||
*
|
||||
* Revision 1.24 1993/12/10 23:11:39 schemers
|
||||
* commented out seteuid(getuid()) since it isn't needed
|
||||
*
|
||||
* Revision 1.23 1993/12/10 18:33:41 schemers
|
||||
* Took out the -f option for non-root users. This can be enabled by
|
||||
* defining ENABLE_F_OPTION before compiling. There is a call to
|
||||
* access before opening the file, but there is a race condition.
|
||||
* Reading from stdin is much safer.
|
||||
*
|
||||
* Revision 1.22 1993/11/16 19:49:24 schemers
|
||||
* Took out setuid(getuid()) and used access() system call to
|
||||
* check for access to the file specified with "-f".
|
||||
*
|
||||
* Revision 1.21 1993/07/20 18:08:19 schemers
|
||||
* commented out the test to make sure the ping packet came from the
|
||||
* same IP address as the one we sent to. This could cause problems on
|
||||
* multi-homed hosts.
|
||||
*
|
||||
* Revision 1.20 1993/02/23 00:16:38 schemers
|
||||
* fixed syntax error (should have compiled before checking in...)
|
||||
*
|
||||
* Revision 1.19 1993/02/23 00:15:15 schemers
|
||||
* turned off printing of "is alive" when -a is specified.
|
||||
*
|
||||
* Revision 1.18 1992/07/28 15:16:44 schemers
|
||||
* added a fflush(stdout) call before the summary is sent to stderr, so
|
||||
* everything shows up in the right order.
|
||||
*
|
||||
* Revision 1.17 1992/07/23 03:29:42 schemers
|
||||
* fixed declaration of timeval_diff.
|
||||
*
|
||||
* Revision 1.16 1992/07/22 19:24:37 schemers
|
||||
* Modified file reading so it would skip blanks lines or lines starting
|
||||
* with a '#'. Now you can do something like:
|
||||
*
|
||||
* fping -ad < /etc/hosts
|
||||
*
|
||||
* Revision 1.15 1992/07/21 17:07:18 schemers
|
||||
* Put in sanity checks so only root can specify "dangerous" options.
|
||||
* Changed usage to show switchs in alphabetical order.
|
||||
*
|
||||
* Revision 1.14 1992/07/21 16:40:52 schemers
|
||||
* Now when sendto returns an error, the host is considered unreachable and
|
||||
* and the error message (from errno) is displayed.
|
||||
*
|
||||
* Revision 1.13 1992/07/17 21:02:17 schemers
|
||||
* changed default timeout to 2500 msec (for WANs), and default try
|
||||
* to 3. This gives 10 second overall timeout.
|
||||
*
|
||||
* Added -e option for showing elapsed (round-trip) time on packets
|
||||
*
|
||||
* Modified -s option to inlude to round-trip stats
|
||||
*
|
||||
* Added #ifndef DEFAULT_* stuff its easier to change the defaults
|
||||
*
|
||||
* Reorganized main loop.
|
||||
*
|
||||
* cleaned up timeval stuff. removed set_timeval and timeval_expired
|
||||
* since they aren't needed anymore. Just use timeval_diff.
|
||||
*
|
||||
* Revision 1.12 1992/07/17 16:38:54 schemers
|
||||
* move socket create call so I could do a setuid(getuid()) before the
|
||||
* fopen call is made. Once the socket is created root privs aren't needed
|
||||
* to send stuff out on it.
|
||||
*
|
||||
* Revision 1.11 1992/07/17 16:28:38 schemers
|
||||
* moved num_timeout counter. It really was for debug purposes and didn't
|
||||
* make sense to the general public :-) Now it is the number of timeouts
|
||||
* (pings that didn't get received with the time limit).
|
||||
*
|
||||
* Revision 1.10 1992/07/16 16:24:38 schemers
|
||||
* changed usage() to use fprintf(stderr,"...");
|
||||
*
|
||||
* Revision 1.9 1992/07/16 16:00:04 schemers
|
||||
* Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE
|
||||
* for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added
|
||||
* check for __cplusplus.
|
||||
*
|
||||
* Revision 1.8 1992/07/16 05:44:41 schemers
|
||||
* changed -a and -u to only show hostname in results. This is
|
||||
* for easier parsing. Also added -v flag
|
||||
*
|
||||
* Revision 1.7 1992/07/14 18:45:23 schemers
|
||||
* initialized last_time in add_host function
|
||||
*
|
||||
* Revision 1.6 1992/07/14 18:32:40 schemers
|
||||
* changed select to use FD_ macros
|
||||
*
|
||||
* Revision 1.5 1992/07/14 17:21:22 schemers
|
||||
* standardized exit status codes
|
||||
*
|
||||
* Revision 1.4 1992/06/26 15:25:35 schemers
|
||||
* changed name from rrping to fping
|
||||
*
|
||||
* Revision 1.3 1992/06/24 15:39:32 schemers
|
||||
* added -d option for unreachable systems
|
||||
*
|
||||
* Revision 1.2 1992/06/23 03:01:23 schemers
|
||||
* misc fixes from R.L. "Bob" Morgan
|
||||
*
|
||||
* Revision 1.1 1992/06/19 18:23:52 schemers
|
||||
* Initial revision
|
||||
*
|
||||
*--------------------------------------------------
|
||||
* Copyright (c) 1992, 1994, 1997 Board of Trustees
|
||||
* Leland Stanford Jr. University
|
||||
***************************************************
|
||||
*/
|
||||
|
||||
|
||||
Tue Mar 14 2001
|
||||
Jason Ewasiuk <jasone@remote.net>
|
||||
- Revision v2.4b1
|
||||
- added -g option for generating IPs from a start to an end value
|
||||
- two available options, generate IPs from start IP to end IP
|
||||
or from a passed netmask, such as 192.168.1.0/24
|
||||
|
||||
Thu Feb 15 2001
|
||||
Jason Ewasiuk <jasone@remote.net>
|
||||
- Revision v2.3b1
|
||||
- formatting changes to code layout (fping.c)
|
||||
NOTE: Best viewed with a tab stop of 4
|
||||
- merged in changes from Debian c/o Herbert Xu
|
||||
<herbert@gondor.apana.org.au>
|
||||
- Compilation fix on alphas with glibc
|
||||
- Alignment issues (note from JE: in wait_for_reply())
|
||||
- A typo with the time specified on the command line
|
||||
(note from JE: bug was using 10 instead of 100)
|
||||
- Drop privileges after obtaining socket
|
||||
(note from JE: might be moot, since prog exits if
|
||||
user is not root)
|
||||
- touched all files in package to this date
|
||||
- couple new #ifdefs added for future WIN32 support
|
||||
(Haven't got to adding this yet, will take a lot of rewriting.)
|
||||
|
||||
Fri Dec 8 10:33:13 2000 Roland Schemers <schemers@stanford.edu>
|
||||
|
||||
* stop using sys_errlist and start using strerror
|
||||
fixed bug in output of -C
|
||||
|
||||
Wed Jan 8 11:18:37 1997 Roland Schemers <schemers@stanford.edu>
|
||||
|
||||
* Created ChangeLog file. What follows was from the CHANGES file.
|
||||
|
||||
* Revision 2.0 1994/10/31 21:26:23 morgan
|
||||
|
||||
Substantial rewrite, including new features:
|
||||
|
||||
support some traditional ping features:
|
||||
loop mode
|
||||
specify size of data packets
|
||||
specify how many pings to send
|
||||
show per-response data
|
||||
interpret ICMPs other than ICMP Echo response
|
||||
|
||||
also
|
||||
|
||||
rewrote main loop completely
|
||||
make timings in tenths of milliseconds
|
||||
do exponential backoff on retries
|
||||
port to more systems
|
||||
add some debugging stuff
|
||||
do better checking on whether received ICMP is for us
|
||||
|
||||
* Revision 1.24 1993/12/10 23:11:39 schemers
|
||||
|
||||
commented out seteuid(getuid()) since it isn't needed
|
||||
|
||||
* Revision 1.23 1993/12/10 18:33:41 schemers
|
||||
|
||||
Took out the -f option for non-root users. This can be enabled by
|
||||
defining ENABLE_F_OPTION before compiling. There is a call to
|
||||
access before opening the file, but there is a race condition.
|
||||
Reading from stdin is much safer.
|
||||
|
||||
|
||||
* Revision 1.22 1993/11/16 19:49:24 schemers
|
||||
|
||||
Took out setuid(getuid()) and used access() system call to
|
||||
check for access to the file specified with "-f".
|
||||
|
||||
* Revision 1.21 1993/07/20 18:08:19 schemers
|
||||
|
||||
commented out the test to make sure the ping packet came from the
|
||||
same IP address as the one we sent to. This could cause problems on
|
||||
multi-homed hosts.
|
||||
|
||||
* Revision 1.20 1993/02/23 00:16:38 schemers
|
||||
|
||||
fixed syntax error (should have compiled before checking in...)
|
||||
|
||||
* Revision 1.19 1993/02/23 00:15:15 schemers
|
||||
|
||||
turned off printing of "is alive" when -a is specified.
|
||||
|
||||
* Revision 1.18 1992/07/28 15:16:44 schemers
|
||||
|
||||
added a fflush(stdout) call before the summary is sent to stderr, so
|
||||
everything shows up in the right order.
|
||||
|
||||
* Revision 1.17 1992/07/23 03:29:42 schemers
|
||||
* Revision 1.16 1992/07/22 19:24:37 schemers
|
||||
|
||||
Fixed declaration of timeval_diff. Didn't notice the problem because
|
||||
I use 'cc' in stead of gcc under Ultrix. Time to switch? :-)
|
||||
|
||||
Modified file reaing so it would skip blank lines or lines starting
|
||||
with a '#'. Now you can do something like:
|
||||
|
||||
fping -ad < /etc/hosts
|
||||
|
||||
* Revision 1.15 1992/07/21 17:07:18 schemers
|
||||
|
||||
Put in sanity checks so only root can specify "dangerous" options.
|
||||
Changed usage to show switchs in alphabetical order.
|
||||
* Revision 1.14 1992/07/21 16:40:52 schemers
|
||||
* Revision 1.13 1992/07/17 21:02:17 schemers
|
||||
|
||||
Changed the default timeout to 2500 msec, and retry to 3. This was
|
||||
due to suggestions from people with slow (WAN) networks. The default
|
||||
1 sec timeout was too fast.
|
||||
|
||||
|
||||
Added '-e' option for showing elapsed (round-trip) times on pakets, and
|
||||
modified the -s option to include min, max, and average round-trip times,
|
||||
and over all elapsed time.
|
||||
|
||||
Modified action taken when a error is returned from sendto. The action
|
||||
taken now considers the host unreachable and prints the hostname
|
||||
followed by the errno message. The program will not exit and will continue
|
||||
to try other hosts.
|
||||
|
||||
* Revision 1.12 1992/07/17 16:38:54 schemers
|
||||
* Revision 1.11 1992/07/17 16:28:38 schemers
|
||||
|
||||
move socket create call so I could do a setuid(getuid()) before the
|
||||
fopen call is made. Once the socket is created root privs aren't needed
|
||||
to send stuff out on it.
|
||||
|
||||
moved num_timeout counter. It really was for debug purposes and didn't
|
||||
make sense to the general public :-) Now it is the number of timeouts
|
||||
(pings that didn't get received with the time limit).
|
||||
|
||||
|
||||
* Revision 1.10 1992/07/16 16:24:38 schemers
|
||||
* Revision 1.9 1992/07/16 16:00:04 schemers
|
||||
* Revision 1.8 1992/07/16 05:44:41 schemers
|
||||
|
||||
Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE
|
||||
for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added
|
||||
check for __cplusplus.
|
||||
|
||||
Now compiles ok under Ultrix 3.1, and Sun4 using cc. Also compiled
|
||||
ok using g++ 2.2.2.
|
||||
|
||||
Changed '-a' and '-u' flags to be mutually exclusive (makes sense, since
|
||||
specifiying both '-a' and '-u' is the same as not specifiying anything.
|
||||
Since '-a' and '-u' are mutually exclusive, these options now only print
|
||||
the hostname, and not the 'is alive' or 'is unreachable' messages.
|
||||
This makes it much easier to do stuff like:
|
||||
|
||||
#!/usr/local/bin/perl
|
||||
$hosts_to_backup=`cat /etc/hosts.backup|fping -a`;
|
||||
|
||||
Since you don't have to strip off the 'is alive' messages.
|
||||
|
||||
Changed usage to and stats to print to stderr instead of stdout.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
RCS header info from original fping.c package (no longer required)
|
||||
|
||||
/*
|
||||
***************************************************
|
||||
*
|
||||
* Standard RCS Header information (see co(1))
|
||||
*
|
||||
* $Author: schemers $
|
||||
*
|
||||
* $Date: 1997/01/08 20:29:33 $
|
||||
*
|
||||
* $Revision: 2.2 $
|
||||
*
|
||||
* $Locker: $
|
||||
*
|
||||
* $Source: /afs/ir/group/networking/src/fping/fping-2.2/src/RCS/fping.c,v $
|
||||
*
|
||||
* $State: Exp $
|
||||
*
|
||||
* $Log: fping.c,v $
|
||||
*
|
||||
* Revision 2.2 1997/01/08 20:29:33 schemers
|
||||
* changes for autoconf/automake
|
||||
*
|
||||
* Revision 2.1 1997/01/08 19:07:18 schemers
|
||||
* checked in RL "Bob"'s changes before configure'ing
|
||||
*
|
||||
* Revision 2.0 1994/10/31 21:26:23 schemers
|
||||
* many changes by RL "Bob" Morgan
|
||||
* add timing data collection, loop mode, per-packet output, etc
|
||||
*
|
||||
* Revision 1.24 1993/12/10 23:11:39 schemers
|
||||
* commented out seteuid(getuid()) since it isn't needed
|
||||
*
|
||||
* Revision 1.23 1993/12/10 18:33:41 schemers
|
||||
* Took out the -f option for non-root users. This can be enabled by
|
||||
* defining ENABLE_F_OPTION before compiling. There is a call to
|
||||
* access before opening the file, but there is a race condition.
|
||||
* Reading from stdin is much safer.
|
||||
*
|
||||
* Revision 1.22 1993/11/16 19:49:24 schemers
|
||||
* Took out setuid(getuid()) and used access() system call to
|
||||
* check for access to the file specified with "-f".
|
||||
*
|
||||
* Revision 1.21 1993/07/20 18:08:19 schemers
|
||||
* commented out the test to make sure the ping packet came from the
|
||||
* same IP address as the one we sent to. This could cause problems on
|
||||
* multi-homed hosts.
|
||||
*
|
||||
* Revision 1.20 1993/02/23 00:16:38 schemers
|
||||
* fixed syntax error (should have compiled before checking in...)
|
||||
*
|
||||
* Revision 1.19 1993/02/23 00:15:15 schemers
|
||||
* turned off printing of "is alive" when -a is specified.
|
||||
*
|
||||
* Revision 1.18 1992/07/28 15:16:44 schemers
|
||||
* added a fflush(stdout) call before the summary is sent to stderr, so
|
||||
* everything shows up in the right order.
|
||||
*
|
||||
* Revision 1.17 1992/07/23 03:29:42 schemers
|
||||
* fixed declaration of timeval_diff.
|
||||
*
|
||||
* Revision 1.16 1992/07/22 19:24:37 schemers
|
||||
* Modified file reading so it would skip blanks lines or lines starting
|
||||
* with a '#'. Now you can do something like:
|
||||
*
|
||||
* fping -ad < /etc/hosts
|
||||
*
|
||||
* Revision 1.15 1992/07/21 17:07:18 schemers
|
||||
* Put in sanity checks so only root can specify "dangerous" options.
|
||||
* Changed usage to show switchs in alphabetical order.
|
||||
*
|
||||
* Revision 1.14 1992/07/21 16:40:52 schemers
|
||||
* Now when sendto returns an error, the host is considered unreachable and
|
||||
* and the error message (from errno) is displayed.
|
||||
*
|
||||
* Revision 1.13 1992/07/17 21:02:17 schemers
|
||||
* changed default timeout to 2500 msec (for WANs), and default try
|
||||
* to 3. This gives 10 second overall timeout.
|
||||
*
|
||||
* Added -e option for showing elapsed (round-trip) time on packets
|
||||
*
|
||||
* Modified -s option to inlude to round-trip stats
|
||||
*
|
||||
* Added #ifndef DEFAULT_* stuff its easier to change the defaults
|
||||
*
|
||||
* Reorganized main loop.
|
||||
*
|
||||
* cleaned up timeval stuff. removed set_timeval and timeval_expired
|
||||
* since they aren't needed anymore. Just use timeval_diff.
|
||||
*
|
||||
* Revision 1.12 1992/07/17 16:38:54 schemers
|
||||
* move socket create call so I could do a setuid(getuid()) before the
|
||||
* fopen call is made. Once the socket is created root privs aren't needed
|
||||
* to send stuff out on it.
|
||||
*
|
||||
* Revision 1.11 1992/07/17 16:28:38 schemers
|
||||
* moved num_timeout counter. It really was for debug purposes and didn't
|
||||
* make sense to the general public :-) Now it is the number of timeouts
|
||||
* (pings that didn't get received with the time limit).
|
||||
*
|
||||
* Revision 1.10 1992/07/16 16:24:38 schemers
|
||||
* changed usage() to use fprintf(stderr,"...");
|
||||
*
|
||||
* Revision 1.9 1992/07/16 16:00:04 schemers
|
||||
* Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE
|
||||
* for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added
|
||||
* check for __cplusplus.
|
||||
*
|
||||
* Revision 1.8 1992/07/16 05:44:41 schemers
|
||||
* changed -a and -u to only show hostname in results. This is
|
||||
* for easier parsing. Also added -v flag
|
||||
*
|
||||
* Revision 1.7 1992/07/14 18:45:23 schemers
|
||||
* initialized last_time in add_host function
|
||||
*
|
||||
* Revision 1.6 1992/07/14 18:32:40 schemers
|
||||
* changed select to use FD_ macros
|
||||
*
|
||||
* Revision 1.5 1992/07/14 17:21:22 schemers
|
||||
* standardized exit status codes
|
||||
*
|
||||
* Revision 1.4 1992/06/26 15:25:35 schemers
|
||||
* changed name from rrping to fping
|
||||
*
|
||||
* Revision 1.3 1992/06/24 15:39:32 schemers
|
||||
* added -d option for unreachable systems
|
||||
*
|
||||
* Revision 1.2 1992/06/23 03:01:23 schemers
|
||||
* misc fixes from R.L. "Bob" Morgan
|
||||
*
|
||||
* Revision 1.1 1992/06/19 18:23:52 schemers
|
||||
* Initial revision
|
||||
*
|
||||
*--------------------------------------------------
|
||||
* Copyright (c) 1992, 1994, 1997 Board of Trustees
|
||||
* Leland Stanford Jr. University
|
||||
***************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
|
||||
Problems and Notes
|
||||
==================
|
||||
|
||||
Apr 2001
|
||||
- Making fping requires 'm4' and 'autoheader'
|
||||
- fping is known not to build on Solaris. (Solaris lacks 'autoheader')
|
||||
- fping has been reported to bug out if a file contains more than 3600 addresses to scan.
|
||||
- If you are having problems compiling, try an earlier version (2.2b2 for example)
|
||||
+7
-3
@@ -1,5 +1,9 @@
|
||||
|
||||
/*
|
||||
* Original author: Roland Schemers <schemers@stanford.edu>
|
||||
* IPv6 Support: Jeroen Massar <jeroen@unfix.org / jeroen@ipng.nl>
|
||||
* Improved main loop: David Schweikert <david@schweikert.ch>
|
||||
* Debian Merge, TOS settings: Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Bugfixes, byte order & senseful seq.-numbers: Stephan Fuhrmann (stephan.fuhrmann AT 1und1.de)
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
@@ -11,5 +15,5 @@
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
Detailed license info can be found in supplied source files.
|
||||
@@ -1,5 +0,0 @@
|
||||
sbin_PROGRAMS = fping
|
||||
fping_SOURCES = fping.c options.h linux.h
|
||||
man_MANS = fping.8
|
||||
AUTOMAKE_OPTIONS=foreign
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
-397
@@ -1,397 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
PACKAGE = @PACKAGE@
|
||||
VERSION = @VERSION@
|
||||
|
||||
sbin_PROGRAMS = fping
|
||||
fping_SOURCES = fping.c options.h linux.h
|
||||
man_MANS = fping.8
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(sbin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
fping_OBJECTS = fping.o
|
||||
fping_LDADD = $(LDADD)
|
||||
fping_DEPENDENCIES =
|
||||
fping_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
man8dir = $(mandir)/man8
|
||||
MANS = $(man_MANS)
|
||||
|
||||
NROFF = nroff
|
||||
DIST_COMMON = README ./stamp-h.in COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in acconfig.h aclocal.m4 config.h.in configure configure.in \
|
||||
install-sh missing mkinstalldirs
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(fping_SOURCES)
|
||||
OBJECTS = $(fping_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
mostlyclean-sbinPROGRAMS:
|
||||
|
||||
clean-sbinPROGRAMS:
|
||||
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
|
||||
|
||||
distclean-sbinPROGRAMS:
|
||||
|
||||
maintainer-clean-sbinPROGRAMS:
|
||||
|
||||
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(sbindir)
|
||||
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-sbinPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(sbin_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
done
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
fping: $(fping_OBJECTS) $(fping_DEPENDENCIES)
|
||||
@rm -f fping
|
||||
$(LINK) $(fping_LDFLAGS) $(fping_OBJECTS) $(fping_LDADD) $(LIBS)
|
||||
|
||||
install-man8:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man8dir)
|
||||
@list='$(man8_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
|
||||
uninstall-man8:
|
||||
@list='$(man8_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.8*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man8dir)/$$inst; \
|
||||
done
|
||||
install-man: $(MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-man8
|
||||
uninstall-man:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-man8
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am: install-sbinPROGRAMS
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-man
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-sbinPROGRAMS uninstall-man
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS) $(MANS) config.h
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \
|
||||
clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-sbinPROGRAMS distclean-compile \
|
||||
distclean-tags distclean-generic clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \
|
||||
maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
|
||||
install-sbinPROGRAMS mostlyclean-compile distclean-compile \
|
||||
clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
|
||||
install-man uninstall-man tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck all-recursive-am install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -0,0 +1,21 @@
|
||||
# fping 3
|
||||
|
||||
fping is a program to send ICMP echo probes to network hosts, similar to ping,
|
||||
but much better performing when pinging multiple hosts. fping has a long long
|
||||
story: Roland Schemers did publish a first version of it in 1992 and it has
|
||||
established itself since then as a standard tool.
|
||||
|
||||
_Current maintainer_:
|
||||
David Schweikert \<david@schweikert.ch\>
|
||||
|
||||
_Website_:
|
||||
http://fping.org/
|
||||
|
||||
_Mailing-list_:
|
||||
https://groups.google.com/group/fping-users
|
||||
|
||||
## Credits
|
||||
Original author: Roland Schemers (schemers@stanford.edu)
|
||||
Previous maintainer: RL "Bob" Morgan (morgan@stanford.edu)
|
||||
Initial IPv6 Support: Jeroen Massar (jeroen@unfix.org / jeroen@ipng.nl)
|
||||
Other contributors: see ChangeLog
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
@TOP@
|
||||
|
||||
/* VERSION (from configure.in) */
|
||||
#undef VERSION
|
||||
|
||||
|
||||
@BOTTOM@
|
||||
|
||||
/* some OSes do not define this ... lets take a wild guess */
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
# define INADDR_NONE 0xffffffffU
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
Vendored
-127
@@ -1,127 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "[$]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
AUTOCONF=http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
|
||||
AUTOMAKE=http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz
|
||||
LIBTOOL=http://alpha.gnu.org/gnu/libtool/libtool-2.4.2.418.tar.gz
|
||||
PREFIX=$(pwd)/ci/build
|
||||
PATH=$(pwd)/ci/build/bin:$PATH
|
||||
|
||||
if [ ! -d ci ]; then
|
||||
echo "you must run this in the root fping directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# remove standard versions
|
||||
sudo apt-get remove -qq autoconf automake autotools-dev libtool
|
||||
|
||||
# prepare build environment
|
||||
cd ci
|
||||
rm -rf build
|
||||
mkdir -p build/src
|
||||
cd build/src
|
||||
|
||||
# autoconf
|
||||
(
|
||||
AUTOCONF_FILE=$(basename $AUTOCONF)
|
||||
AUTOCONF_DIR=$(echo $AUTOCONF_FILE | sed -e 's/\.tar.*//')
|
||||
wget $AUTOCONF
|
||||
tar xf $AUTOCONF_FILE
|
||||
cd $AUTOCONF_DIR
|
||||
./configure --prefix=$PREFIX
|
||||
make install
|
||||
)
|
||||
|
||||
# automake
|
||||
(
|
||||
AUTOMAKE_FILE=$(basename $AUTOMAKE)
|
||||
AUTOMAKE_DIR=$(echo $AUTOMAKE_FILE | sed -e 's/\.tar.*//')
|
||||
wget $AUTOMAKE
|
||||
tar xf $AUTOMAKE_FILE
|
||||
cd $AUTOMAKE_DIR
|
||||
./configure --prefix=$PREFIX
|
||||
make install
|
||||
)
|
||||
|
||||
# libtool
|
||||
(
|
||||
LIBTOOL_FILE=$(basename $LIBTOOL)
|
||||
LIBTOOL_DIR=$(echo $LIBTOOL_FILE | sed -e 's/\.tar.*//')
|
||||
wget $LIBTOOL
|
||||
tar xf $LIBTOOL_FILE
|
||||
cd $LIBTOOL_DIR
|
||||
./configure --prefix=$PREFIX
|
||||
make install
|
||||
)
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
PATH=$(pwd)/ci/build/bin:$PATH
|
||||
|
||||
if [ ! -d ci ]; then
|
||||
echo "you must run this in the root fping directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
autoreconf -i
|
||||
./configure --enable-ipv4 --enable-ipv6 --prefix=/opt/fping
|
||||
make CFLAGS="-g -fprofile-arcs -ftest-coverage"
|
||||
## setcap currently doesn't worn anymore on travis-ci
|
||||
#sudo setcap cap_net_raw+ep src/fping
|
||||
#sudo setcap cap_net_raw+ep src/fping6
|
||||
## setcap debugging:
|
||||
#pwd
|
||||
#df -k .
|
||||
#which setcap
|
||||
#uname -a
|
||||
#mount
|
||||
#
|
||||
#sudo apt-get install strace
|
||||
#sudo strace setcap cap_net_raw+ep src/fping
|
||||
|
||||
# use setuid, since setcap is not available
|
||||
sudo chown root src/fping
|
||||
sudo chown root src/fping6
|
||||
sudo chmod u+s src/fping
|
||||
sudo chmod u+s src/fping6
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
sudo pip install cpp-coveralls --use-mirrors
|
||||
|
||||
cd src
|
||||
|
||||
ls -l
|
||||
|
||||
gcov *.o
|
||||
cd ..
|
||||
coveralls --exclude ci --no-gcov
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# upload to bintray.com/schweikert
|
||||
|
||||
set -e
|
||||
|
||||
# do this only for the gcc run
|
||||
if [ "$CC" != "gcc" ]; then
|
||||
echo "skipped upload because $CC != gcc"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# do this only for the master branch
|
||||
if [ "$TRAVIS_BRANCH" != "master" ]; then
|
||||
echo "skipped upload branch $TRAVIS_BRANCH isn't master"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
VERSION=$(ls fping-*.tar.gz | sed -e 's/^fping-//' | sed -e 's/\.tar\.gz$//')
|
||||
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then
|
||||
REPO=release
|
||||
else
|
||||
REPO=beta
|
||||
fi
|
||||
curl -T fping-$VERSION.tar.gz -uschweikert:$BINTRAY_API_KEY https://api.bintray.com/content/schweikert/$REPO/fping/$VERSION/fping-$VERSION.tar.gz
|
||||
echo
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo setcap cap_net_raw+ep src/fping
|
||||
sudo setcap cap_net_raw+ep src/fping6
|
||||
|
||||
if [[ ! $PATH =~ fping/src ]]; then
|
||||
echo "# WARNING: must set PATH:"
|
||||
echo PATH=/home/dws/checkouts/fping/src:\$PATH
|
||||
fi
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# only do this on Mac OS X
|
||||
if [ `uname -s` != "Darwin" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
if [[ ! `ifconfig lo0` =~ 127\.0\.0\.2 ]]; then
|
||||
sudo ifconfig lo0 127.0.0.2/8 alias
|
||||
sudo ifconfig lo0 127.0.0.3/8 alias
|
||||
sudo ifconfig lo0 127.0.0.4/8 alias
|
||||
sudo ifconfig lo0 127.0.0.5/8 alias
|
||||
fi
|
||||
|
||||
if [[ ! $PATH =~ /Users/dws/checkouts/fping/src ]]; then
|
||||
echo "# WARNING: must set PATH:"
|
||||
echo PATH=/Users/dws/checkouts/fping/src:\$PATH
|
||||
fi
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 9;
|
||||
|
||||
# ping 127.0.0.1
|
||||
my $cmd1 = Test::Command->new(cmd => "fping 127.0.0.1");
|
||||
$cmd1->exit_is_num(0);
|
||||
$cmd1->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd1->stderr_is_eq("");
|
||||
|
||||
# ping ::1
|
||||
my $cmd2 = Test::Command->new(cmd => "fping6 ::1");
|
||||
$cmd2->exit_is_num(0);
|
||||
$cmd2->stdout_is_eq("::1 is alive\n");
|
||||
$cmd2->stderr_is_eq("");
|
||||
|
||||
# ping 3 times 127.0.0.1
|
||||
my $cmd3 = Test::Command->new(cmd => "fping -p 100 -C3 127.0.0.1");
|
||||
$cmd3->exit_is_num(0);
|
||||
$cmd3->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[2\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
});
|
||||
$cmd3->stderr_like(qr{127\.0\.0\.1 : 0\.\d+ 0\.\d+ 0\.\d+\n});
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 9;
|
||||
|
||||
my $I_HELP = " -I if bind to a particular interface\n";
|
||||
$I_HELP = '' if $^O eq 'darwin';
|
||||
|
||||
# fping -h
|
||||
my $cmd1 = Test::Command->new(cmd => "fping -h");
|
||||
$cmd1->exit_is_num(0);
|
||||
$cmd1->stdout_is_eq(<<END);
|
||||
|
||||
Usage: fping [options] [targets...]
|
||||
-a show targets that are alive
|
||||
-A show targets by address
|
||||
-b n amount of ping data to send, in bytes (default 56)
|
||||
-B f set exponential backoff factor to f
|
||||
-c n count of pings to send to each target (default 1)
|
||||
-C n same as -c, report results in verbose format
|
||||
-D print timestamp before each output line
|
||||
-e show elapsed time on return packets
|
||||
-f file read list of targets from a file ( - means stdin) (only if no -g specified)
|
||||
-g generate target list (only if no -f specified)
|
||||
(specify the start and end IP in the target list, or supply a IP netmask)
|
||||
(ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.168.1.0/24)
|
||||
-H n Set the IP TTL value (Time To Live hops)
|
||||
-i n interval between sending ping packets (in millisec) (default 25)
|
||||
${I_HELP} -l loop sending pings forever
|
||||
-m ping multiple interfaces on target host
|
||||
-n show targets by name (-d is equivalent)
|
||||
-O n set the type of service (tos) flag on the ICMP packets
|
||||
-p n interval between ping packets to one target (in millisec)
|
||||
(in looping and counting modes, default 1000)
|
||||
-q quiet (don't show per-target/per-ping results)
|
||||
-Q n same as -q, but show summary every n seconds
|
||||
-r n number of retries (default 3)
|
||||
-R random packet data (to foil link data compression)
|
||||
-s print final stats
|
||||
-S addr set source address
|
||||
-t n individual target initial timeout (in millisec) (default 500)
|
||||
-T n ignored (for compatibility with fping 2.4)
|
||||
-u show targets that are unreachable
|
||||
-v show version
|
||||
targets list of targets to check (if no -f specified)
|
||||
|
||||
END
|
||||
$cmd1->stderr_is_eq("");
|
||||
|
||||
# fping -v
|
||||
my $cmd2 = Test::Command->new(cmd => "fping -v");
|
||||
$cmd2->exit_is_num(0);
|
||||
$cmd2->stdout_like(qr{fping: Version \S+
|
||||
fping: comments to david\@schweikert\.ch\n});
|
||||
$cmd2->stderr_is_eq("");
|
||||
|
||||
# fping with unknown option
|
||||
my $cmd3 = Test::Command->new(cmd => "fping -Z");
|
||||
$cmd3->exit_is_num(1);
|
||||
$cmd3->stdout_is_eq("");
|
||||
if($^O eq 'darwin') {
|
||||
$cmd3->stderr_is_eq("fping: illegal option -- Z\nsee 'fping -h' for usage information\n");
|
||||
}
|
||||
else {
|
||||
$cmd3->stderr_is_eq("fping: invalid option -- 'Z'\nsee 'fping -h' for usage information\n");
|
||||
}
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 33;
|
||||
|
||||
# fping -i 9
|
||||
my $cmd1 = Test::Command->new(cmd => "fping -i 9 -T10 -g 127.0.0.1/29");
|
||||
$cmd1->exit_is_num(1);
|
||||
$cmd1->stdout_is_eq("");
|
||||
$cmd1->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -p 15
|
||||
my $cmd2 = Test::Command->new(cmd => "fping -c3 -p 15 127.0.0.1");
|
||||
$cmd2->exit_is_num(1);
|
||||
$cmd2->stdout_is_eq("");
|
||||
$cmd2->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -r 30
|
||||
my $cmd3 = Test::Command->new(cmd => "fping -r 30 127.0.0.1");
|
||||
$cmd3->exit_is_num(1);
|
||||
$cmd3->stdout_is_eq("");
|
||||
$cmd3->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -t 40
|
||||
my $cmd4 = Test::Command->new(cmd => "fping -t 40 127.0.0.1");
|
||||
$cmd4->exit_is_num(1);
|
||||
$cmd4->stdout_is_eq("");
|
||||
$cmd4->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -H 300
|
||||
my $cmd5 = Test::Command->new(cmd => "fping -H 300 127.0.0.1");
|
||||
$cmd5->exit_is_num(1);
|
||||
$cmd5->stdout_is_eq("");
|
||||
$cmd5->stderr_is_eq("ttl 300 out of range\n");
|
||||
|
||||
# fping -a -u
|
||||
my $cmd6 = Test::Command->new(cmd => "fping -a -u 127.0.0.1");
|
||||
$cmd6->exit_is_num(1);
|
||||
$cmd6->stdout_is_eq("");
|
||||
$cmd6->stderr_is_eq("fping: specify only one of a, u\n");
|
||||
|
||||
# fping -c -l
|
||||
my $cmd7 = Test::Command->new(cmd => "fping -c3 -l 127.0.0.1");
|
||||
$cmd7->exit_is_num(1);
|
||||
$cmd7->stdout_is_eq("");
|
||||
$cmd7->stderr_is_eq("fping: specify only one of c, l\n");
|
||||
|
||||
# fping -b 65509
|
||||
my $cmd8 = Test::Command->new(cmd => "fping -b 65509 127.0.0.1");
|
||||
$cmd8->exit_is_num(1);
|
||||
$cmd8->stdout_is_eq("");
|
||||
$cmd8->stderr_is_eq("fping: data size 65509 not valid, must be between 0 and 65508\n");
|
||||
|
||||
# fping -B 0.9
|
||||
my $cmd9 = Test::Command->new(cmd => "fping -B 0.9 127.0.0.1");
|
||||
$cmd9->exit_is_num(1);
|
||||
$cmd9->stdout_is_eq("");
|
||||
$cmd9->stderr_is_eq("fping: backoff factor 0.9 not valid, must be between 1.0 and 5.0\n");
|
||||
|
||||
# fping -B 0.9
|
||||
my $cmd10 = Test::Command->new(cmd => "fping -B 5.1 127.0.0.1");
|
||||
$cmd10->exit_is_num(1);
|
||||
$cmd10->stdout_is_eq("");
|
||||
$cmd10->stderr_is_eq("fping: backoff factor 5.1 not valid, must be between 1.0 and 5.0\n");
|
||||
|
||||
# fping -C 11000
|
||||
my $cmd11 = Test::Command->new(cmd => "fping -C 11000 127.0.0.1");
|
||||
$cmd11->exit_is_num(1);
|
||||
$cmd11->stdout_is_eq("");
|
||||
$cmd11->stderr_is_eq("fping: count 11000 not valid, must be less than 10000\n");
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 14;
|
||||
use Test::More;
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
|
||||
# -a show targets that are alive
|
||||
# -A show targets by address
|
||||
# -b n amount of ping data to send, in bytes (default 56)
|
||||
# -B f set exponential backoff factor to f
|
||||
|
||||
# fping -a
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -a 127.0.0.1 127.0.0.2");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1\n127.0.0.2\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -A
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -A localhost");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -b
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -b 1000 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -B
|
||||
{
|
||||
my $t0 = [gettimeofday];
|
||||
my $cmd = Test::Command->new(cmd => "fping -t 100 -r 3 -B 2 8.8.8.7");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("8.8.8.7 is unreachable\n");
|
||||
$cmd->stderr_like(qr{^(|(8.8.8.7: error while sending ping: No route to host\n)+)$});
|
||||
my $elapsed = tv_interval($t0);
|
||||
# 0.1 + 0.2 + 0.4 + 0.8 = 1.5
|
||||
cmp_ok($elapsed, '>=', 1.5);
|
||||
cmp_ok($elapsed, '<', 1.8);
|
||||
}
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 12;
|
||||
|
||||
# -c n count of pings to send to each target (default 1)
|
||||
# -C n same as -c, report results in verbose format
|
||||
# -D print timestamp before each output line
|
||||
# -e show elapsed time on return packets
|
||||
|
||||
# fping -c n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -c 2 -p 100 localhost 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
localhost : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
|
||||
$cmd->stderr_like(qr{localhost : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -C n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -C 2 -p 100 localhost 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
localhost : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
|
||||
$cmd->stderr_like(qr{localhost : 0\.\d+ 0\.\d+
|
||||
127\.0\.0\.1 : 0\.\d+ 0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -D
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -D -c 2 -p 100 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\[\d{10}\.\d+\] 127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
\[\d{10}\.\d+\] 127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
|
||||
$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -e
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -e 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{127\.0\.0\.1 is alive \(0\.\d+ ms\)
|
||||
});
|
||||
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 18;
|
||||
use File::Temp;
|
||||
|
||||
# -f file read list of targets from a file ( - means stdin) (only if no -g specified)
|
||||
# -g generate target list (only if no -f specified)
|
||||
# (specify the start and end IP in the target list, or supply a IP netmask)
|
||||
# (ex. ../src/fping -g 192.168.1.0 192.168.1.255 or ../src/fping -g 192.168.1.0/24)
|
||||
# -H n Set the IP TTL value (Time To Live hops)
|
||||
|
||||
my $tmpfile = File::Temp->new();
|
||||
print $tmpfile "127.0.0.1\n127.0.0.2\n";
|
||||
close($tmpfile);
|
||||
|
||||
# fping without option (-> equivalent to 'fping -f -')
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "cat ".$tmpfile->filename." | fping");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -f -
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "cat ".$tmpfile->filename." | fping -f -");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -f file
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -f ".$tmpfile->filename);
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -g (range)
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -g 127.0.0.1 127.0.0.5");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n127.0.0.3 is alive\n127.0.0.4 is alive\n127.0.0.5 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -g (cidr)
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -g 127.0.0.1/30");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -H
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -H 1 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 4;
|
||||
|
||||
# -i n interval between sending ping packets (in millisec) (default 25)
|
||||
# -l loop sending pings forever
|
||||
# -m ping multiple interfaces on target host
|
||||
|
||||
# fping -i n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -i 100 127.0.0.1 127.0.0.2");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -l
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => '(sleep 2; pkill fping)& fping -p 900 -l 127.0.0.1');
|
||||
$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
}
|
||||
|
||||
# fping -m -> test-14-internet-hosts
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 9;
|
||||
|
||||
# -n show targets by name (-d is equivalent)
|
||||
# -O n set the type of service (tos) flag on the ICMP packets
|
||||
# -p n interval between ping packets to one target (in millisec)
|
||||
# (in looping and counting modes, default 1000)
|
||||
# -q quiet (don't show per-target/per-ping results)
|
||||
# -Q n same as -q, but show summary every n seconds
|
||||
|
||||
# fping -n -> test-14-internet-hosts
|
||||
|
||||
# fping -O
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -O 2 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -q
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -q -p 100 -c 3 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -Q
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -Q 1 -p 400 -c 4 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{\[\d+:\d+:\d+\]
|
||||
127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
127\.0\.0\.1 : xmt/rcv/%loss = 4/4/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 18;
|
||||
|
||||
# -R random bytes
|
||||
# -r n number of retries (default 3)
|
||||
# -s print final stats
|
||||
# -S addr set source address
|
||||
# -t n individual target initial timeout (in millisec) (default 500)
|
||||
# -T n ignored (for compatibility with fping 2.4)
|
||||
|
||||
# fping -R
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -q -R -c3 -p100 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%.*});
|
||||
}
|
||||
|
||||
# fping6 -R
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping6 -q -R -c3 -p100 ::1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{::1 : xmt/rcv/%loss = 3/3/0%.*});
|
||||
}
|
||||
|
||||
# fping -r tested in test-4-options-a-b.pl
|
||||
|
||||
# fping -s
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -s 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_like(qr{\s*
|
||||
\s*1 targets
|
||||
\s*1 alive
|
||||
\s*0 unreachable
|
||||
\s*0 unknown addresses
|
||||
\s*
|
||||
\s*0 timeouts \(waiting for response\)
|
||||
\s*1 ICMP Echos sent
|
||||
\s*1 ICMP Echo Replies received
|
||||
\s*0 other ICMP received
|
||||
|
||||
\s*0.\d+ ms \(min round trip time\)
|
||||
\s*0.\d+ ms \(avg round trip time\)
|
||||
\s*0.\d+ ms \(max round trip time\)
|
||||
\s*0.\d+ sec \(elapsed real time\)
|
||||
});
|
||||
}
|
||||
|
||||
# fping -s (no host reachable)
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -r0 -t100 -s 8.8.0.0");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("8.8.0.0 is unreachable\n");
|
||||
$cmd->stderr_like(qr{\s*
|
||||
\s*1 targets
|
||||
\s*0 alive
|
||||
\s*1 unreachable
|
||||
\s*0 unknown addresses
|
||||
\s*
|
||||
\s*1 timeouts \(waiting for response\)
|
||||
\s*1 ICMP Echos sent
|
||||
\s*0 ICMP Echo Replies received
|
||||
\s*0 other ICMP received
|
||||
|
||||
\s*0.\d+ ms \(min round trip time\)
|
||||
\s*0.\d+ ms \(avg round trip time\)
|
||||
\s*0.\d+ ms \(max round trip time\)
|
||||
\s*0.\d+ sec \(elapsed real time\)
|
||||
});
|
||||
}
|
||||
|
||||
# fping -S
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -S 127.0.0.1 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping6 -S
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping6 -S ::1 ::1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("::1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -t tested in test-4-options-a-b.pl
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 9;
|
||||
|
||||
# ping 127.0.0.1
|
||||
my $cmd1 = Test::Command->new(cmd => "fping 127.0.0.1");
|
||||
$cmd1->exit_is_num(0);
|
||||
$cmd1->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd1->stderr_is_eq("");
|
||||
|
||||
# ping ::1
|
||||
my $cmd2 = Test::Command->new(cmd => "fping6 ::1");
|
||||
$cmd2->exit_is_num(0);
|
||||
$cmd2->stdout_is_eq("::1 is alive\n");
|
||||
$cmd2->stderr_is_eq("");
|
||||
|
||||
# ping 3 times 127.0.0.1
|
||||
my $cmd3 = Test::Command->new(cmd => "fping -p 100 -C3 127.0.0.1");
|
||||
$cmd3->exit_is_num(0);
|
||||
$cmd3->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[2\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
});
|
||||
$cmd3->stderr_like(qr{127\.0\.0\.1 : 0\.\d+ 0\.\d+ 0\.\d+\n});
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 6;
|
||||
|
||||
# -u show targets that are unreachable
|
||||
# -v show version
|
||||
|
||||
# fping -u
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -r0 -u 8.8.0.0 127.0.0.1");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("8.8.0.0\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -v
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -v");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{ping: Version 3\.\d+(-rc\d+)?
|
||||
fping: comments to david\@schweikert\.ch
|
||||
});
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command;
|
||||
use Test::More;
|
||||
|
||||
if( $^O eq 'darwin' ) {
|
||||
plan skip_all => 'Test irrelevant on MacOS';
|
||||
exit 0;
|
||||
}
|
||||
plan tests => 6;
|
||||
|
||||
# run without privileges
|
||||
my $fping_bin = `which fping`; chomp $fping_bin;
|
||||
my $fping6_bin = `which fping6`; chomp $fping6_bin;
|
||||
system("cp $fping_bin /tmp/fping.copy; chmod +x /tmp/fping.copy");
|
||||
system("cp $fping6_bin /tmp/fping6.copy; chmod +x /tmp/fping6.copy");
|
||||
|
||||
# fping
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "/tmp/fping.copy 127.0.0.1");
|
||||
$cmd->exit_is_num(4);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{\(null\): can't create socket \(must run as root\?\) : .*\n});
|
||||
}
|
||||
|
||||
# fping6
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "/tmp/fping6.copy ::1");
|
||||
$cmd->exit_is_num(4);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{\(null\): can't create raw socket \(must run as root\?\) : .*\n});
|
||||
}
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 36;
|
||||
|
||||
for my $arg (qw(i b B c C H i O p Q r t)) {
|
||||
my $cmd = Test::Command->new(cmd => "fping -$arg xxx");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{Usage:});
|
||||
}
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 6;
|
||||
|
||||
# fping
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping nosuchname.example.com");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{^nosuchname\.example\.com: .*not (known|found)});
|
||||
}
|
||||
|
||||
# fping6
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping6 nosuchname.example.com");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{^nosuchname\.example\.com: .*not (known|found)});
|
||||
}
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command;
|
||||
use Test::More;
|
||||
|
||||
# evaluate if we have internet
|
||||
if(!gethostbyname("www.google.com")) {
|
||||
plan skip_all => 'Can\'t resolve www.google.com -> no internet?';
|
||||
exit 0;
|
||||
}
|
||||
|
||||
plan tests => 18;
|
||||
|
||||
my $re_num = qr{\d+(?:\.\d+)?};
|
||||
|
||||
# fping
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -q -i 10 -p 20 -c 3 -t200 8.8.8.8 4.2.2.5 www.france-telecom.fr www.google.com");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{8\.8\.8\.8\s*: xmt/rcv/%loss = [123]/3/\d+%, min/avg/max = $re_num/$re_num/$re_num
|
||||
4\.2\.2\.5\s*: xmt/rcv/%loss = [123]/3/\d+%, min/avg/max = $re_num/$re_num/$re_num
|
||||
www\.france-telecom\.fr\s*: xmt/rcv/%loss = [123]/3/\d+%, min/avg/max = $re_num/$re_num/$re_num
|
||||
www\.google\.com\s*: xmt/rcv/%loss = [123]/3/\d+%, min/avg/max = $re_num/$re_num/$re_num
|
||||
});
|
||||
}
|
||||
|
||||
# fping -A -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -A -n 8.8.8.8");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com (8.8.8.8) is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -A -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -A -n google-public-dns-a.google.com");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com (8.8.8.8) is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping6 -A -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping6 -n -A 2001:4860:4860::8888");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com (2001:4860:4860::8888) is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -m
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -m google-public-dns-a.google.com");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -n 8.8.8.8");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 9;
|
||||
|
||||
my $I_HELP = " -I if bind to a particular interface\n";
|
||||
$I_HELP = '' if $^O eq 'darwin';
|
||||
|
||||
# fping -h
|
||||
my $cmd1 = Test::Command->new(cmd => "fping -h");
|
||||
$cmd1->exit_is_num(0);
|
||||
$cmd1->stdout_is_eq(<<END);
|
||||
|
||||
Usage: fping [options] [targets...]
|
||||
-a show targets that are alive
|
||||
-A show targets by address
|
||||
-b n amount of ping data to send, in bytes (default 56)
|
||||
-B f set exponential backoff factor to f
|
||||
-c n count of pings to send to each target (default 1)
|
||||
-C n same as -c, report results in verbose format
|
||||
-D print timestamp before each output line
|
||||
-e show elapsed time on return packets
|
||||
-f file read list of targets from a file ( - means stdin) (only if no -g specified)
|
||||
-g generate target list (only if no -f specified)
|
||||
(specify the start and end IP in the target list, or supply a IP netmask)
|
||||
(ex. fping -g 192.168.1.0 192.168.1.255 or fping -g 192.168.1.0/24)
|
||||
-H n Set the IP TTL value (Time To Live hops)
|
||||
-i n interval between sending ping packets (in millisec) (default 25)
|
||||
${I_HELP} -l loop sending pings forever
|
||||
-m ping multiple interfaces on target host
|
||||
-n show targets by name (-d is equivalent)
|
||||
-O n set the type of service (tos) flag on the ICMP packets
|
||||
-p n interval between ping packets to one target (in millisec)
|
||||
(in looping and counting modes, default 1000)
|
||||
-q quiet (don't show per-target/per-ping results)
|
||||
-Q n same as -q, but show summary every n seconds
|
||||
-r n number of retries (default 3)
|
||||
-R random packet data (to foil link data compression)
|
||||
-s print final stats
|
||||
-S addr set source address
|
||||
-t n individual target initial timeout (in millisec) (default 500)
|
||||
-T n ignored (for compatibility with fping 2.4)
|
||||
-u show targets that are unreachable
|
||||
-v show version
|
||||
targets list of targets to check (if no -f specified)
|
||||
|
||||
END
|
||||
$cmd1->stderr_is_eq("");
|
||||
|
||||
# fping -v
|
||||
my $cmd2 = Test::Command->new(cmd => "fping -v");
|
||||
$cmd2->exit_is_num(0);
|
||||
$cmd2->stdout_like(qr{fping: Version \S+
|
||||
fping: comments to david\@schweikert\.ch\n});
|
||||
$cmd2->stderr_is_eq("");
|
||||
|
||||
# fping with unknown option
|
||||
my $cmd3 = Test::Command->new(cmd => "fping -Z");
|
||||
$cmd3->exit_is_num(1);
|
||||
$cmd3->stdout_is_eq("");
|
||||
if($^O eq 'darwin') {
|
||||
$cmd3->stderr_is_eq("fping: illegal option -- Z\nsee 'fping -h' for usage information\n");
|
||||
}
|
||||
else {
|
||||
$cmd3->stderr_is_eq("fping: invalid option -- 'Z'\nsee 'fping -h' for usage information\n");
|
||||
}
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 33;
|
||||
|
||||
# fping -i 9
|
||||
my $cmd1 = Test::Command->new(cmd => "fping -i 9 -T10 -g 127.0.0.1/29");
|
||||
$cmd1->exit_is_num(1);
|
||||
$cmd1->stdout_is_eq("");
|
||||
$cmd1->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -p 15
|
||||
my $cmd2 = Test::Command->new(cmd => "fping -c3 -p 15 127.0.0.1");
|
||||
$cmd2->exit_is_num(1);
|
||||
$cmd2->stdout_is_eq("");
|
||||
$cmd2->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -r 30
|
||||
my $cmd3 = Test::Command->new(cmd => "fping -r 30 127.0.0.1");
|
||||
$cmd3->exit_is_num(1);
|
||||
$cmd3->stdout_is_eq("");
|
||||
$cmd3->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -t 40
|
||||
my $cmd4 = Test::Command->new(cmd => "fping -t 40 127.0.0.1");
|
||||
$cmd4->exit_is_num(1);
|
||||
$cmd4->stdout_is_eq("");
|
||||
$cmd4->stderr_is_eq(<<END);
|
||||
fping: these options are too risky for mere mortals.
|
||||
fping: You need i >= 10, p >= 20, r < 20, and t >= 50
|
||||
END
|
||||
|
||||
# fping -H 300
|
||||
my $cmd5 = Test::Command->new(cmd => "fping -H 300 127.0.0.1");
|
||||
$cmd5->exit_is_num(1);
|
||||
$cmd5->stdout_is_eq("");
|
||||
$cmd5->stderr_is_eq("ttl 300 out of range\n");
|
||||
|
||||
# fping -a -u
|
||||
my $cmd6 = Test::Command->new(cmd => "fping -a -u 127.0.0.1");
|
||||
$cmd6->exit_is_num(1);
|
||||
$cmd6->stdout_is_eq("");
|
||||
$cmd6->stderr_is_eq("fping: specify only one of a, u\n");
|
||||
|
||||
# fping -c -l
|
||||
my $cmd7 = Test::Command->new(cmd => "fping -c3 -l 127.0.0.1");
|
||||
$cmd7->exit_is_num(1);
|
||||
$cmd7->stdout_is_eq("");
|
||||
$cmd7->stderr_is_eq("fping: specify only one of c, l\n");
|
||||
|
||||
# fping -b 65509
|
||||
my $cmd8 = Test::Command->new(cmd => "fping -b 65509 127.0.0.1");
|
||||
$cmd8->exit_is_num(1);
|
||||
$cmd8->stdout_is_eq("");
|
||||
$cmd8->stderr_is_eq("fping: data size 65509 not valid, must be between 0 and 65508\n");
|
||||
|
||||
# fping -B 0.9
|
||||
my $cmd9 = Test::Command->new(cmd => "fping -B 0.9 127.0.0.1");
|
||||
$cmd9->exit_is_num(1);
|
||||
$cmd9->stdout_is_eq("");
|
||||
$cmd9->stderr_is_eq("fping: backoff factor 0.9 not valid, must be between 1.0 and 5.0\n");
|
||||
|
||||
# fping -B 0.9
|
||||
my $cmd10 = Test::Command->new(cmd => "fping -B 5.1 127.0.0.1");
|
||||
$cmd10->exit_is_num(1);
|
||||
$cmd10->stdout_is_eq("");
|
||||
$cmd10->stderr_is_eq("fping: backoff factor 5.1 not valid, must be between 1.0 and 5.0\n");
|
||||
|
||||
# fping -C 11000
|
||||
my $cmd11 = Test::Command->new(cmd => "fping -C 11000 127.0.0.1");
|
||||
$cmd11->exit_is_num(1);
|
||||
$cmd11->stdout_is_eq("");
|
||||
$cmd11->stderr_is_eq("fping: count 11000 not valid, must be less than 10000\n");
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 20;
|
||||
use Test::More;
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
|
||||
# -a show targets that are alive
|
||||
# -A show targets by address
|
||||
# -b n amount of ping data to send, in bytes (default 56)
|
||||
# -B f set exponential backoff factor to f
|
||||
|
||||
# fping -a
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -a 127.0.0.1 127.0.0.2");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1\n127.0.0.2\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -A
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -A localhost");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -A -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -A -n localhost");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("localhost (127.0.0.1) is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping6 -A -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping6 -n -A 2001:4860:4860::8888");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com (2001:4860:4860::8888) is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -b
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -b 1000 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -B
|
||||
{
|
||||
my $t0 = [gettimeofday];
|
||||
my $cmd = Test::Command->new(cmd => "fping -t 100 -r 3 -B 2 8.8.8.7");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("8.8.8.7 is unreachable\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
my $elapsed = tv_interval($t0);
|
||||
# 0.1 + 0.2 + 0.4 + 0.8 = 1.5
|
||||
cmp_ok($elapsed, '>=', 1.5);
|
||||
cmp_ok($elapsed, '<', 1.8);
|
||||
}
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 12;
|
||||
|
||||
# -c n count of pings to send to each target (default 1)
|
||||
# -C n same as -c, report results in verbose format
|
||||
# -D print timestamp before each output line
|
||||
# -e show elapsed time on return packets
|
||||
|
||||
# fping -c n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -c 2 -p 100 localhost 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
localhost : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
|
||||
$cmd->stderr_like(qr{localhost : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -C n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -C 2 -p 100 localhost 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
localhost : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
|
||||
$cmd->stderr_like(qr{localhost : 0\.\d+ 0\.\d+
|
||||
127\.0\.0\.1 : 0\.\d+ 0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -D
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -D -c 2 -p 100 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{\[\d{10}\.\d+\] 127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
\[\d{10}\.\d+\] 127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
|
||||
$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -e
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -e 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_like(qr{127\.0\.0\.1 is alive \(0\.\d+ ms\)
|
||||
});
|
||||
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 18;
|
||||
use File::Temp;
|
||||
|
||||
# -f file read list of targets from a file ( - means stdin) (only if no -g specified)
|
||||
# -g generate target list (only if no -f specified)
|
||||
# (specify the start and end IP in the target list, or supply a IP netmask)
|
||||
# (ex. ../src/fping -g 192.168.1.0 192.168.1.255 or ../src/fping -g 192.168.1.0/24)
|
||||
# -H n Set the IP TTL value (Time To Live hops)
|
||||
|
||||
my $tmpfile = File::Temp->new();
|
||||
print $tmpfile "127.0.0.1\n127.0.0.2\n";
|
||||
close($tmpfile);
|
||||
|
||||
# fping without option (-> equivalent to 'fping -f -')
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "cat ".$tmpfile->filename." | fping");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -f -
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "cat ".$tmpfile->filename." | fping -f -");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -f file
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -f ".$tmpfile->filename);
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -g (range)
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -g 127.0.0.1 127.0.0.5");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n127.0.0.3 is alive\n127.0.0.4 is alive\n127.0.0.5 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -g (cidr)
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -g 127.0.0.1/30");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -H
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -H 1 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 7;
|
||||
|
||||
# -i n interval between sending ping packets (in millisec) (default 25)
|
||||
# -l loop sending pings forever
|
||||
# -m ping multiple interfaces on target host
|
||||
|
||||
# fping -i n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -i 100 127.0.0.1 127.0.0.2");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -l
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => '(sleep 2; pkill fping)& fping -p 900 -l 127.0.0.1');
|
||||
$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\)
|
||||
127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\)
|
||||
});
|
||||
}
|
||||
|
||||
# fping -m
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -m google-public-dns-a.google.com");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 12;
|
||||
|
||||
# -n show targets by name (-d is equivalent)
|
||||
# -O n set the type of service (tos) flag on the ICMP packets
|
||||
# -p n interval between ping packets to one target (in millisec)
|
||||
# (in looping and counting modes, default 1000)
|
||||
# -q quiet (don't show per-target/per-ping results)
|
||||
# -Q n same as -q, but show summary every n seconds
|
||||
|
||||
# fping -n
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -n 8.8.8.8");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -O
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -O 2 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -q
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -q -p 100 -c 3 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
# fping -Q
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -Q 1 -p 400 -c 4 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("");
|
||||
$cmd->stderr_like(qr{\[\d+:\d+:\d+\]
|
||||
127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
127\.0\.0\.1 : xmt/rcv/%loss = 4/4/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use Test::Command tests => 12;
|
||||
|
||||
# -r n number of retries (default 3)
|
||||
# -s print final stats
|
||||
# -S addr set source address
|
||||
# -t n individual target initial timeout (in millisec) (default 500)
|
||||
# -T n ignored (for compatibility with fping 2.4)
|
||||
|
||||
# fping -r tested in test-4-options-a-b.pl
|
||||
|
||||
# fping -s
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -s 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_like(qr{\s*
|
||||
\s*1 targets
|
||||
\s*1 alive
|
||||
\s*0 unreachable
|
||||
\s*0 unknown addresses
|
||||
\s*
|
||||
\s*0 timeouts \(waiting for response\)
|
||||
\s*1 ICMP Echos sent
|
||||
\s*1 ICMP Echo Replies received
|
||||
\s*0 other ICMP received
|
||||
|
||||
\s*0.\d+ ms \(min round trip time\)
|
||||
\s*0.\d+ ms \(avg round trip time\)
|
||||
\s*0.\d+ ms \(max round trip time\)
|
||||
\s*0.\d+ sec \(elapsed real time\)
|
||||
});
|
||||
}
|
||||
|
||||
# fping -s (no host reachable)
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -r0 -t100 -s 8.8.0.0");
|
||||
$cmd->exit_is_num(1);
|
||||
$cmd->stdout_is_eq("8.8.0.0 is unreachable\n");
|
||||
$cmd->stderr_like(qr{\s*
|
||||
\s*1 targets
|
||||
\s*0 alive
|
||||
\s*1 unreachable
|
||||
\s*0 unknown addresses
|
||||
\s*
|
||||
\s*1 timeouts \(waiting for response\)
|
||||
\s*1 ICMP Echos sent
|
||||
\s*0 ICMP Echo Replies received
|
||||
\s*0 other ICMP received
|
||||
|
||||
\s*0.\d+ ms \(min round trip time\)
|
||||
\s*0.\d+ ms \(avg round trip time\)
|
||||
\s*0.\d+ ms \(max round trip time\)
|
||||
\s*0.\d+ sec \(elapsed real time\)
|
||||
});
|
||||
}
|
||||
|
||||
# fping -S
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping -S 127.0.0.1 127.0.0.1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping6 -S
|
||||
{
|
||||
my $cmd = Test::Command->new(cmd => "fping6 -S ::1 ::1");
|
||||
$cmd->exit_is_num(0);
|
||||
$cmd->stdout_is_eq("::1 is alive\n");
|
||||
$cmd->stderr_is_eq("");
|
||||
}
|
||||
|
||||
# fping -t tested in test-4-options-a-b.pl
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# regression testing for github issue #56
|
||||
|
||||
use Test::Command tests => 3;
|
||||
|
||||
my $cmd1 = Test::Command->new(cmd => "fping -t100 -p100 -C3 255.255.255.255");
|
||||
$cmd1->exit_is_num(1);
|
||||
$cmd1->stdout_is_eq("");
|
||||
$cmd1->stderr_is_eq("\n255.255.255.255 : - - -\n");
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# regression testing for github issue #58
|
||||
|
||||
use Test::Command tests => 3;
|
||||
|
||||
my $cmd1 = Test::Command->new(cmd => "fping -a -g 2001:db8:120:4161::4/64");
|
||||
$cmd1->exit_is_num(1);
|
||||
$cmd1->stdout_is_eq("");
|
||||
$cmd1->stderr_is_eq("Error: -g works only with IPv4 addresses\n");
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# make sure that the .tar.gz file contains everything necessary
|
||||
# to build fping
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
make dist
|
||||
VERSION=$(ls fping-*.tar.gz | sed -e 's/^fping-//' | sed -e 's/\.tar\.gz$//')
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "tar.gz file not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# unarchive
|
||||
TMPDIR=$(mktemp -d --tmpdir=ci)
|
||||
cd $TMPDIR
|
||||
tar xf ../../fping-$VERSION.tar.gz
|
||||
DIRNAME=$(ls)
|
||||
|
||||
# build
|
||||
cd $DIRNAME
|
||||
./configure --enable-ipv4 --enable-ipv6 --prefix=/opt/fping
|
||||
make
|
||||
sudo make install
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
||||
/* VERSION (from configure.in) */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
|
||||
/* some OSes do not define this ... lets take a wild guess */
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
# define INADDR_NONE 0xffffffffU
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
@@ -1,32 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(fping.c)
|
||||
AM_INIT_AUTOMAKE(fping, 2.4b2_to_ipv6)
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
#VERSION=2.4b2
|
||||
#PACKAGE=fping
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_SUBST(VERSION)
|
||||
AC_DEFINE_UNQUOTED(VERSION,"$VERSION")
|
||||
|
||||
dnl Checks for programs.
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_INSTALL
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
AC_CHECK_FUNC(gethostbyname)
|
||||
if test $ac_cv_func_gethostbyname = no; then
|
||||
AC_CHECK_LIB(nsl, gethostbyname)
|
||||
fi
|
||||
AC_CHECK_FUNC(connect)
|
||||
if test $ac_cv_func_connect = no; then
|
||||
AC_CHECK_LIB(socket, connect)
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_CHECK_HEADERS(unistd.h sys/file.h stdlib.h sys/select.h)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
@@ -0,0 +1,73 @@
|
||||
Summary: send ICMP echo probes to multiple hosts
|
||||
Name: fping
|
||||
Version: 3.4
|
||||
Release: 1
|
||||
License: MIT
|
||||
Group: Applications/System
|
||||
Source0: http://fping.org/dist/%{name}-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
|
||||
%description
|
||||
fping is a program to send ICMP echo probes to network hosts, similar to ping,
|
||||
but much better performing when pinging multiple hosts. fping has a very long
|
||||
history: Roland Schemers did publish a first version of it in 1992 and it has
|
||||
established itself since then as a standard tool for network diagnostics and
|
||||
statistics.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
|
||||
if [ ! -f ./configure ] ; then
|
||||
./autogen.sh
|
||||
fi
|
||||
|
||||
# fping
|
||||
%configure --enable-ipv4
|
||||
make
|
||||
|
||||
# fping6
|
||||
%configure --enable-ipv6
|
||||
make
|
||||
%{__mv} -f src/fping src/fping6
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
# fping6
|
||||
%{__install} -Dp -m4755 src/fping6 %{buildroot}%{_sbindir}/fping6
|
||||
%{__ln_s} -f fping.8 %{buildroot}%{_mandir}/man8/fping6.8
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%attr(4755, root, root) /usr/sbin/fping
|
||||
%attr(4755, root, root) /usr/sbin/fping6
|
||||
%doc README COPYING ChangeLog
|
||||
/usr/share/man/man8/fping.8.gz
|
||||
/usr/share/man/man8/fping6.8.gz
|
||||
|
||||
%post
|
||||
if [ -x /usr/sbin/setcap ]; then
|
||||
/bin/chmod 0755 /usr/sbin/fping*
|
||||
/usr/sbin/setcap cap_net_raw+ep /usr/sbin/fping*
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Mon Dec 24 2012 Marcus Vinicius Ferreira <ferreira.mv@gmail.com>
|
||||
- Missing './configure' script when cloning from master.
|
||||
- Making 'fping6'.
|
||||
- Fix setuid permission to 'rwsr-xr-x'.
|
||||
- doc files.
|
||||
- Replacing setuid permission if 'setcap' is present on post-install.
|
||||
- Using 'http://fping.org/dist/' for release source distributions.
|
||||
|
||||
* Mon Jul 16 2012 Stephen Schaefer <sschaefer@acm.org>
|
||||
- Initial build
|
||||
|
||||
# vim:ft=spec:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
man_MANS =
|
||||
|
||||
if IPV4
|
||||
man_MANS += fping.8
|
||||
endif
|
||||
|
||||
if IPV6
|
||||
man_MANS += fping6.8
|
||||
endif
|
||||
|
||||
EXTRA_DIST = fping.8 fping6.8 fping.pod README.1992
|
||||
|
||||
fping.8: fping.pod
|
||||
pod2man -c "" -s 8 -r "fping" $< >$@
|
||||
|
||||
fping6.8: fping.pod
|
||||
pod2man -c "" -s 8 -r "fping" -n fping6 $< >$@
|
||||
Executable → Regular
+2
-23
@@ -1,26 +1,4 @@
|
||||
fping README
|
||||
------------
|
||||
|
||||
Current maintainer:
|
||||
|
||||
David Papp - david@remote.net
|
||||
|
||||
|
||||
fping website: http://www.fping.com
|
||||
|
||||
|
||||
Original author: Roland Schemers (schemers@stanford.edu)
|
||||
Previous maintainer: RL "Bob" Morgan (morgan@stanford.edu)
|
||||
IPv6 Support: Jeroen Massar (jeroen@unfix.org / jeroen@ipng.nl)
|
||||
|
||||
|
||||
Suggestions and patches:
|
||||
|
||||
....
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Original README from 1992! 5 years ago? Time flies...
|
||||
Original README (from 1992)
|
||||
|
||||
fping - A tool to quickly ping N number of hosts to determine
|
||||
their reachability.
|
||||
@@ -62,3 +40,4 @@ Problem and Issues
|
||||
|
||||
Unlike ping, fping is meant to be used in scripts and its
|
||||
output is easy to parse.
|
||||
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
FPING(8) FPING(8)
|
||||
|
||||
[1mNAME[0m
|
||||
fping - send ICMP ECHO_REQUEST packets to network hosts
|
||||
|
||||
[1mSYNOPSIS[0m
|
||||
[1mfping [22m[ [4moptions[24m ] [ [4msystems...[24m ] [1mfping6 [22m[ [4moptions[24m ] [ [4msystems...[24m ]
|
||||
|
||||
[1mDESCRIPTION[0m
|
||||
[1mfping [22mis a program like [1mping [22mwhich uses the Internet Control Message
|
||||
Protocol (ICMP) echo request to determine if a target host is
|
||||
responding. [1mfping [22mdiffers from [1mping [22min that you can specify any number
|
||||
of targets on the command line, or specify a file containing the lists
|
||||
of targets to ping. Instead of sending to one target until it times
|
||||
out or replies, [1mfping [22mwill send out a ping packet and move on to the
|
||||
next target in a round-robin fashion. In the default mode, if a target
|
||||
replies, it is noted and removed from the list of targets to check; if
|
||||
a target does not respond within a certain time limit and/or retry
|
||||
limit it is designated as unreachable. [1mfping [22malso supports sending a
|
||||
specified number of pings to a target, or looping indefinitely (as in
|
||||
[1mping [22m). Unlike [1mping[22m, [1mfping [22mis meant to be used in scripts, so its
|
||||
output is designed to be easy to parse.
|
||||
|
||||
The binary named [1mfping6 [22mis the same as [1mfping[22m, except that it uses IPv6
|
||||
addresses instead of IPv4.
|
||||
|
||||
[1mOPTIONS[0m
|
||||
[1m-a [22mShow systems that are alive.
|
||||
|
||||
[1m-A [22mDisplay targets by address rather than DNS name. Combined with -d,
|
||||
the output will be both the ip and (if available) the hostname.
|
||||
|
||||
[1m-b [4m[22mn[24m Number of bytes of ping data to send. The minimum size (normally
|
||||
12) allows room for the data that [1mfping [22mneeds to do its work
|
||||
(sequence number, timestamp). The reported received data size
|
||||
includes the IP header (normally 20 bytes) and ICMP header (8
|
||||
bytes), so the minimum total size is 40 bytes. Default is 56, as
|
||||
in [1mping[22m. Maximum is the theoretical maximum IP datagram size
|
||||
(64K), though most systems limit this to a smaller, system-
|
||||
dependent number.
|
||||
|
||||
[1m-B [4m[22mn[24m Backoff factor. In the default mode, [1mfping [22msends several requests
|
||||
to a target before giving up, waiting longer for a reply on each
|
||||
successive request. This parameter is the value by which the wait
|
||||
time ([1m-t[22m) is multiplied on each successive request; it must be
|
||||
entered as a floating-point number (x.y). The default is 1.5.
|
||||
|
||||
[1m-c [4m[22mn[24m Number of request packets to send to each target. In this mode, a
|
||||
line is displayed for each received response (this can suppressed
|
||||
with [1m-q [22mor [1m-Q[22m). Also, statistics about responses for each target
|
||||
are displayed when all requests have been sent (or when
|
||||
interrupted).
|
||||
|
||||
[1m-C [4m[22mn[24m Similar to [1m-c[22m, but the per-target statistics are displayed in a
|
||||
format designed for automated response-time statistics gathering.
|
||||
For example:
|
||||
|
||||
% fping -C 5 -q somehost
|
||||
somehost : 91.7 37.0 29.2 - 36.8
|
||||
|
||||
shows the response time in milliseconds for each of the five
|
||||
requests, with the "-" indicating that no response was received to
|
||||
the fourth request.
|
||||
|
||||
[1m-d [22mUse DNS to lookup address of return ping packet. This allows you
|
||||
to give fping a list of IP addresses as input and print hostnames
|
||||
in the output.
|
||||
|
||||
[1m-D [22mAdd Unix timestamps in front of output lines generated with in
|
||||
looping or counting modes ([1m-l[22m, [1m-c[22m, or [1m-C[22m).
|
||||
|
||||
[1m-e [22mShow elapsed (round-trip) time of packets.
|
||||
|
||||
[1m-f [22mRead list of targets from a file. This option can only be used by
|
||||
the root user. Regular users should pipe in the file via stdin:
|
||||
|
||||
% fping < targets_file
|
||||
|
||||
[1m-g [4m[22maddr/mask[0m
|
||||
Generate a target list from a supplied IP netmask, or a starting
|
||||
and ending IP. Specify the netmask or start/end in the targets
|
||||
portion of the command line. If a network with netmask is given,
|
||||
the network and broadcast addresses will be excluded. ex. To ping
|
||||
the network 192.168.1.0/24, the specified command line could look
|
||||
like either:
|
||||
|
||||
fping -g 192.168.1.0/24
|
||||
|
||||
or
|
||||
|
||||
fping -g 192.168.1.1 192.168.1.254
|
||||
|
||||
[1m-h [22mPrint usage message.
|
||||
|
||||
[1m-i [4m[22mn[24m The minimum amount of time (in milliseconds) between sending a
|
||||
ping packet to any target (default is 25).
|
||||
|
||||
[1m-l [22mLoop sending packets to each target indefinitely. Can be
|
||||
interrupted with Ctrl-C; statistics about responses for each
|
||||
target are then displayed.
|
||||
|
||||
[1m-m [22mSend pings to each of a target host's multiple interfaces.
|
||||
|
||||
[1m-n [22mSame as -d.
|
||||
|
||||
[1m-p [22m<n>
|
||||
In looping or counting modes ([1m-l[22m, [1m-c[22m, or [1m-C[22m), this parameter sets
|
||||
the time in milliseconds that [1mfping [22mwaits between successive
|
||||
packets to an individual target. Default is 1000.
|
||||
|
||||
[1m-q [22mQuiet. Don't show per-probe results, but only the final summary.
|
||||
Also don't show ICMP error messages.
|
||||
|
||||
[1m-Q [4m[22mn[24m Like [1m-q[22m, but show summary results every n seconds.
|
||||
|
||||
[1m-r [4m[22mn[24m Retry limit (default 3). This is the number of times an attempt at
|
||||
pinging a target will be made, not including the first try.
|
||||
|
||||
[1m-R [22mInstead of using all-zeros as the packet data, generate random
|
||||
bytes. Use to defeat, e.g., link data compression.
|
||||
|
||||
[1m-s [22mPrint cumulative statistics upon exit.
|
||||
|
||||
[1m-S [4m[22maddr[0m
|
||||
Set source address.
|
||||
|
||||
[1m-I [4m[22mif[0m
|
||||
Set the interface (requires SO_BINDTODEVICE support)
|
||||
|
||||
[1m-t [4m[22mn[24m Initial target timeout in milliseconds (default 500). In the
|
||||
default mode, this is the amount of time that [1mfping [22mwaits for a
|
||||
response to its first request. Successive timeouts are multiplied
|
||||
by the backoff factor specified with [1m-B[22m. Note that this option
|
||||
has no effect looping or counting modes ([1m-l[22m, [1m-c[22m, or [1m-C[22m).
|
||||
|
||||
[1m-T [4m[22mn[24m Ignored (for compatibility with fping 2.4).
|
||||
|
||||
[1m-u [22mShow targets that are unreachable.
|
||||
|
||||
[1m-O [4m[22mn[24m Set the typ of service flag (TOS). [4mn[24m can be either decimal or
|
||||
hexadecimal (0xh) format.
|
||||
|
||||
[1m-v [22mPrint [1mfping [22mversion information.
|
||||
|
||||
[1m-H [4m[22mn[24m Set the IP TTL field (time to live hops).
|
||||
|
||||
[1mEXAMPLES[0m
|
||||
Generate ~1000 pings per second to a host until canceled, printing
|
||||
statistics on the fly at one second intervals, and printing statistics
|
||||
at the end:
|
||||
|
||||
# fping -s -l -i 1 -p 1 -T 1 -Q 1 127.0.0.1
|
||||
|
||||
Note that ping intervals less than 10ms can only be used as root.
|
||||
|
||||
[1mAUTHORS[0m
|
||||
· Roland J. Schemers III, Stanford University, concept and versions
|
||||
1.x
|
||||
|
||||
· RL "Bob" Morgan, Stanford University, versions 2.x
|
||||
|
||||
· David Papp, versions 2.3x and up
|
||||
|
||||
· David Schweikert, versions 3.0 and up
|
||||
|
||||
[1mfping website: <http://www.fping.org>[0m
|
||||
|
||||
[1mDIAGNOSTICS[0m
|
||||
Exit status is 0 if all the hosts are reachable, 1 if some hosts were
|
||||
unreachable, 2 if any IP addresses were not found, 3 for invalid
|
||||
command line arguments, and 4 for a system call failure.
|
||||
|
||||
[1mRESTRICTIONS[0m
|
||||
If certain options are used (i.e, a low value for [1m-i [22mand [1m-t[22m, and a high
|
||||
value for [1m-r[22m) it is possible to flood the network. This program must be
|
||||
installed as setuid root in order to open up a raw socket, or must be
|
||||
run by root. In order to stop mere mortals from hosing the network,
|
||||
normal users can't specify the following:
|
||||
|
||||
· [1m-i [4m[22mn[24m, where [4mn[24m < 10 msec
|
||||
|
||||
· [1m-r [4m[22mn[24m, where [4mn[24m > 20
|
||||
|
||||
· [1m-t [4m[22mn[24m, where n < 250 msec
|
||||
|
||||
[1mSEE ALSO[0m
|
||||
ping(8)
|
||||
|
||||
fping 2016-02-19 FPING(8)
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
=head1 NAME
|
||||
|
||||
fping - send ICMP ECHO_REQUEST packets to network hosts
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<fping> [ I<options> ] [ I<systems...> ]
|
||||
B<fping6> [ I<options> ] [ I<systems...> ]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<fping> is a program like B<ping> which uses the Internet Control Message
|
||||
Protocol (ICMP) echo request to determine if a target host is responding.
|
||||
B<fping> differs from B<ping> in that you can specify any number of targets on the
|
||||
command line, or specify a file containing the lists of targets to ping.
|
||||
Instead of sending to one target until it times out or replies, B<fping> will
|
||||
send out a ping packet and move on to the next target in a round-robin fashion.
|
||||
In the default mode, if a target replies, it is noted and removed from the list
|
||||
of targets to check; if a target does not respond within a certain time limit
|
||||
and/or retry limit it is designated as unreachable. B<fping> also supports
|
||||
sending a specified number of pings to a target, or looping indefinitely (as in
|
||||
B<ping> ). Unlike B<ping>, B<fping> is meant to be used in scripts, so its
|
||||
output is designed to be easy to parse.
|
||||
|
||||
The binary named B<fping6> is the same as B<fping>, except that it uses IPv6
|
||||
addresses instead of IPv4.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 5
|
||||
|
||||
=item B<-a>
|
||||
|
||||
Show systems that are alive.
|
||||
|
||||
=item B<-A>
|
||||
|
||||
Display targets by address rather than DNS name. Combined with -d, the output
|
||||
will be both the ip and (if available) the hostname.
|
||||
|
||||
=item B<-b> I<n>
|
||||
|
||||
Number of bytes of ping data to send. The minimum size (normally 12) allows
|
||||
room for the data that B<fping> needs to do its work (sequence number,
|
||||
timestamp). The reported received data size includes the IP header (normally
|
||||
20 bytes) and ICMP header (8 bytes), so the minimum total size is 40 bytes.
|
||||
Default is 56, as in B<ping>. Maximum is the theoretical maximum IP datagram
|
||||
size (64K), though most systems limit this to a smaller, system-dependent
|
||||
number.
|
||||
|
||||
=item B<-B> I<n>
|
||||
|
||||
Backoff factor. In the default mode, B<fping> sends several requests to a
|
||||
target before giving up, waiting longer for a reply on each successive request.
|
||||
This parameter is the value by which the wait time (B<-t>) is multiplied on each
|
||||
successive request; it must be entered as a floating-point number (x.y). The
|
||||
default is 1.5.
|
||||
|
||||
=item B<-c> I<n>
|
||||
|
||||
Number of request packets to send to each target. In this mode, a line is
|
||||
displayed for each received response (this can suppressed with B<-q> or B<-Q>).
|
||||
Also, statistics about responses for each target are displayed when all
|
||||
requests have been sent (or when interrupted).
|
||||
|
||||
=item B<-C> I<n>
|
||||
|
||||
Similar to B<-c>, but the per-target statistics are displayed in a format
|
||||
designed for automated response-time statistics gathering. For example:
|
||||
|
||||
% fping -C 5 -q somehost
|
||||
somehost : 91.7 37.0 29.2 - 36.8
|
||||
|
||||
shows the response time in milliseconds for each of the five requests, with the
|
||||
C<-> indicating that no response was received to the fourth request.
|
||||
|
||||
=item B<-d>
|
||||
|
||||
Use DNS to lookup address of return ping packet. This allows you to give fping
|
||||
a list of IP addresses as input and print hostnames in the output.
|
||||
|
||||
=item B<-D>
|
||||
|
||||
Add Unix timestamps in front of output lines generated with in looping or counting
|
||||
modes (B<-l>, B<-c>, or B<-C>).
|
||||
|
||||
=item B<-e>
|
||||
|
||||
Show elapsed (round-trip) time of packets.
|
||||
|
||||
=item B<-f>
|
||||
|
||||
Read list of targets from a file. This option can only be used by the root
|
||||
user. Regular users should pipe in the file via stdin:
|
||||
|
||||
% fping < targets_file
|
||||
|
||||
=item B<-g> I<addr/mask>
|
||||
|
||||
Generate a target list from a supplied IP netmask, or a starting and ending IP.
|
||||
Specify the netmask or start/end in the targets portion of the command line. If
|
||||
a network with netmask is given, the network and broadcast addresses will be
|
||||
excluded. ex. To ping the network 192.168.1.0/24, the specified command line
|
||||
could look like either:
|
||||
|
||||
fping -g 192.168.1.0/24
|
||||
|
||||
or
|
||||
|
||||
fping -g 192.168.1.1 192.168.1.254
|
||||
|
||||
=item B<-h>
|
||||
|
||||
Print usage message.
|
||||
|
||||
=item B<-i> I<n>
|
||||
|
||||
The minimum amount of time (in milliseconds) between sending a ping packet
|
||||
to any target (default is 25).
|
||||
|
||||
=item B<-l>
|
||||
|
||||
Loop sending packets to each target indefinitely. Can be interrupted with
|
||||
Ctrl-C; statistics about responses for each target are then displayed.
|
||||
|
||||
=item B<-m>
|
||||
|
||||
Send pings to each of a target host's multiple interfaces.
|
||||
|
||||
=item B<-n>
|
||||
|
||||
Same as -d.
|
||||
|
||||
=item B<-p> <n>
|
||||
|
||||
In looping or counting modes (B<-l>, B<-c>, or B<-C>), this parameter sets
|
||||
the time in milliseconds that B<fping> waits between successive packets to
|
||||
an individual target. Default is 1000.
|
||||
|
||||
=item B<-q>
|
||||
|
||||
Quiet. Don't show per-probe results, but only the final summary. Also don't
|
||||
show ICMP error messages.
|
||||
|
||||
=item B<-Q> I<n>
|
||||
|
||||
Like B<-q>, but show summary results every n seconds.
|
||||
|
||||
=item B<-r> I<n>
|
||||
|
||||
Retry limit (default 3). This is the number of times an attempt at pinging
|
||||
a target will be made, not including the first try.
|
||||
|
||||
=item B<-R>
|
||||
|
||||
Instead of using all-zeros as the packet data, generate random bytes.
|
||||
Use to defeat, e.g., link data compression.
|
||||
|
||||
=item B<-s>
|
||||
|
||||
Print cumulative statistics upon exit.
|
||||
|
||||
=item B<-S> I<addr>
|
||||
|
||||
Set source address.
|
||||
|
||||
=item B<-I> I<if>
|
||||
|
||||
Set the interface (requires SO_BINDTODEVICE support)
|
||||
|
||||
=item B<-t> I<n>
|
||||
|
||||
Initial target timeout in milliseconds (default 500). In the default mode, this
|
||||
is the amount of time that B<fping> waits for a response to its first request.
|
||||
Successive timeouts are multiplied by the backoff factor specified with B<-B>.
|
||||
Note that this option has no effect looping or counting modes (B<-l>, B<-c>, or
|
||||
B<-C>).
|
||||
|
||||
=item B<-T> I<n>
|
||||
|
||||
Ignored (for compatibility with fping 2.4).
|
||||
|
||||
=item B<-u>
|
||||
|
||||
Show targets that are unreachable.
|
||||
|
||||
=item B<-O> I<n>
|
||||
|
||||
Set the typ of service flag (TOS). I<n> can be either decimal or hexadecimal
|
||||
(0xh) format.
|
||||
|
||||
=item B<-v>
|
||||
|
||||
Print B<fping> version information.
|
||||
|
||||
=item B<-H> I<n>
|
||||
|
||||
Set the IP TTL field (time to live hops).
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Generate ~1000 pings per second to a host until canceled, printing statistics
|
||||
on the fly at one second intervals, and printing statistics at the end:
|
||||
|
||||
# fping -s -l -i 1 -p 1 -T 1 -Q 1 127.0.0.1
|
||||
|
||||
Note that ping intervals less than 10ms can only be used as root.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
Roland J. Schemers III, Stanford University, concept and versions 1.x
|
||||
|
||||
=item *
|
||||
|
||||
RL "Bob" Morgan, Stanford University, versions 2.x
|
||||
|
||||
=item *
|
||||
|
||||
David Papp, versions 2.3x and up
|
||||
|
||||
=item *
|
||||
|
||||
David Schweikert, versions 3.0 and up
|
||||
|
||||
=back
|
||||
|
||||
B<fping website: L<http://www.fping.org>>
|
||||
|
||||
=head1 DIAGNOSTICS
|
||||
|
||||
Exit status is 0 if all the hosts are reachable, 1 if some hosts
|
||||
were unreachable, 2 if any IP addresses were not found, 3 for invalid command
|
||||
line arguments, and 4 for a system call failure.
|
||||
|
||||
=head1 RESTRICTIONS
|
||||
|
||||
If certain options are used (i.e, a low value for B<-i> and B<-t>, and a high value
|
||||
for B<-r>) it is possible to flood the network. This program must be installed as
|
||||
setuid root in order to open up a raw socket, or must be run by root. In order
|
||||
to stop mere mortals from hosing the network, normal users can't specify the following:
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
B<-i> I<n>, where I<n> < 10 msec
|
||||
|
||||
=item *
|
||||
|
||||
B<-r> I<n>, where I<n> > 20
|
||||
|
||||
=item *
|
||||
|
||||
B<-t> I<n>, where n < 250 msec
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
C<ping(8)>
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
FPING(8) FPING(8)
|
||||
|
||||
NAME
|
||||
fping - send ICMP ECHO_REQUEST packets to network hosts
|
||||
|
||||
SYNOPSIS
|
||||
fping [ options ] [ systems... ] fping6 [ options ] [ systems... ]
|
||||
|
||||
DESCRIPTION
|
||||
fping is a program like ping which uses the Internet Control Message
|
||||
Protocol (ICMP) echo request to determine if a target host is
|
||||
responding. fping differs from ping in that you can specify any number
|
||||
of targets on the command line, or specify a file containing the lists
|
||||
of targets to ping. Instead of sending to one target until it times
|
||||
out or replies, fping will send out a ping packet and move on to the
|
||||
next target in a round-robin fashion. In the default mode, if a target
|
||||
replies, it is noted and removed from the list of targets to check; if
|
||||
a target does not respond within a certain time limit and/or retry
|
||||
limit it is designated as unreachable. fping also supports sending a
|
||||
specified number of pings to a target, or looping indefinitely (as in
|
||||
ping ). Unlike ping, fping is meant to be used in scripts, so its
|
||||
output is designed to be easy to parse.
|
||||
|
||||
The binary named fping6 is the same as fping, except that it uses IPv6
|
||||
addresses instead of IPv4.
|
||||
|
||||
OPTIONS
|
||||
-a Show systems that are alive.
|
||||
|
||||
-A Display targets by address rather than DNS name. Combined with -d,
|
||||
the output will be both the ip and (if available) the hostname.
|
||||
|
||||
-b n Number of bytes of ping data to send. The minimum size (normally
|
||||
12) allows room for the data that fping needs to do its work
|
||||
(sequence number, timestamp). The reported received data size
|
||||
includes the IP header (normally 20 bytes) and ICMP header (8
|
||||
bytes), so the minimum total size is 40 bytes. Default is 56, as
|
||||
in ping. Maximum is the theoretical maximum IP datagram size
|
||||
(64K), though most systems limit this to a smaller, system-
|
||||
dependent number.
|
||||
|
||||
-B n Backoff factor. In the default mode, fping sends several requests
|
||||
to a target before giving up, waiting longer for a reply on each
|
||||
successive request. This parameter is the value by which the wait
|
||||
time (-t) is multiplied on each successive request; it must be
|
||||
entered as a floating-point number (x.y). The default is 1.5.
|
||||
|
||||
-c n Number of request packets to send to each target. In this mode, a
|
||||
line is displayed for each received response (this can suppressed
|
||||
with -q or -Q). Also, statistics about responses for each target
|
||||
are displayed when all requests have been sent (or when
|
||||
interrupted).
|
||||
|
||||
-C n Similar to -c, but the per-target statistics are displayed in a
|
||||
format designed for automated response-time statistics gathering.
|
||||
For example:
|
||||
|
||||
% fping -C 5 -q somehost
|
||||
somehost : 91.7 37.0 29.2 - 36.8
|
||||
|
||||
shows the response time in milliseconds for each of the five
|
||||
requests, with the "-" indicating that no response was received to
|
||||
the fourth request.
|
||||
|
||||
-d Use DNS to lookup address of return ping packet. This allows you
|
||||
to give fping a list of IP addresses as input and print hostnames
|
||||
in the output.
|
||||
|
||||
-D Add Unix timestamps in front of output lines generated with in
|
||||
looping or counting modes (-l, -c, or -C).
|
||||
|
||||
-e Show elapsed (round-trip) time of packets.
|
||||
|
||||
-f Read list of targets from a file. This option can only be used by
|
||||
the root user. Regular users should pipe in the file via stdin:
|
||||
|
||||
% fping < targets_file
|
||||
|
||||
-g addr/mask
|
||||
Generate a target list from a supplied IP netmask, or a starting
|
||||
and ending IP. Specify the netmask or start/end in the targets
|
||||
portion of the command line. If a network with netmask is given,
|
||||
the network and broadcast addresses will be excluded. ex. To ping
|
||||
the network 192.168.1.0/24, the specified command line could look
|
||||
like either:
|
||||
|
||||
fping -g 192.168.1.0/24
|
||||
|
||||
or
|
||||
|
||||
fping -g 192.168.1.1 192.168.1.254
|
||||
|
||||
-h Print usage message.
|
||||
|
||||
-i n The minimum amount of time (in milliseconds) between sending a
|
||||
ping packet to any target (default is 25).
|
||||
|
||||
-l Loop sending packets to each target indefinitely. Can be
|
||||
interrupted with Ctrl-C; statistics about responses for each
|
||||
target are then displayed.
|
||||
|
||||
-m Send pings to each of a target host's multiple interfaces.
|
||||
|
||||
-n Same as -d.
|
||||
|
||||
-p <n>
|
||||
In looping or counting modes (-l, -c, or -C), this parameter sets
|
||||
the time in milliseconds that fping waits between successive
|
||||
packets to an individual target. Default is 1000.
|
||||
|
||||
-q Quiet. Don't show per-probe results, but only the final summary.
|
||||
Also don't show ICMP error messages.
|
||||
|
||||
-Q n Like -q, but show summary results every n seconds.
|
||||
|
||||
-r n Retry limit (default 3). This is the number of times an attempt at
|
||||
pinging a target will be made, not including the first try.
|
||||
|
||||
-R Instead of using all-zeros as the packet data, generate random
|
||||
bytes. Use to defeat, e.g., link data compression.
|
||||
|
||||
-s Print cumulative statistics upon exit.
|
||||
|
||||
-S addr
|
||||
Set source address.
|
||||
|
||||
-I if
|
||||
Set the interface (requires SO_BINDTODEVICE support)
|
||||
|
||||
-t n Initial target timeout in milliseconds (default 500). In the
|
||||
default mode, this is the amount of time that fping waits for a
|
||||
response to its first request. Successive timeouts are multiplied
|
||||
by the backoff factor specified with -B. Note that this option
|
||||
has no effect looping or counting modes (-l, -c, or -C).
|
||||
|
||||
-T n Ignored (for compatibility with fping 2.4).
|
||||
|
||||
-u Show targets that are unreachable.
|
||||
|
||||
-O n Set the typ of service flag (TOS). n can be either decimal or
|
||||
hexadecimal (0xh) format.
|
||||
|
||||
-v Print fping version information.
|
||||
|
||||
-H n Set the IP TTL field (time to live hops).
|
||||
|
||||
EXAMPLES
|
||||
Generate ~1000 pings per second to a host until canceled, printing
|
||||
statistics on the fly at one second intervals, and printing statistics
|
||||
at the end:
|
||||
|
||||
# fping -s -l -i 1 -p 1 -T 1 -Q 1 127.0.0.1
|
||||
|
||||
Note that ping intervals less than 10ms can only be used as root.
|
||||
|
||||
AUTHORS
|
||||
· Roland J. Schemers III, Stanford University, concept and versions
|
||||
1.x
|
||||
|
||||
· RL "Bob" Morgan, Stanford University, versions 2.x
|
||||
|
||||
· David Papp, versions 2.3x and up
|
||||
|
||||
· David Schweikert, versions 3.0 and up
|
||||
|
||||
fping website: <http://www.fping.org>
|
||||
|
||||
DIAGNOSTICS
|
||||
Exit status is 0 if all the hosts are reachable, 1 if some hosts were
|
||||
unreachable, 2 if any IP addresses were not found, 3 for invalid
|
||||
command line arguments, and 4 for a system call failure.
|
||||
|
||||
RESTRICTIONS
|
||||
If certain options are used (i.e, a low value for -i and -t, and a high
|
||||
value for -r) it is possible to flood the network. This program must be
|
||||
installed as setuid root in order to open up a raw socket, or must be
|
||||
run by root. In order to stop mere mortals from hosing the network,
|
||||
normal users can't specify the following:
|
||||
|
||||
· -i n, where n < 10 msec
|
||||
|
||||
· -r n, where n > 20
|
||||
|
||||
· -t n, where n < 250 msec
|
||||
|
||||
SEE ALSO
|
||||
ping(8)
|
||||
|
||||
fping 2016-02-19 FPING(8)
|
||||
@@ -1,220 +0,0 @@
|
||||
.TH fping l
|
||||
.SH NAME
|
||||
fping \- send ICMP ECHO_REQUEST packets to network hosts
|
||||
.SH SYNOPSIS
|
||||
.B fping
|
||||
[ \fIoptions\fR ]
|
||||
[ \fIsystems...\fR ]
|
||||
|
||||
.SH DESCRIPTION
|
||||
.NXR "fping command"
|
||||
.NXR "ICMP ECHO_REQUEST"
|
||||
|
||||
|
||||
.B fping
|
||||
is a
|
||||
.MS ping 8
|
||||
like program which uses the Internet Control
|
||||
Message Protocol (ICMP) echo request to determine if a target host is
|
||||
responding.
|
||||
.B fping
|
||||
differs from ping in that you can specify any
|
||||
number of targets on the command line, or specify a file containing
|
||||
the lists of targets to ping. Instead of sending to one target until it
|
||||
times out or replies,
|
||||
.B fping
|
||||
will send out a ping packet and move
|
||||
on to the next target in a round-robin fashion.
|
||||
.PP
|
||||
In the default mode, if a target replies,
|
||||
it is noted and removed from the list of targets to check; if a target
|
||||
does not respond within a certain time limit and/or retry limit it
|
||||
is designated as unreachable.
|
||||
.B fping
|
||||
also supports sending a specified number of pings to a target, or
|
||||
looping indefinitely (as in
|
||||
.B ping
|
||||
).
|
||||
.PP
|
||||
Unlike
|
||||
.B ping
|
||||
,
|
||||
.B fping
|
||||
is meant to be used in scripts, so its output is designed to be
|
||||
easy to parse.
|
||||
.SH OPTIONS
|
||||
.IP \fB-a\fR 5
|
||||
Show systems that are alive.
|
||||
.IP \fB-A\fR 5
|
||||
Display targets by address rather than DNS name.
|
||||
.IP \fB-b\fIn\fR 5
|
||||
Number of bytes of ping data to send. The minimum size (normally 12)
|
||||
allows room for the data that
|
||||
.B fping
|
||||
needs to do its work (sequence number, timestamp). The reported
|
||||
received data size includes the IP header (normally 20 bytes) and ICMP
|
||||
header (8 bytes), so the minimum total size is 40 bytes. Default is
|
||||
56, as in
|
||||
.B ping.
|
||||
Maximum is the theoretical maximum IP datagram size (64K), though most
|
||||
systems limit this to a smaller, system-dependent number.
|
||||
.IP \fB-B\fIn\fR 5
|
||||
In the default mode,
|
||||
.B fping
|
||||
sends several requests to a target before giving up, waiting longer for
|
||||
a reply on each successive request. This parameter is the value by
|
||||
which the wait time is multiplied on each successive request; it must
|
||||
be entered as a floating-point number (x.y). The default is 1.5.
|
||||
.IP \fB-c\fR 5
|
||||
Number of request packets to send to each target. In this mode, a
|
||||
line is displayed for each received response (this can suppressed with
|
||||
-q or -Q). Also, statistics about responses for each target are displayed
|
||||
when all requests have been sent (or when interrupted).
|
||||
.IP \fB-C\fR 5
|
||||
Similar to -c, but the per-target statistics are displayed in a format
|
||||
designed for automated response-time statistics gathering. For
|
||||
example:
|
||||
|
||||
% fping -C 5 -q somehost
|
||||
|
||||
somehost : 91.7 37.0 29.2 - 36.8
|
||||
|
||||
shows the response time in milliseconds for each of the five requests,
|
||||
with the "-" indicating that no response was received to the fourth
|
||||
request.
|
||||
.IP \fB-d\fR 5
|
||||
Use DNS to lookup address of return ping packet. This allows you to give
|
||||
fping a list of IP addresses as input and print hostnames in the output.
|
||||
.IP \fB-e\fR 5
|
||||
Show elapsed (round-trip) time of packets.
|
||||
.IP \fB-f\fR 5
|
||||
Read list of targets from a file. This option can only be used by the
|
||||
root user. Regular users should pipe in the file via stdin:
|
||||
|
||||
% fping < targets_file
|
||||
|
||||
.IP \fB-g\fR 5
|
||||
Generate a target list from a supplied IP netmask, or a starting and ending IP.
|
||||
Specify the netmask or start/end in the targets portion of the command line.
|
||||
|
||||
ex. To ping the class C 192.168.1.x, the specified command line could look like either:
|
||||
|
||||
fping -g 192.168.1.0/24
|
||||
|
||||
or
|
||||
|
||||
fping -g 192.168.1.0 192.168.1.255
|
||||
.IP \fB-h\fR 5
|
||||
Print usage message.
|
||||
.IP \fB-i\fIn\fR 5
|
||||
The minimum amount of time (in milliseconds) between sending a ping packet to any target (default is 25).
|
||||
.IP \fB-l\fR 5
|
||||
Loop sending packets to each target indefinitely. Can be interrupted
|
||||
with ctl-C; statistics about responses for each target are then displayed.
|
||||
.IP \fB-m\fR 5
|
||||
Send pings to each of a target host's multiple interfaces.
|
||||
.IP \fB-n\fR 5
|
||||
Same as -d.
|
||||
.IP \fB-p\fR 5
|
||||
In looping or counting modes (-l, -c, or -C), this parameter sets the
|
||||
time in milliseconds that
|
||||
.B fping
|
||||
waits between successive packets to an individual target. Default is
|
||||
1000.
|
||||
.IP \fB-q\fR 5
|
||||
Quiet. Don't show per-target results, just set final exit status.
|
||||
.IP \fB-Q\fIn\fR 5
|
||||
Like -q, but show summary results every n seconds.
|
||||
.IP \fB-r\fIn\fR 5
|
||||
Retry limit (default 3). This is the number of times an attempt at pinging
|
||||
a target will be made, not including the first try.
|
||||
.IP \fB-s\fR 5
|
||||
Print cumulative statistics upon exit.
|
||||
.IP \fB-t\fIn\fR 5
|
||||
Initial target timeout in milliseconds (default 500). In the default
|
||||
mode, this is the amount of time that
|
||||
.B fping
|
||||
waits for a response to its first request. Successive timeouts are
|
||||
multiplied by the backoff factor.
|
||||
.IP \fB-u\fR 5
|
||||
Show targets that are unreachable.
|
||||
.IP \fB-v\fR 5
|
||||
Print
|
||||
.B fping
|
||||
version information.
|
||||
|
||||
.SH EXAMPLES
|
||||
The following perl script will check a list of hosts and send mail if
|
||||
any are unreachable. It uses the open2 function which allows a program
|
||||
to be opened for reading and writing. fping does not start pinging the
|
||||
list of systems until it reads EOF, which it gets after INPUT is closed.
|
||||
Sure the open2 usage is not needed in this example, but it's a good open2
|
||||
example none the less.
|
||||
.nf
|
||||
|
||||
#!/usr/local/bin/perl
|
||||
require 'open2.pl';
|
||||
|
||||
$MAILTO = "root";
|
||||
|
||||
$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u");
|
||||
|
||||
@check=("slapshot","foo","foobar");
|
||||
|
||||
foreach(@check) { print INPUT "$_\\n"; }
|
||||
close(INPUT);
|
||||
@output=<OUTPUT>;
|
||||
|
||||
if ($#output != -1) {
|
||||
chop($date=`date`);
|
||||
open(MAIL,"|mail -s 'unreachable systems' $MAILTO");
|
||||
print MAIL "\\nThe following systems are unreachable as of: $date\\n\\n";
|
||||
print MAIL @output;
|
||||
close MAIL;
|
||||
}
|
||||
|
||||
.ni
|
||||
Another good example is when you want to perform an action only on hosts
|
||||
that are currently reachable.
|
||||
.nf
|
||||
|
||||
#!/usr/local/bin/perl
|
||||
|
||||
$hosts_to_backup = `cat /etc/hosts.backup | fping -a`;
|
||||
|
||||
foreach $host (split(/\\n/,$hosts_to_backup)) {
|
||||
# do it
|
||||
}
|
||||
|
||||
.ni
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
Roland J. Schemers III, Stanford University, concept and versions 1.x
|
||||
RL "Bob" Morgan, Stanford University, versions 2.x
|
||||
David Papp, versions 2.3x and up,
|
||||
fping website: http://www.fping.com
|
||||
.ni
|
||||
.SH DIAGNOSTICS
|
||||
Exit status is 0 if all the hosts are reachable, 1 if some hosts were
|
||||
unreachable, 2 if any IP addresses were not found, 3 for invalid
|
||||
command line arguments, and 4 for a system call failure.
|
||||
.SH BUGS
|
||||
Ha! If we knew of any we would have fixed them!
|
||||
.SH RESTRICTIONS
|
||||
If certain options are used (i.e, a low value for -i and -t, and a
|
||||
high value for -r) it is possible to flood the network. This program
|
||||
must be installed as setuid root in order to open up a raw socket,
|
||||
or must be run by root. In order to stop mere mortals from hosing the
|
||||
network (when fping is installed setuid root) , normal users can't specify
|
||||
the following:
|
||||
.nf
|
||||
|
||||
-i n where n < 10 msec
|
||||
-r n where n > 20
|
||||
-t n where n < 250 msec
|
||||
|
||||
.ni
|
||||
.SH SEE ALSO
|
||||
netstat(1), ping(8), ifconfig(8c)
|
||||
|
||||
@@ -0,0 +1,609 @@
|
||||
2016-02-22 Carsten Larsen <carsten.larsen@mail.com>
|
||||
* AROS Version 3.13
|
||||
* (internal) Compatibility changes in usage of gettimeofday
|
||||
* (internal) Compatibility changes datatypes and library usage
|
||||
|
||||
2016-02-22 Carsten Larsen <carsten.larsen@mail.com>
|
||||
* AmigaOS Version 3.13
|
||||
* (bugfix) Socket was not closed and memory not released on exit
|
||||
* (bugfix) Calculation of digits were incorrect due to a faulty gettimeofday function
|
||||
* (bugfix) Differences in Amiga timeval datatype sometimes caused fping to hang
|
||||
* (internal) Code compliance with AmigaOS (Amiga2Date etc.)
|
||||
* (internal) Removed non-supported TTL and TOS socket options
|
||||
* (improvement) Minor improvement in visual layouts
|
||||
|
||||
2015-10-21 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.13
|
||||
* (bugfix) Fix ICMP errors sometimes causing crashes with fping >= 3.11
|
||||
(fixes #85, reported by Jamie Heilman and Bill Blough)
|
||||
|
||||
2015-10-14 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.12
|
||||
* (bugfix) Fix fping6 -R (fixes #84, reported by Stuart Henderson)
|
||||
|
||||
2015-10-12 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.11
|
||||
* (feature) New option -R to use random bytes instead of NULLs (#72, Anthony DeRobertis)
|
||||
* (feature) Small documentation and performance improvements (Ryan Underwood)
|
||||
* (bugfix) Fix double entries with fping -u and unreachable hosts
|
||||
* (internal) Use sockaddr_storage and simplify code, so that we can one day support both IPv4 and IPv6 with the same binary
|
||||
|
||||
2015-08-14 Carsten Larsen <carsten.larsen@mail.com>
|
||||
* Initial AmigaOS version
|
||||
|
||||
2014-05-03 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.10
|
||||
* Fix confusing error message with -g and IPv6 addresses (#58, reported by Axel Beckert)
|
||||
* Allow option '-f' also for non-root (since setuid privileges are dropped)
|
||||
* Do not retry twice DNS lookup on DNS lookup problem
|
||||
* Remove support for NIS groups
|
||||
* Better document -B backoff-factor and when it can be used (#33, Oleksiy Zagorskyi)
|
||||
* More tests added
|
||||
|
||||
2014-03-08 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.9
|
||||
* Fix random output on socket error (reported by Aleksandrs Saveljevs, #56)
|
||||
* Support ppc64le architecture by including alpha libtool version
|
||||
(reported by Amit Kumar Gupta and Aravinda B Thunug)
|
||||
* Fix compilation problem on FreeBSD (#57)
|
||||
* Initial test suite and continous intergration (with travis-ci.org / coveralls.io)
|
||||
* Don't output usage information on error
|
||||
|
||||
2013-11-08 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.8
|
||||
* Fix segmentation fault introduced in version 3.7 with loop mode (reported
|
||||
by Vlad Glagolev, #55)
|
||||
|
||||
2013-11-04 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.7
|
||||
* Allow running as non-root on Mac OS X by using non-privileged ICMP (#7)
|
||||
* Remove unnecessary IPv6 socket options
|
||||
* Fix again compatibility issue with FreeBSD (Shawn Chu)
|
||||
* Fix fping hanging forever on permanent sendto failure (Shawn Chu)
|
||||
* Fix duplicate echo reply packets causing early stop in count mode
|
||||
(reported by Ramon Schwammberger, #53)
|
||||
|
||||
2013-10-10 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.6
|
||||
* Fix loop issue after 65536 pings (reported by Peter Folk and GBert, #12)
|
||||
* Minimum ping data size is now 0
|
||||
* Removed setsockopt IPV6_CHECKSUM, which shouldn't be set and breaks
|
||||
compiling on Solaris (reported by Juergen Arndt)
|
||||
* Fix wrong min RTT value with -Q option (reported by Alexander Ivanov, #51)
|
||||
|
||||
2013-05-22 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.5
|
||||
* Fix sprint_tm buffer size crash (reported by Japheth Cleaver)
|
||||
* Addded -D flag to print timestamps (Toke Høiland-Jørgensen)
|
||||
* Fix fping6 build on OS X 10.8 (unknown contributor)
|
||||
* Fix compatibility issue with FreeBSD (Alexandre Raynaud, Jason Harris, #39)
|
||||
* Fping.spec: fix setuid permissions and provides fping6 (Marcus Vinicius Ferreira)
|
||||
* Re-create configure script with autoconf 2.69 for aarch64 support (Chuck Anderson, #45)
|
||||
|
||||
2012-09-04 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.4
|
||||
* Revert "Output statistics to stdout instead of stderr", because it breaks
|
||||
tools assuming the output goes to stderr
|
||||
|
||||
2012-08-19 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.3
|
||||
* Do not output icmp errors with -q (#1)
|
||||
* Add --enable-ipv4 and --enable-ipv6 options to configure (Niclas Zeising)
|
||||
* Fix removing of unreachable hosts when doing loop (Thomas Liske, #13 #23)
|
||||
* Fix -A for fping6 (reported by Matt LaPlante, #14)
|
||||
* Fix "options inet6" breaking IPv4 name resolution (reported by Matt LaPlante, #17)
|
||||
* Output statistics to stdout instead of stderr (suggested by Simon Leinen, #9)
|
||||
* Set default data size to 56 bytes on all architectures (#18)
|
||||
* Added contrib/fping.spec (Stephen Schaefer, #24)
|
||||
* Convert man-page source to POD for easier maintenance
|
||||
* Fix error message on DNS error for IPv6 hosts (#27)
|
||||
* Fix -n flag in fping6 (#28)
|
||||
* Man-page fix: TOS option typo (Thomas Liske, #23)
|
||||
* Man-page fix: inconsistency in regards to numeric arguments (Robert Henney)
|
||||
* Man-page fix: better description of option -q (#15)
|
||||
|
||||
2012-05-29 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.2
|
||||
* Improve documentation for -g option (G.W. Haywood)
|
||||
* Performance optimization for big select timeouts (#10, Andrey Bondarenko)
|
||||
* Fix restart of select call after interrupt signal (#8, Boian Bonev)
|
||||
* Fix infinite loop caused by linked list corruption (#11, Boian Bonev)
|
||||
|
||||
2012-04-26 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.1
|
||||
* -g option (generate): exclude network and broadcast address for cidr
|
||||
ranges (idea by Eric Brander)
|
||||
* do not explicitely check if running as root, to make it possible to
|
||||
install fping with linux capabilities instead of making it setuid
|
||||
(setcap cap_net_raw+ep fping)
|
||||
* ANSI C (C89) compiler now a requirement
|
||||
* Portability fixes
|
||||
* Reorganized source directory
|
||||
* Bugfix: fix timeout issue on Solaris (Sandor Geller)
|
||||
* Man-page fixes (Axel Beckert)
|
||||
* Added -H option to specify number of hops (Paul Duda)
|
||||
* Output usage information to stdout when called with -h (Paul Duda)
|
||||
|
||||
2011-12-28 David Schweikert <david@schweikert.ch>
|
||||
* Version 3.0
|
||||
* rewritten main loop for improved performance
|
||||
* -T parameter (select timeout) now obsolete
|
||||
* Maintenance taken over from unresponsive previous maintainer
|
||||
(anybody please step up, if you disagree)
|
||||
* New homepage: www.fping.org
|
||||
|
||||
2009-12-21 Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Version v2.4b2-to3-ipv6
|
||||
* added -On option to set the TOS octet
|
||||
* Removed unused variables from code
|
||||
* updated to current autoconf standards
|
||||
* Merged Debian changes (see below)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
fping (2.4b2-to-ipv6-16.1) unstable; urgency=low
|
||||
|
||||
* NMU during Moenchengladbach BSP
|
||||
* Fixes FTBFS on kfreebsd (Closes: #555398)
|
||||
* Fixes typo "Paramter" in binary
|
||||
|
||||
-- Axel Beckert <abe@deuxchevaux.org> Sat, 23 Jan 2010 16:22:02 +0100
|
||||
|
||||
fping (2.4b2-to-ipv6-16) unstable; urgency=low
|
||||
|
||||
* Fix the following bugs
|
||||
- Network byte order sensitivity was missing completely.
|
||||
Added hopefully all missing calls.
|
||||
- The sequence numbering scheme used led to packet drops.
|
||||
Changed it to a more senseful numbering scheme.
|
||||
- Some minor C programming mistakes ('=' instead of '==').
|
||||
Patch by Stephan Fuhrmann; closes: #502569
|
||||
* Add support for command line select timeout setting
|
||||
Patch by Marton Balint; closes: #502575
|
||||
* Remove symlinks in /usr/sbin; closes: #377732
|
||||
* Standards-Version is 3.8.0
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Sat, 18 Oct 2008 12:04:52 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-15) unstable; urgency=low
|
||||
|
||||
* Added interface binding (-I) for fping
|
||||
Patch by Peter Naulls <peter@mushroomnetworks.com>
|
||||
Closes: #439014
|
||||
* Fixed a couple of typos in fping.8. Closes: #423180
|
||||
* Added homepage control header
|
||||
* Bumped Standards-Version to 3.7.3
|
||||
* Fixed the following lintian issue:
|
||||
- debian-rules-sets-DH_COMPAT
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Mon, 03 Mar 2008 17:46:17 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-13) unstable; urgency=low
|
||||
|
||||
* Fixed stdout flush problem, closes: #340146.
|
||||
Patch by Bart Martens <bart.martens@advalvas.be>.
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Fri, 30 Dec 2005 08:30:09 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-12) unstable; urgency=low
|
||||
|
||||
* Fixed "problem with option -r (retry limit)", closes: #318402.
|
||||
Patch by Qingning Huo <qingningh@lanware.co.uk>.
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Sat, 08 Oct 2005 21:26:35 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-11) unstable; urgency=low
|
||||
|
||||
* Fixed "would be useful to specify 'source address' like ping for multi
|
||||
homed machines", closes: #198486.
|
||||
Patch by Marc Haber <mh+debian-bugs@zugschlus.de>.
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Thu, 02 Jun 2005 08:14:54 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-10) unstable; urgency=low
|
||||
|
||||
* Fixed "unnecessary delay with the -c option after the last packet"
|
||||
(Closes: #293856). Patch by Niko Tyni <ntyni@iki.fi>
|
||||
|
||||
-- Anibal Monsalve Salazar <anibal@debian.org> Sun, 06 Feb 2005 23:25:57 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-9) unstable; urgency=low
|
||||
|
||||
* Fixed "fping6 always does reverse lookup" (Closes: #273647).
|
||||
Patch by Jeroen Massar and forwarded by Bernhard Schmidt <berni@birkenwald.de>
|
||||
|
||||
-- Anibal Monsalve Salazar <A.Monsalve.Salazar@IEEE.org> Mon, 10 Jan 2005 00:01:32 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-7) unstable; urgency=low
|
||||
|
||||
* Build fping in build/ipv[46] instead of build and build-ipv6.
|
||||
* Made DNS errors non-fatal for IPv6 (closes: #198056).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Fri, 20 Jun 2003 21:36:30 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-6) unstable; urgency=low
|
||||
|
||||
* Do not use incorrect linux.h file (closes: #85468).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 17 May 2003 14:13:11 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-5) unstable; urgency=low
|
||||
|
||||
* Fixed yet another divide by zero bug (closes: #148445).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Tue, 4 Jun 2002 12:18:03 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-4) unstable; urgency=low
|
||||
|
||||
* Made fping6 setuid (closes: #136386).
|
||||
* Moved fping back into bin.
|
||||
* Partially applied IPv6 patch to fix IPv6 checksums (closes: #136479).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sun, 7 Apr 2002 20:36:56 +1000
|
||||
|
||||
fping (2.4b2-to-ipv6-3) unstable; urgency=low
|
||||
|
||||
* Added compatibility symlink for fping (closes: #135203).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 23 Feb 2002 08:34:11 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-2) unstable; urgency=low
|
||||
|
||||
* Fixed another divide by zero error (closes: #132370).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Thu, 7 Feb 2002 20:10:48 +1100
|
||||
|
||||
fping (2.4b2-to-ipv6-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
* Install fping into sbin as done by upstream.
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Fri, 1 Feb 2002 22:11:59 +1100
|
||||
|
||||
fping (2.2b2-3) unstable; urgency=low
|
||||
|
||||
* Removed INSTALL file from package (closes: #84050).
|
||||
* Fixed alignment bug.
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 10 Feb 2001 19:25:18 +1100
|
||||
|
||||
fping (2.2b2-2) unstable; urgency=low
|
||||
|
||||
* Made changes for dpkg-statoverride (closes: #83838).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sun, 28 Jan 2001 21:53:05 +1100
|
||||
|
||||
fping (2.2b2-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
* Fixed typo that prevented -d from working (closes: #83255).
|
||||
* Drop root privileges after opening the socket (closes: #81589).
|
||||
* Fixed the options [tip], they were out by a factor of 10
|
||||
(Richard Kettlewell, closes: #83742).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sun, 28 Jan 2001 00:09:41 +1100
|
||||
|
||||
fping (2.2b1-2) unstable; urgency=low
|
||||
|
||||
* Fixed typo in control file, spotted by William Ono (closes: #49909).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Mon, 15 May 2000 12:27:03 +1000
|
||||
|
||||
fping (2.2b1-1) unstable; urgency=low
|
||||
|
||||
* Initial release.
|
||||
* Fixed divide by zero error (closes: #29902).
|
||||
|
||||
-- Herbert Xu <herbert@debian.org> Sat, 30 Oct 1999 16:36:19 +1000
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
Wed Jan 16 2002
|
||||
Jeroen Massar
|
||||
- Revision v2.4b2-to-IPv6
|
||||
- Added IPv6 support.
|
||||
- Added -I option for selecting source IPv4/IPv6 address.
|
||||
- Makefile.in now generates a Makefile which will build both
|
||||
fping (IPv4) and fping6 (IPv6). Thus it makes an fping (IPv4 only)
|
||||
and an fping6 (IPv6 only).
|
||||
- num_unreachable was counted twice when a sendto() generated errors.
|
||||
- See http://unfix.org/projects/ipv6/
|
||||
|
||||
Tue Mar 14 2001
|
||||
Jason Ewasiuk <jasone@remote.net>
|
||||
- Revision v2.4b1
|
||||
- added -g option for generating IPs from a start to an end value
|
||||
- two available options, generate IPs from start IP to end IP
|
||||
or from a passed netmask, such as 192.168.1.0/24
|
||||
|
||||
Thu Feb 15 2001
|
||||
Jason Ewasiuk <jasone@remote.net>
|
||||
- Revision v2.3b1
|
||||
- formatting changes to code layout (fping.c)
|
||||
NOTE: Best viewed with a tab stop of 4
|
||||
- merged in changes from Debian c/o Herbert Xu
|
||||
<herbert@gondor.apana.org.au>
|
||||
- Compilation fix on alphas with glibc
|
||||
- Alignment issues (note from JE: in wait_for_reply())
|
||||
- A typo with the time specified on the command line
|
||||
(note from JE: bug was using 10 instead of 100)
|
||||
- Drop privileges after obtaining socket
|
||||
(note from JE: might be moot, since prog exits if
|
||||
user is not root)
|
||||
- touched all files in package to this date
|
||||
- couple new #ifdefs added for future WIN32 support
|
||||
(Haven't got to adding this yet, will take a lot of rewriting.)
|
||||
|
||||
Fri Dec 8 10:33:13 2000 Roland Schemers <schemers@stanford.edu>
|
||||
|
||||
* stop using sys_errlist and start using strerror
|
||||
fixed bug in output of -C
|
||||
|
||||
Wed Jan 8 11:18:37 1997 Roland Schemers <schemers@stanford.edu>
|
||||
|
||||
* Created ChangeLog file. What follows was from the CHANGES file.
|
||||
|
||||
* Revision 2.0 1994/10/31 21:26:23 morgan
|
||||
|
||||
Substantial rewrite, including new features:
|
||||
|
||||
support some traditional ping features:
|
||||
loop mode
|
||||
specify size of data packets
|
||||
specify how many pings to send
|
||||
show per-response data
|
||||
interpret ICMPs other than ICMP Echo response
|
||||
|
||||
also
|
||||
|
||||
rewrote main loop completely
|
||||
make timings in tenths of milliseconds
|
||||
do exponential backoff on retries
|
||||
port to more systems
|
||||
add some debugging stuff
|
||||
do better checking on whether received ICMP is for us
|
||||
|
||||
* Revision 1.24 1993/12/10 23:11:39 schemers
|
||||
|
||||
commented out seteuid(getuid()) since it isn't needed
|
||||
|
||||
* Revision 1.23 1993/12/10 18:33:41 schemers
|
||||
|
||||
Took out the -f option for non-root users. This can be enabled by
|
||||
defining ENABLE_F_OPTION before compiling. There is a call to
|
||||
access before opening the file, but there is a race condition.
|
||||
Reading from stdin is much safer.
|
||||
|
||||
|
||||
* Revision 1.22 1993/11/16 19:49:24 schemers
|
||||
|
||||
Took out setuid(getuid()) and used access() system call to
|
||||
check for access to the file specified with "-f".
|
||||
|
||||
* Revision 1.21 1993/07/20 18:08:19 schemers
|
||||
|
||||
commented out the test to make sure the ping packet came from the
|
||||
same IP address as the one we sent to. This could cause problems on
|
||||
multi-homed hosts.
|
||||
|
||||
* Revision 1.20 1993/02/23 00:16:38 schemers
|
||||
|
||||
fixed syntax error (should have compiled before checking in...)
|
||||
|
||||
* Revision 1.19 1993/02/23 00:15:15 schemers
|
||||
|
||||
turned off printing of "is alive" when -a is specified.
|
||||
|
||||
* Revision 1.18 1992/07/28 15:16:44 schemers
|
||||
|
||||
added a fflush(stdout) call before the summary is sent to stderr, so
|
||||
everything shows up in the right order.
|
||||
|
||||
* Revision 1.17 1992/07/23 03:29:42 schemers
|
||||
* Revision 1.16 1992/07/22 19:24:37 schemers
|
||||
|
||||
Fixed declaration of timeval_diff. Didn't notice the problem because
|
||||
I use 'cc' in stead of gcc under Ultrix. Time to switch? :-)
|
||||
|
||||
Modified file reaing so it would skip blank lines or lines starting
|
||||
with a '#'. Now you can do something like:
|
||||
|
||||
fping -ad < /etc/hosts
|
||||
|
||||
* Revision 1.15 1992/07/21 17:07:18 schemers
|
||||
|
||||
Put in sanity checks so only root can specify "dangerous" options.
|
||||
Changed usage to show switchs in alphabetical order.
|
||||
* Revision 1.14 1992/07/21 16:40:52 schemers
|
||||
* Revision 1.13 1992/07/17 21:02:17 schemers
|
||||
|
||||
Changed the default timeout to 2500 msec, and retry to 3. This was
|
||||
due to suggestions from people with slow (WAN) networks. The default
|
||||
1 sec timeout was too fast.
|
||||
|
||||
|
||||
Added '-e' option for showing elapsed (round-trip) times on pakets, and
|
||||
modified the -s option to include min, max, and average round-trip times,
|
||||
and over all elapsed time.
|
||||
|
||||
Modified action taken when a error is returned from sendto. The action
|
||||
taken now considers the host unreachable and prints the hostname
|
||||
followed by the errno message. The program will not exit and will continue
|
||||
to try other hosts.
|
||||
|
||||
* Revision 1.12 1992/07/17 16:38:54 schemers
|
||||
* Revision 1.11 1992/07/17 16:28:38 schemers
|
||||
|
||||
move socket create call so I could do a setuid(getuid()) before the
|
||||
fopen call is made. Once the socket is created root privs aren't needed
|
||||
to send stuff out on it.
|
||||
|
||||
moved num_timeout counter. It really was for debug purposes and didn't
|
||||
make sense to the general public :-) Now it is the number of timeouts
|
||||
(pings that didn't get received with the time limit).
|
||||
|
||||
|
||||
* Revision 1.10 1992/07/16 16:24:38 schemers
|
||||
* Revision 1.9 1992/07/16 16:00:04 schemers
|
||||
* Revision 1.8 1992/07/16 05:44:41 schemers
|
||||
|
||||
Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE
|
||||
for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added
|
||||
check for __cplusplus.
|
||||
|
||||
Now compiles ok under Ultrix 3.1, and Sun4 using cc. Also compiled
|
||||
ok using g++ 2.2.2.
|
||||
|
||||
Changed '-a' and '-u' flags to be mutually exclusive (makes sense, since
|
||||
specifiying both '-a' and '-u' is the same as not specifiying anything.
|
||||
Since '-a' and '-u' are mutually exclusive, these options now only print
|
||||
the hostname, and not the 'is alive' or 'is unreachable' messages.
|
||||
This makes it much easier to do stuff like:
|
||||
|
||||
#!/usr/local/bin/perl
|
||||
$hosts_to_backup=`cat /etc/hosts.backup|fping -a`;
|
||||
|
||||
Since you don't have to strip off the 'is alive' messages.
|
||||
|
||||
Changed usage to and stats to print to stderr instead of stdout.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
RCS header info from original fping.c package (no longer required)
|
||||
|
||||
/*
|
||||
***************************************************
|
||||
*
|
||||
* Standard RCS Header information (see co(1))
|
||||
*
|
||||
* $Author: schemers $
|
||||
*
|
||||
* $Date: 1997/01/08 20:29:33 $
|
||||
*
|
||||
* $Revision: 2.2 $
|
||||
*
|
||||
* $Locker: $
|
||||
*
|
||||
* $Source: /afs/ir/group/networking/src/fping/fping-2.2/src/RCS/fping.c,v $
|
||||
*
|
||||
* $State: Exp $
|
||||
*
|
||||
* $Log: fping.c,v $
|
||||
*
|
||||
* Revision 2.2 1997/01/08 20:29:33 schemers
|
||||
* changes for autoconf/automake
|
||||
*
|
||||
* Revision 2.1 1997/01/08 19:07:18 schemers
|
||||
* checked in RL "Bob"'s changes before configure'ing
|
||||
*
|
||||
* Revision 2.0 1994/10/31 21:26:23 schemers
|
||||
* many changes by RL "Bob" Morgan
|
||||
* add timing data collection, loop mode, per-packet output, etc
|
||||
*
|
||||
* Revision 1.24 1993/12/10 23:11:39 schemers
|
||||
* commented out seteuid(getuid()) since it isn't needed
|
||||
*
|
||||
* Revision 1.23 1993/12/10 18:33:41 schemers
|
||||
* Took out the -f option for non-root users. This can be enabled by
|
||||
* defining ENABLE_F_OPTION before compiling. There is a call to
|
||||
* access before opening the file, but there is a race condition.
|
||||
* Reading from stdin is much safer.
|
||||
*
|
||||
* Revision 1.22 1993/11/16 19:49:24 schemers
|
||||
* Took out setuid(getuid()) and used access() system call to
|
||||
* check for access to the file specified with "-f".
|
||||
*
|
||||
* Revision 1.21 1993/07/20 18:08:19 schemers
|
||||
* commented out the test to make sure the ping packet came from the
|
||||
* same IP address as the one we sent to. This could cause problems on
|
||||
* multi-homed hosts.
|
||||
*
|
||||
* Revision 1.20 1993/02/23 00:16:38 schemers
|
||||
* fixed syntax error (should have compiled before checking in...)
|
||||
*
|
||||
* Revision 1.19 1993/02/23 00:15:15 schemers
|
||||
* turned off printing of "is alive" when -a is specified.
|
||||
*
|
||||
* Revision 1.18 1992/07/28 15:16:44 schemers
|
||||
* added a fflush(stdout) call before the summary is sent to stderr, so
|
||||
* everything shows up in the right order.
|
||||
*
|
||||
* Revision 1.17 1992/07/23 03:29:42 schemers
|
||||
* fixed declaration of timeval_diff.
|
||||
*
|
||||
* Revision 1.16 1992/07/22 19:24:37 schemers
|
||||
* Modified file reading so it would skip blanks lines or lines starting
|
||||
* with a '#'. Now you can do something like:
|
||||
*
|
||||
* fping -ad < /etc/hosts
|
||||
*
|
||||
* Revision 1.15 1992/07/21 17:07:18 schemers
|
||||
* Put in sanity checks so only root can specify "dangerous" options.
|
||||
* Changed usage to show switchs in alphabetical order.
|
||||
*
|
||||
* Revision 1.14 1992/07/21 16:40:52 schemers
|
||||
* Now when sendto returns an error, the host is considered unreachable and
|
||||
* and the error message (from errno) is displayed.
|
||||
*
|
||||
* Revision 1.13 1992/07/17 21:02:17 schemers
|
||||
* changed default timeout to 2500 msec (for WANs), and default try
|
||||
* to 3. This gives 10 second overall timeout.
|
||||
*
|
||||
* Added -e option for showing elapsed (round-trip) time on packets
|
||||
*
|
||||
* Modified -s option to inlude to round-trip stats
|
||||
*
|
||||
* Added #ifndef DEFAULT_* stuff its easier to change the defaults
|
||||
*
|
||||
* Reorganized main loop.
|
||||
*
|
||||
* cleaned up timeval stuff. removed set_timeval and timeval_expired
|
||||
* since they aren't needed anymore. Just use timeval_diff.
|
||||
*
|
||||
* Revision 1.12 1992/07/17 16:38:54 schemers
|
||||
* move socket create call so I could do a setuid(getuid()) before the
|
||||
* fopen call is made. Once the socket is created root privs aren't needed
|
||||
* to send stuff out on it.
|
||||
*
|
||||
* Revision 1.11 1992/07/17 16:28:38 schemers
|
||||
* moved num_timeout counter. It really was for debug purposes and didn't
|
||||
* make sense to the general public :-) Now it is the number of timeouts
|
||||
* (pings that didn't get received with the time limit).
|
||||
*
|
||||
* Revision 1.10 1992/07/16 16:24:38 schemers
|
||||
* changed usage() to use fprintf(stderr,"...");
|
||||
*
|
||||
* Revision 1.9 1992/07/16 16:00:04 schemers
|
||||
* Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE
|
||||
* for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added
|
||||
* check for __cplusplus.
|
||||
*
|
||||
* Revision 1.8 1992/07/16 05:44:41 schemers
|
||||
* changed -a and -u to only show hostname in results. This is
|
||||
* for easier parsing. Also added -v flag
|
||||
*
|
||||
* Revision 1.7 1992/07/14 18:45:23 schemers
|
||||
* initialized last_time in add_host function
|
||||
*
|
||||
* Revision 1.6 1992/07/14 18:32:40 schemers
|
||||
* changed select to use FD_ macros
|
||||
*
|
||||
* Revision 1.5 1992/07/14 17:21:22 schemers
|
||||
* standardized exit status codes
|
||||
*
|
||||
* Revision 1.4 1992/06/26 15:25:35 schemers
|
||||
* changed name from rrping to fping
|
||||
*
|
||||
* Revision 1.3 1992/06/24 15:39:32 schemers
|
||||
* added -d option for unreachable systems
|
||||
*
|
||||
* Revision 1.2 1992/06/23 03:01:23 schemers
|
||||
* misc fixes from R.L. "Bob" Morgan
|
||||
*
|
||||
* Revision 1.1 1992/06/19 18:23:52 schemers
|
||||
* Initial revision
|
||||
*
|
||||
*--------------------------------------------------
|
||||
* Copyright (c) 1992, 1994, 1997 Board of Trustees
|
||||
* Leland Stanford Jr. University
|
||||
***************************************************
|
||||
*/
|
||||
-238
@@ -1,238 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
#
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
** Special compatibility definitions for linux.
|
||||
**
|
||||
** On the linux platform, several IP-related structures have
|
||||
** different names. Also some of the structure fields have
|
||||
** other names, although the layout is (obviously) fixed.
|
||||
** Several constants are not defined in the standard files.
|
||||
**
|
||||
** @(#)linux.h e07@nikhef.nl (Eric Wassenaar) 960301
|
||||
*/
|
||||
|
||||
#if defined(linux)
|
||||
|
||||
#include <endian.h> /* to get the proper BYTE_ORDER */
|
||||
|
||||
#if !defined(BYTE_ORDER) || (BYTE_ORDER != BIG_ENDIAN && \
|
||||
BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != PDP_ENDIAN)
|
||||
error "Undefined or invalid BYTE_ORDER";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure of an ip header, without options.
|
||||
*/
|
||||
|
||||
#define IPVERSION 4
|
||||
|
||||
struct ip {
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN)
|
||||
u_char ip_hl:4, /* header length */
|
||||
ip_v:4; /* version */
|
||||
#else
|
||||
u_char ip_v:4, /* version */
|
||||
ip_hl:4; /* header length */
|
||||
#endif
|
||||
u_char ip_tos; /* type of service */
|
||||
short ip_len; /* total length */
|
||||
u_short ip_id; /* identification */
|
||||
short ip_off; /* fragment offset field */
|
||||
#define IP_DF 0x4000 /* dont fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
u_char ip_ttl; /* time to live */
|
||||
u_char ip_p; /* protocol */
|
||||
u_short ip_sum; /* checksum */
|
||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
|
||||
/*
|
||||
* Structure of an icmp header.
|
||||
*/
|
||||
|
||||
struct icmp {
|
||||
u_char icmp_type; /* type of message, see below */
|
||||
u_char icmp_code; /* type sub code */
|
||||
u_short icmp_cksum; /* ones complement cksum of struct */
|
||||
union {
|
||||
u_char ih_pptr; /* ICMP_PARAMPROB */
|
||||
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
|
||||
struct ih_idseq {
|
||||
n_short icd_id;
|
||||
n_short icd_seq;
|
||||
} ih_idseq;
|
||||
int ih_void;
|
||||
} icmp_hun;
|
||||
#define icmp_pptr icmp_hun.ih_pptr
|
||||
#define icmp_gwaddr icmp_hun.ih_gwaddr
|
||||
#define icmp_id icmp_hun.ih_idseq.icd_id
|
||||
#define icmp_seq icmp_hun.ih_idseq.icd_seq
|
||||
#define icmp_void icmp_hun.ih_void
|
||||
union {
|
||||
struct id_ts {
|
||||
n_time its_otime;
|
||||
n_time its_rtime;
|
||||
n_time its_ttime;
|
||||
} id_ts;
|
||||
struct id_ip {
|
||||
struct ip idi_ip;
|
||||
/* options and then 64 bits of data */
|
||||
} id_ip;
|
||||
u_long id_mask;
|
||||
char id_data[1];
|
||||
} icmp_dun;
|
||||
#define icmp_otime icmp_dun.id_ts.its_otime
|
||||
#define icmp_rtime icmp_dun.id_ts.its_rtime
|
||||
#define icmp_ttime icmp_dun.id_ts.its_ttime
|
||||
#define icmp_ip icmp_dun.id_ip.idi_ip
|
||||
#define icmp_mask icmp_dun.id_mask
|
||||
#define icmp_data icmp_dun.id_data
|
||||
};
|
||||
|
||||
#define ICMP_MINLEN 8 /* abs minimum */
|
||||
|
||||
/*
|
||||
* Definition of icmp type and code field values.
|
||||
*/
|
||||
|
||||
#define ICMP_ECHOREPLY 0 /* echo reply */
|
||||
#define ICMP_UNREACH 3 /* dest unreachable, codes: */
|
||||
#define ICMP_UNREACH_NET 0 /* bad net */
|
||||
#define ICMP_UNREACH_HOST 1 /* bad host */
|
||||
#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
|
||||
#define ICMP_UNREACH_PORT 3 /* bad port */
|
||||
#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
|
||||
#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
|
||||
#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
|
||||
#define ICMP_REDIRECT 5 /* shorter route, codes: */
|
||||
#define ICMP_REDIRECT_NET 0 /* for network */
|
||||
#define ICMP_REDIRECT_HOST 1 /* for host */
|
||||
#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
|
||||
#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
|
||||
#define ICMP_ECHO 8 /* echo service */
|
||||
#define ICMP_TIMXCEED 11 /* time exceeded, code: */
|
||||
#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
|
||||
#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
|
||||
#define ICMP_PARAMPROB 12 /* ip header bad */
|
||||
#define ICMP_TSTAMP 13 /* timestamp request */
|
||||
#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
|
||||
#define ICMP_IREQ 15 /* information request */
|
||||
#define ICMP_IREQREPLY 16 /* information reply */
|
||||
#define ICMP_MASKREQ 17 /* address mask request */
|
||||
#define ICMP_MASKREPLY 18 /* address mask reply */
|
||||
|
||||
/*
|
||||
* Definitions needed for the udp header structure.
|
||||
*/
|
||||
|
||||
#define uh_sport source
|
||||
#define uh_dport dest
|
||||
#define uh_ulen len
|
||||
#define uh_sum check
|
||||
|
||||
#endif /* linux */
|
||||
@@ -1,190 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing - GNU libit 0.0"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`configure.in'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`configure.in'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`configure.in'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,36 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Last modified: 1994-03-25
|
||||
# Public domain
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file in ${1+"$@"} ; do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d in ${1+"$@"} ; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
|
||||
fi
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
||||
@@ -0,0 +1,26 @@
|
||||
fping 3 README
|
||||
--------------
|
||||
|
||||
fping is a program to send ICMP echo probes to network hosts, similar to ping,
|
||||
but much better performing when pinging multiple hosts. fping has a long long
|
||||
story: Roland Schemers did publish a first version of it in 1992 and it has
|
||||
established itself since then as a standard tool.
|
||||
|
||||
Current maintainer:
|
||||
David Schweikert <david@schweikert.ch>
|
||||
|
||||
Website:
|
||||
http://fping.org/
|
||||
|
||||
Mailing-list:
|
||||
https://groups.google.com/group/fping-users
|
||||
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
AmigaOS maintainer Carsten Larsen (carsten.larsen@mail.com)
|
||||
Original author: Roland Schemers (schemers@stanford.edu)
|
||||
Previous maintainer: RL "Bob" Morgan (morgan@stanford.edu)
|
||||
Initial IPv6 Support: Jeroen Massar (jeroen@unfix.org / jeroen@ipng.nl)
|
||||
Other contributors: see ChangeLog
|
||||
@@ -0,0 +1,48 @@
|
||||
# Portable Makefile generated by configure
|
||||
|
||||
all: fping
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O2 -DAROS -I. -D_DEBUG -Wall -Werror
|
||||
LDLIBS = -lm
|
||||
|
||||
build_date.h:
|
||||
echo "#define BUILD_DATE \"$$(date -u)"\" >build_date.h
|
||||
|
||||
fping.h: mem.h
|
||||
touch fping.h
|
||||
|
||||
getaddrinfo.h: fping.h
|
||||
touch getaddrinfo.h
|
||||
|
||||
fping.o: fping.c build_date.h fping.h getaddrinfo.h options.h seqmap.h
|
||||
|
||||
fping_amiga.o: fping_amiga.c fping.h getaddrinfo.h
|
||||
|
||||
getaddrinfo.o: getaddrinfo.c fping.h getaddrinfo.h
|
||||
|
||||
ntop.o: ntop.c
|
||||
|
||||
pton.o: pton.c
|
||||
|
||||
seqmap.o: seqmap.c options.h seqmap.h
|
||||
|
||||
socket.o: socket.c fping.h
|
||||
|
||||
socket4.o: socket4.c fping.h
|
||||
|
||||
mem.o: mem.c mem.h
|
||||
|
||||
getopt.o: getopt.c getopt.h
|
||||
|
||||
rand.o: rand.c
|
||||
|
||||
|
||||
fping: fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o
|
||||
${CC} ${CFLAGS} -s -o fping fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o ${LDLIBS}
|
||||
|
||||
clean:
|
||||
rm -f fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o build_date.h fping
|
||||
|
||||
depend:
|
||||
@echo Dependencies already done
|
||||
@@ -0,0 +1,48 @@
|
||||
# Portable Makefile generated by configure
|
||||
|
||||
all: fping
|
||||
|
||||
CC = m68k-amigaos-gcc
|
||||
CFLAGS = -O2 -noixemul -DAOS3 -D_DEBUG -I. -I.. -Iinclude -Wall -Werror
|
||||
LDLIBS = -lm
|
||||
|
||||
build_date.h:
|
||||
echo "#define BUILD_DATE \"$$(date -u)"\" >build_date.h
|
||||
|
||||
fping.h: mem.h
|
||||
touch fping.h
|
||||
|
||||
getaddrinfo.h: fping.h
|
||||
touch getaddrinfo.h
|
||||
|
||||
fping.o: fping.c build_date.h fping.h getaddrinfo.h options.h seqmap.h
|
||||
|
||||
fping_amiga.o: fping_amiga.c fping.h getaddrinfo.h
|
||||
|
||||
getaddrinfo.o: getaddrinfo.c fping.h getaddrinfo.h
|
||||
|
||||
ntop.o: ntop.c
|
||||
|
||||
pton.o: pton.c
|
||||
|
||||
seqmap.o: seqmap.c options.h seqmap.h
|
||||
|
||||
socket.o: socket.c fping.h
|
||||
|
||||
socket4.o: socket4.c fping.h
|
||||
|
||||
mem.o: mem.c mem.h
|
||||
|
||||
getopt.o: getopt.c getopt.h
|
||||
|
||||
rand.o: rand.c
|
||||
|
||||
|
||||
fping: fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o
|
||||
${CC} ${CFLAGS} -s -o fping fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o ${LDLIBS}
|
||||
|
||||
clean:
|
||||
rm -f fping.o fping_amiga.o getaddrinfo.o ntop.o pton.o seqmap.o socket.o socket4.o mem.o getopt.o rand.o build_date.h fping
|
||||
|
||||
depend:
|
||||
@echo Dependencies already done
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2015, 16 Carsten Larsen
|
||||
# Copyright (c) 2014 Poul-Henning Kamp
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
HDRS='
|
||||
fping.h
|
||||
getaddrinfo.h
|
||||
options.h
|
||||
seqmap.h
|
||||
mem.h
|
||||
getopt.h
|
||||
'
|
||||
|
||||
SRCS='
|
||||
fping.c
|
||||
fping_amiga.c
|
||||
getaddrinfo.c
|
||||
ntop.c
|
||||
pton.c
|
||||
seqmap.c
|
||||
socket.c
|
||||
socket4.c
|
||||
mem.c
|
||||
getopt.c
|
||||
rand.c
|
||||
'
|
||||
|
||||
if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then
|
||||
echo "make is GNU make."
|
||||
VALID=true
|
||||
#else
|
||||
# echo "Wrong version of make."
|
||||
# VALID=false
|
||||
fi
|
||||
|
||||
if $VALID ; then
|
||||
(
|
||||
echo '# Portable Makefile generated by configure'
|
||||
echo ''
|
||||
echo 'all: fping'
|
||||
echo ''
|
||||
if [ -n "$2" ] && [ $2 = "DEBUG" ] ; then
|
||||
DEBUG="-D_DEBUG "
|
||||
fi
|
||||
if [ -n "$1" ] && [ $1 = "AMIGA" ] ; then
|
||||
echo 'CC = m68k-amigaos-gcc'
|
||||
echo "CFLAGS = -O2 -noixemul -DAOS3 ${DEBUG}-I. -I.. -Iinclude -Wall -Werror"
|
||||
echo "LDLIBS = -lm"
|
||||
elif [ -n "$1" ] && [ $1 = "AROS" ] ; then
|
||||
echo 'CC = gcc'
|
||||
echo "CFLAGS = -O2 -DAROS -I. ${DEBUG}-Wall -Werror"
|
||||
echo "LDLIBS = -lm"
|
||||
else
|
||||
echo "CFLAGS = -O2 -Wall -Werror"
|
||||
echo "LDLIBS = -lm"
|
||||
fi
|
||||
echo ''
|
||||
echo 'build_date.h:'
|
||||
echo ' echo "#define BUILD_DATE \"$$(date -u)"\" >build_date.h'
|
||||
echo ''
|
||||
|
||||
for f in ${HDRS}
|
||||
do
|
||||
b=`basename $f .h`
|
||||
i=`sed -n -e '/#include.*"/{
|
||||
s/"$//
|
||||
s/.*"//
|
||||
p
|
||||
}' $f | sort -u`
|
||||
if [ "x${i}" != "x" ] ; then
|
||||
echo "${b}.h: " ${i}
|
||||
echo " touch ${b}.h"
|
||||
echo
|
||||
fi
|
||||
done
|
||||
|
||||
l=""
|
||||
for f in ${SRCS}
|
||||
do
|
||||
b=`basename $f .c`
|
||||
i=`sed -n -e '/#include.*"/{
|
||||
s/"$//
|
||||
s/.*"//
|
||||
p
|
||||
}' $f | sort -u`
|
||||
echo "${b}.o: ${b}.c" ${i}
|
||||
echo
|
||||
l="${l} ${b}.o"
|
||||
done
|
||||
|
||||
echo
|
||||
echo "fping: ${l}"
|
||||
echo " \${CC} \${CFLAGS} -s -o fping ${l} \${LDLIBS}"
|
||||
echo
|
||||
echo "clean:"
|
||||
echo " rm -f ${l} build_date.h fping"
|
||||
echo
|
||||
echo "depend:"
|
||||
echo " @echo Dependencies already done"
|
||||
) > Makefile
|
||||
|
||||
echo "Makefile generated"
|
||||
fi
|
||||
+2398
File diff suppressed because it is too large
Load Diff
+155
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Written by Carsten Larsen.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#ifndef _FPING_H
|
||||
#define _FPING_H
|
||||
|
||||
#include <clib/dos_protos.h>
|
||||
#include <clib/exec_protos.h>
|
||||
#include <clib/alib_protos.h>
|
||||
#include <clib/timer_protos.h>
|
||||
#include <clib/utility_protos.h>
|
||||
#include <utility/date.h>
|
||||
#include <devices/timer.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "mem.h"
|
||||
#define calloc(x, y) allocmem(x*y)
|
||||
#define malloc(x) allocmem(x)
|
||||
#define free(x) freemem(x)
|
||||
|
||||
#ifdef AOS3
|
||||
# include <clib/amitcp_protos.h>
|
||||
# include <amitcp/socketbasetags.h>
|
||||
# include <machine/types.h>
|
||||
# define uint16_t u_int16_t
|
||||
# define IPTR ULONG
|
||||
# define ANSI_CONSOLE 1
|
||||
# define gettimeofday(x, y) getsystime(x)
|
||||
typedef unsigned int socklen_t;
|
||||
typedef unsigned int sa_family_t;
|
||||
#endif
|
||||
|
||||
typedef u_int16_t in_port_t;
|
||||
|
||||
#ifdef AROS
|
||||
# include <inttypes.h>
|
||||
# include <sys/time.h>
|
||||
# define Socket(a,b,c) socket(a,b,c)
|
||||
# define Bind(a,b,c) bind(a,b,c)
|
||||
# define RecvFrom(a,b,c,d,e,f) recvfrom(a,b,c,d,e,f)
|
||||
# define SendTo(a,b,c,d,e,f) sendto(a,b,c,d,e,f)
|
||||
#endif
|
||||
|
||||
#ifdef AOS3
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
socklen_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define FPING_SOCKADDR struct sockaddr_in
|
||||
|
||||
#ifndef IPV6
|
||||
# define FPING_INADDR struct in_addr
|
||||
# define FPING_ICMPHDR struct icmp
|
||||
#else
|
||||
# define FPING_INADDR struct in6_addr
|
||||
# define FPING_ICMPHDR struct icmp6_hdr
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
# define INADDR_NONE 0xffffffffU
|
||||
#endif
|
||||
|
||||
#ifndef PF_INET6
|
||||
# define PF_INET6 10
|
||||
#endif
|
||||
#ifndef AF_INET6
|
||||
# define AF_INET6 PF_INET6
|
||||
#endif
|
||||
|
||||
#ifndef INET_ADDRSTRLEN
|
||||
# define INET_ADDRSTRLEN 16
|
||||
#endif
|
||||
#ifndef INET6_ADDRSTRLEN
|
||||
# define INET6_ADDRSTRLEN 46
|
||||
#endif
|
||||
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
# define DEBUG_TEXT "b"
|
||||
#else
|
||||
# define DEBUG_TEXT ""
|
||||
#endif
|
||||
|
||||
#ifdef AOS3
|
||||
# define random() rand()
|
||||
# define srandom() srand()
|
||||
#endif
|
||||
|
||||
#define PACKAGE_NAME "fping"
|
||||
#define PACKAGE_VERSION "3.13"
|
||||
|
||||
/* No TTL (time to live) in socket options */
|
||||
#define NOTTL 1
|
||||
|
||||
/* No TOS (type of service) in socket options */
|
||||
#define NOTOS 1
|
||||
|
||||
#define SIGNAL ULONG
|
||||
|
||||
/* fping.c */
|
||||
void crash_and_burn( char *message );
|
||||
void errno_crash_and_burn( char *message );
|
||||
int in_cksum( unsigned short *p, int n );
|
||||
int random_data_flag;
|
||||
char *prog;
|
||||
unsigned int debugging;
|
||||
|
||||
/* socket.c */
|
||||
int open_ping_socket();
|
||||
void init_ping_buffer(size_t ping_data_size);
|
||||
void socket_set_src_addr(int s, FPING_INADDR src_addr);
|
||||
int socket_sendto_ping(int s, struct sockaddr *saddr, socklen_t saddr_len, uint16_t icmp_seq, uint16_t icmp_id);
|
||||
void close_ping_socket();
|
||||
void cleanup_ping_buffer();
|
||||
|
||||
/* inet_ntop.c */
|
||||
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
|
||||
|
||||
/* inet_pton.c */
|
||||
int inet_pton(int af, const char *src, void *dst);
|
||||
|
||||
/* fping_amiga.c */
|
||||
int open_libs();
|
||||
int getsystime(struct timeval *tv);
|
||||
|
||||
extern struct Library *SocketBase;
|
||||
extern int errno;
|
||||
|
||||
#ifndef AROS
|
||||
extern int h_errno;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Written by Carsten Larsen.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include "fping.h"
|
||||
#include "getaddrinfo.h"
|
||||
|
||||
#define OPEN_ERROR "Cannot open %s.\n"
|
||||
#define OPEN_VER_ERROR "Cannot open %s (%d.0)\n"
|
||||
#define DOSLIB_NAME "dos.library"
|
||||
#define DOSLIB_REV 37L
|
||||
#define BSDLIB_NAME "bsdsocket.library"
|
||||
#define BSDLIB_REV 03L
|
||||
#define UTILLIB_NAME "utility.library"
|
||||
#define UTILLIB_REV 37L
|
||||
#define TIMER_NAME TIMERNAME
|
||||
#define LIB_ERROR 4
|
||||
|
||||
const char *vers = "\0$VER: " PACKAGE_NAME " " PACKAGE_VERSION " (21.02.2016)";
|
||||
|
||||
#include <unistd.h>
|
||||
#ifdef AOS3
|
||||
uid_t getuid () {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int setuid (uid_t id) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int h_errno;
|
||||
#endif
|
||||
|
||||
struct Library* DOSBase = NULL;
|
||||
struct Library* SocketBase = NULL;
|
||||
struct Library* UtilityBase = NULL;
|
||||
struct Device* TimerBase = NULL;
|
||||
struct timerequest* TimeRequest = NULL;
|
||||
|
||||
int create_timer();
|
||||
void delete_timer();
|
||||
|
||||
void amiga_open_error(char *name)
|
||||
{
|
||||
printf(OPEN_ERROR, name);
|
||||
}
|
||||
|
||||
void amiga_open_lib_error(char *name, int version)
|
||||
{
|
||||
printf(OPEN_VER_ERROR, name, version);
|
||||
}
|
||||
|
||||
void close_libs()
|
||||
{
|
||||
close_ping_socket();
|
||||
cleanup_ping_buffer();
|
||||
|
||||
if (TimerBase != NULL) {
|
||||
delete_timer();
|
||||
}
|
||||
|
||||
if (UtilityBase != NULL) {
|
||||
CloseLibrary(UtilityBase);
|
||||
UtilityBase = NULL;
|
||||
}
|
||||
|
||||
if (SocketBase != NULL) {
|
||||
CloseLibrary(SocketBase);
|
||||
SocketBase = NULL;
|
||||
}
|
||||
|
||||
freeall();
|
||||
|
||||
if (DOSBase != NULL) {
|
||||
CloseLibrary(DOSBase);
|
||||
DOSBase = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int open_libs()
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
atexit(close_libs);
|
||||
InitSemaphore(&GetaddrinfoSemaphore);
|
||||
|
||||
if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) {
|
||||
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
|
||||
return LIB_ERROR;
|
||||
}
|
||||
|
||||
if(!(SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV))) {
|
||||
amiga_open_lib_error(BSDLIB_NAME, BSDLIB_REV);
|
||||
return LIB_ERROR;
|
||||
} else {
|
||||
SocketBaseTags(
|
||||
SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR) &errno,
|
||||
SBTM_SETVAL(SBTC_HERRNOLONGPTR), (IPTR) &h_errno,
|
||||
SBTM_SETVAL(SBTC_LOGTAGPTR), (IPTR) &prog,
|
||||
TAG_DONE );
|
||||
}
|
||||
|
||||
if(!(UtilityBase = OpenLibrary((STRPTR)UTILLIB_NAME, UTILLIB_REV))) {
|
||||
amiga_open_lib_error(UTILLIB_NAME, UTILLIB_REV);
|
||||
return LIB_ERROR;
|
||||
}
|
||||
|
||||
if (create_timer() != 0) {
|
||||
amiga_open_error(TIMER_NAME);
|
||||
return LIB_ERROR;
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
srand(tv.tv_usec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef AOS3
|
||||
int create_timer()
|
||||
{
|
||||
LONG error;
|
||||
struct MsgPort *port = CreatePort(0, 0);
|
||||
if (port == NULL)
|
||||
return 1;
|
||||
|
||||
TimeRequest = (struct timerequest*)CreateExtIO(port, sizeof(struct timerequest));
|
||||
if (TimeRequest == NULL)
|
||||
{
|
||||
DeletePort(port);
|
||||
return 1;
|
||||
}
|
||||
|
||||
error = OpenDevice(
|
||||
(STRPTR)TIMER_NAME, UNIT_MICROHZ,
|
||||
(struct IORequest*)TimeRequest, 0L
|
||||
);
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
delete_timer(TimeRequest);
|
||||
return 1;
|
||||
}
|
||||
|
||||
TimerBase = (struct Device*)TimeRequest->tr_node.io_Device;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void delete_timer()
|
||||
{
|
||||
struct MsgPort *port;
|
||||
if (TimeRequest == NULL)
|
||||
return;
|
||||
|
||||
port = TimeRequest->tr_node.io_Message.mn_ReplyPort;
|
||||
|
||||
if (port != 0)
|
||||
DeletePort(port);
|
||||
|
||||
CloseDevice((struct IORequest*)TimeRequest);
|
||||
DeleteExtIO((struct IORequest*)TimeRequest);
|
||||
}
|
||||
|
||||
int getsystime(struct timeval *tv)
|
||||
{
|
||||
struct timeval tv1;
|
||||
|
||||
GetSysTime(&tv1);
|
||||
*tv = tv1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int create_timer() { return 0; }
|
||||
void delete_timer() { }
|
||||
#endif
|
||||
@@ -0,0 +1,507 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 16 Carsten Larsen
|
||||
* Copyright (c) 2001, 02 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program provides getaddrinfo() and getnameinfo() described in
|
||||
* RFC2133, 2553 and 3493. These functions are mainly used for IPv6
|
||||
* application to resolve hostname or address.
|
||||
*
|
||||
* This program is designed to be working on traditional IPv4 systems
|
||||
* which don't have those functions. Therefore, this implementation
|
||||
* supports IPv4 only.
|
||||
*
|
||||
* This program is useful for application which should support both IPv6
|
||||
* and traditional IPv4 systems. Use genuine getaddrinfo() and getnameinfo()
|
||||
* provided by system if the system supports IPv6. Otherwise, use this
|
||||
* implementation.
|
||||
*
|
||||
* This program also provides freeaddrinfo() and gai_strerror().
|
||||
*
|
||||
* Restriction:
|
||||
* getaddrinfo() and getnameinfo() of this program are NOT thread
|
||||
* safe, unless the cpp macro ENABLE_PTHREAD is defined.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "fping.h"
|
||||
#include "getaddrinfo.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#define _(string) gettext(string)
|
||||
#ifdef gettext_noop
|
||||
#define N_(string) gettext_noop(string)
|
||||
#else
|
||||
#define N_(string) (string)
|
||||
#endif
|
||||
#else
|
||||
#define gettext(string) (string)
|
||||
#define _(string) (string)
|
||||
#define N_(string) (string)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Error messages for gai_strerror().
|
||||
*/
|
||||
static char *eai_errlist[] = {
|
||||
N_("Success"),
|
||||
|
||||
/* EAI_ADDRFAMILY */
|
||||
N_("Address family for hostname not supported"),
|
||||
|
||||
/* EAI_AGAIN */
|
||||
N_("Temporary failure in name resolution"),
|
||||
|
||||
/* EAI_BADFLAGS */
|
||||
N_("Invalid value for ai_flags"),
|
||||
|
||||
/* EAI_FAIL */
|
||||
N_("Non-recoverable failure in name resolution"),
|
||||
|
||||
/* EAI_FAMILY */
|
||||
N_("ai_family not supported"),
|
||||
|
||||
/* EAI_MEMORY */
|
||||
N_("Memory allocation failure"),
|
||||
|
||||
/* EAI_NONAME */
|
||||
N_("hostname nor servname provided, or not known"),
|
||||
|
||||
/* EAI_OVERFLOW */
|
||||
N_("An argument buffer overflowed"),
|
||||
|
||||
/* EAI_SERVICE */
|
||||
N_("servname not supported for ai_socktype"),
|
||||
|
||||
/* EAI_SOCKTYPE */
|
||||
N_("ai_socktype not supported"),
|
||||
|
||||
/* EAI_SYSTEM */
|
||||
N_("System error returned in errno")
|
||||
};
|
||||
|
||||
/*
|
||||
* Default hints for getaddrinfo().
|
||||
*/
|
||||
static struct addrinfo default_hints = {
|
||||
0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Mutex.
|
||||
*/
|
||||
struct SignalSemaphore GetaddrinfoSemaphore;
|
||||
|
||||
/*
|
||||
* Declaration of static functions.
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
static int is_integer(const char *);
|
||||
static int is_address(const char *);
|
||||
static int itoa_length(int);
|
||||
#else
|
||||
static int is_integer();
|
||||
static int is_address();
|
||||
static int itoa_length();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gai_strerror().
|
||||
*/
|
||||
const char *
|
||||
gai_strerror(ecode)
|
||||
int ecode;
|
||||
{
|
||||
if (ecode < 0 || ecode > EAI_SYSTEM)
|
||||
return _("Unknown error");
|
||||
|
||||
return gettext(eai_errlist[ecode]);
|
||||
}
|
||||
|
||||
/*
|
||||
* freeaddrinfo().
|
||||
*/
|
||||
void
|
||||
freeaddrinfo(ai)
|
||||
struct addrinfo *ai;
|
||||
{
|
||||
struct addrinfo *next_ai;
|
||||
|
||||
while (ai != NULL) {
|
||||
if (ai->ai_canonname != NULL)
|
||||
free(ai->ai_canonname);
|
||||
if (ai->ai_addr != NULL)
|
||||
free(ai->ai_addr);
|
||||
next_ai = ai->ai_next;
|
||||
free(ai);
|
||||
ai = next_ai;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 1 if the string `s' represents an integer.
|
||||
*/
|
||||
static int
|
||||
is_integer(s)
|
||||
const char *s;
|
||||
{
|
||||
if (*s == '-' || *s == '+')
|
||||
s++;
|
||||
if (*s < '0' || '9' < *s)
|
||||
return 0;
|
||||
|
||||
s++;
|
||||
while ('0' <= *s && *s <= '9')
|
||||
s++;
|
||||
|
||||
return (*s == '\0');
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 1 if the string `s' represents an IPv4 address.
|
||||
* Unlike inet_addr(), it doesn't permit malformed nortation such
|
||||
* as "192.168".
|
||||
*/
|
||||
static int
|
||||
is_address(s)
|
||||
const char *s;
|
||||
{
|
||||
const static char delimiters[] = {'.', '.', '.', '\0'};
|
||||
int i, j;
|
||||
int octet;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (*s == '0' && *(s + 1) != delimiters[i])
|
||||
return 0;
|
||||
for (j = 0, octet = 0; '0' <= *s && *s <= '9' && j < 3; s++, j++)
|
||||
octet = octet * 10 + (*s - '0');
|
||||
if (j == 0 || octet > 255 || *s != delimiters[i])
|
||||
return 0;
|
||||
s++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calcurate length of the string `s', where `s' is set by
|
||||
* sprintf(s, "%d", n).
|
||||
*/
|
||||
static int
|
||||
itoa_length(n)
|
||||
int n;
|
||||
{
|
||||
int result = 1;
|
||||
|
||||
if (n < 0) {
|
||||
n = -n;
|
||||
result++;
|
||||
}
|
||||
|
||||
while (n >= 10) {
|
||||
result++;
|
||||
n /= 10;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* getaddrinfo().
|
||||
*/
|
||||
int
|
||||
getaddrinfo(nodename, servname, hints, res)
|
||||
const char *nodename;
|
||||
const char *servname;
|
||||
const struct addrinfo *hints;
|
||||
struct addrinfo **res;
|
||||
{
|
||||
struct addrinfo *head_res = NULL;
|
||||
struct addrinfo *tail_res = NULL;
|
||||
struct addrinfo *new_res;
|
||||
struct sockaddr_in *sa_in;
|
||||
struct in_addr **addr_list;
|
||||
struct in_addr *addr_list_buf[2];
|
||||
struct in_addr addr_buf;
|
||||
struct in_addr **ap;
|
||||
struct servent *servent;
|
||||
struct hostent *hostent;
|
||||
const char *canonname = NULL;
|
||||
in_port_t port;
|
||||
int saved_h_errno;
|
||||
int result = 0;
|
||||
|
||||
ObtainSemaphore(&GetaddrinfoSemaphore);
|
||||
saved_h_errno = h_errno;
|
||||
|
||||
if (nodename == NULL && servname == NULL) {
|
||||
result = EAI_NONAME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (hints != NULL) {
|
||||
if (hints->ai_family != PF_INET && hints->ai_family != PF_UNSPEC) {
|
||||
result = EAI_FAMILY;
|
||||
goto end;
|
||||
}
|
||||
if (hints->ai_socktype != SOCK_DGRAM
|
||||
&& hints->ai_socktype != SOCK_STREAM
|
||||
&& hints->ai_socktype != 0) {
|
||||
result = EAI_SOCKTYPE;
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
hints = &default_hints;
|
||||
}
|
||||
|
||||
if (servname != NULL) {
|
||||
if (is_integer(servname))
|
||||
port = htons(atoi(servname));
|
||||
else {
|
||||
if (hints->ai_flags & AI_NUMERICSERV) {
|
||||
result = EAI_NONAME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (hints->ai_socktype == SOCK_DGRAM)
|
||||
servent = getservbyname((char*)servname, (char*)"udp");
|
||||
else if (hints->ai_socktype == SOCK_STREAM)
|
||||
servent = getservbyname((char*)servname, (char*)"tcp");
|
||||
else if (hints->ai_socktype == 0)
|
||||
servent = getservbyname((char*)servname, (char*)"tcp");
|
||||
else {
|
||||
result = EAI_SOCKTYPE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (servent == NULL) {
|
||||
result = EAI_SERVICE;
|
||||
goto end;
|
||||
}
|
||||
port = servent->s_port;
|
||||
}
|
||||
} else {
|
||||
port = htons(0);
|
||||
}
|
||||
|
||||
if (nodename != NULL) {
|
||||
if (is_address(nodename)) {
|
||||
addr_buf.s_addr = inet_addr(nodename);
|
||||
addr_list_buf[0] = &addr_buf;
|
||||
addr_list_buf[1] = NULL;
|
||||
addr_list = addr_list_buf;
|
||||
|
||||
if (hints->ai_flags & AI_CANONNAME
|
||||
&& !(hints->ai_flags & AI_NUMERICHOST)) {
|
||||
hostent = gethostbyaddr((char *)&addr_buf,
|
||||
sizeof(struct in_addr), AF_INET);
|
||||
if (hostent != NULL)
|
||||
canonname = hostent->h_name;
|
||||
else
|
||||
canonname = nodename;
|
||||
}
|
||||
} else {
|
||||
if (hints->ai_flags & AI_NUMERICHOST) {
|
||||
result = EAI_NONAME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
hostent = gethostbyname(nodename);
|
||||
if (hostent == NULL) {
|
||||
switch (h_errno) {
|
||||
case HOST_NOT_FOUND:
|
||||
case NO_DATA:
|
||||
result = EAI_NONAME;
|
||||
goto end;
|
||||
case TRY_AGAIN:
|
||||
result = EAI_AGAIN;
|
||||
goto end;
|
||||
default:
|
||||
result = EAI_FAIL;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
addr_list = (struct in_addr **)hostent->h_addr_list;
|
||||
|
||||
if (hints->ai_flags & AI_CANONNAME)
|
||||
canonname = hostent->h_name;
|
||||
}
|
||||
} else {
|
||||
if (hints->ai_flags & AI_PASSIVE)
|
||||
addr_buf.s_addr = htonl(INADDR_ANY);
|
||||
else
|
||||
addr_buf.s_addr = htonl(0x7F000001);
|
||||
addr_list_buf[0] = &addr_buf;
|
||||
addr_list_buf[1] = NULL;
|
||||
addr_list = addr_list_buf;
|
||||
}
|
||||
|
||||
for (ap = addr_list; *ap != NULL; ap++) {
|
||||
new_res = (struct addrinfo *)malloc(sizeof(struct addrinfo));
|
||||
if (new_res == NULL) {
|
||||
if (head_res != NULL)
|
||||
freeaddrinfo(head_res);
|
||||
result = EAI_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
|
||||
new_res->ai_family = PF_INET;
|
||||
new_res->ai_socktype = hints->ai_socktype;
|
||||
new_res->ai_protocol = hints->ai_protocol;
|
||||
new_res->ai_addr = NULL;
|
||||
new_res->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
new_res->ai_canonname = NULL;
|
||||
new_res->ai_next = NULL;
|
||||
|
||||
new_res->ai_addr = (struct sockaddr *)
|
||||
malloc(sizeof(struct sockaddr_in));
|
||||
if (new_res->ai_addr == NULL) {
|
||||
free(new_res);
|
||||
if (head_res != NULL)
|
||||
freeaddrinfo(head_res);
|
||||
result = EAI_MEMORY;
|
||||
goto end;
|
||||
}
|
||||
|
||||
sa_in = (struct sockaddr_in *)new_res->ai_addr;
|
||||
memset(sa_in, 0, sizeof(struct sockaddr_in));
|
||||
sa_in->sin_family = PF_INET;
|
||||
sa_in->sin_port = port;
|
||||
memcpy(&sa_in->sin_addr, *ap, sizeof(struct in_addr));
|
||||
|
||||
if (head_res == NULL)
|
||||
head_res = new_res;
|
||||
else
|
||||
tail_res->ai_next = new_res;
|
||||
tail_res = new_res;
|
||||
}
|
||||
|
||||
if (canonname != NULL && head_res != NULL) {
|
||||
head_res->ai_canonname = (char *)malloc(strlen(canonname) + 1);
|
||||
if (head_res->ai_canonname != NULL)
|
||||
strcpy(head_res->ai_canonname, canonname);
|
||||
}
|
||||
|
||||
*res = head_res;
|
||||
|
||||
end:
|
||||
h_errno = saved_h_errno;
|
||||
ReleaseSemaphore(&GetaddrinfoSemaphore);
|
||||
return result;
|
||||
}
|
||||
|
||||
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *node, socklen_t nodelen, char *serv, socklen_t servlen, int flags) {
|
||||
|
||||
const struct sockaddr_in *sa_in = (const struct sockaddr_in *)sa;
|
||||
struct hostent *hostent;
|
||||
struct servent *servent;
|
||||
char *ntoa_address;
|
||||
int saved_h_errno;
|
||||
int result = 0;
|
||||
|
||||
ObtainSemaphore(&GetaddrinfoSemaphore);
|
||||
saved_h_errno = h_errno;
|
||||
|
||||
if (sa_in->sin_family != PF_INET) {
|
||||
result = EAI_FAMILY;
|
||||
goto end;
|
||||
} else if (node == NULL && serv == NULL) {
|
||||
result = EAI_NONAME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (serv != NULL && servlen > 0) {
|
||||
if (flags & NI_NUMERICSERV)
|
||||
servent = NULL;
|
||||
else if (flags & NI_DGRAM)
|
||||
servent = getservbyport(sa_in->sin_port, "udp");
|
||||
else
|
||||
servent = getservbyport(sa_in->sin_port, "tcp");
|
||||
|
||||
if (servent != NULL) {
|
||||
if (servlen <= strlen(servent->s_name)) {
|
||||
result = EAI_OVERFLOW;
|
||||
goto end;
|
||||
}
|
||||
strcpy(serv, servent->s_name);
|
||||
} else {
|
||||
if (servlen <= itoa_length(ntohs(sa_in->sin_port))) {
|
||||
result = EAI_OVERFLOW;
|
||||
goto end;
|
||||
}
|
||||
sprintf(serv, "%d", ntohs(sa_in->sin_port));
|
||||
}
|
||||
}
|
||||
|
||||
if (node != NULL && nodelen > 0) {
|
||||
if (flags & NI_NUMERICHOST)
|
||||
hostent = NULL;
|
||||
else {
|
||||
hostent = gethostbyaddr((char *)&sa_in->sin_addr,
|
||||
sizeof(struct in_addr), AF_INET);
|
||||
}
|
||||
if (hostent != NULL) {
|
||||
if (nodelen <= strlen(hostent->h_name)) {
|
||||
result = EAI_OVERFLOW;
|
||||
goto end;
|
||||
}
|
||||
strcpy(node, hostent->h_name);
|
||||
} else {
|
||||
if (flags & NI_NAMEREQD) {
|
||||
result = EAI_NONAME;
|
||||
goto end;
|
||||
}
|
||||
ntoa_address = inet_ntoa(sa_in->sin_addr);
|
||||
if (nodelen <= strlen(ntoa_address)) {
|
||||
result = EAI_OVERFLOW;
|
||||
goto end;
|
||||
}
|
||||
strcpy(node, ntoa_address);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
h_errno = saved_h_errno;
|
||||
ReleaseSemaphore(&GetaddrinfoSemaphore);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 16 Carsten Larsen
|
||||
* Copyright (c) 2001, 02 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef INET_GETADDRINFO_H
|
||||
#define INET_GETADDRINFO_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "fping.h"
|
||||
|
||||
/********************************************************************/
|
||||
/*
|
||||
* Undefine all the macros.
|
||||
* <netdb.h> might defines some of them.
|
||||
*/
|
||||
#ifdef EAI_ADDRFAMILY
|
||||
#undef EAI_ADDRFAMILY
|
||||
#endif
|
||||
#ifdef EAI_AGAIN
|
||||
#undef EAI_AGAIN
|
||||
#endif
|
||||
#ifdef EAI_BADFLAGS
|
||||
#undef EAI_BADFLAGS
|
||||
#endif
|
||||
#ifdef EAI_FAIL
|
||||
#undef EAI_FAIL
|
||||
#endif
|
||||
#ifdef EAI_FAMILY
|
||||
#undef EAI_FAMILY
|
||||
#endif
|
||||
#ifdef EAI_MEMORY
|
||||
#undef EAI_MEMORY
|
||||
#endif
|
||||
#ifdef EAI_NONAME
|
||||
#undef EAI_NONAME
|
||||
#endif
|
||||
#ifdef EAI_OVERFLOW
|
||||
#undef EAI_OVERFLOW
|
||||
#endif
|
||||
#ifdef EAI_SERVICE
|
||||
#undef EAI_SERVICE
|
||||
#endif
|
||||
#ifdef EAI_SOCKTYPE
|
||||
#undef EAI_SOCKTYPE
|
||||
#endif
|
||||
#ifdef EAI_SYSTEM
|
||||
#undef EAI_SYSTEM
|
||||
#endif
|
||||
|
||||
#ifdef AI_PASSIVE
|
||||
#undef AI_PASSIVE
|
||||
#endif
|
||||
#ifdef AI_CANONNAME
|
||||
#undef AI_CANONNAME
|
||||
#endif
|
||||
#ifdef AI_NUMERICHOST
|
||||
#undef AI_NUMERICHOST
|
||||
#endif
|
||||
#ifdef AI_NUMERICSERV
|
||||
#undef AI_NUMERICSERV
|
||||
#endif
|
||||
#ifdef AI_V4MAPPED
|
||||
#undef AI_V4MAPPED
|
||||
#endif
|
||||
#ifdef AI_ALL
|
||||
#undef AI_ALL
|
||||
#endif
|
||||
#ifdef AI_ADDRCONFIG
|
||||
#undef AI_ADDRCONFIG
|
||||
#endif
|
||||
#ifdef AI_DEFAULT
|
||||
#undef AI_DEFAULT
|
||||
#endif
|
||||
|
||||
#ifdef NI_NOFQDN
|
||||
#undef NI_NOFQDN
|
||||
#endif
|
||||
#ifdef NI_NUMERICHOST
|
||||
#undef NI_NUMERICHOST
|
||||
#endif
|
||||
#ifdef NI_NAMEREQD
|
||||
#undef NI_NAMEREQD
|
||||
#endif
|
||||
#ifdef NI_NUMERICSERV
|
||||
#undef NI_NUMERICSERV
|
||||
#endif
|
||||
#ifdef NI_NUMERICSCOPE
|
||||
#undef NI_NUMERICSCOPE
|
||||
#endif
|
||||
|
||||
#ifdef NI_DGRAM
|
||||
#undef NI_DGRAM
|
||||
#endif
|
||||
#ifdef NI_MAXHOST
|
||||
#undef NI_MAXHOST
|
||||
#endif
|
||||
#ifdef NI_MAXSERV
|
||||
#undef NI_MAXSERV
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Fake struct and function names.
|
||||
* <netdb.h> might declares all or some of them.
|
||||
*/
|
||||
/*
|
||||
#if defined(HAVE_GETADDRINFO) || defined(HAVE_GETNAMEINFO)
|
||||
#define addrinfo my_addrinfo
|
||||
#define gai_strerror my_gai_strerror
|
||||
#define freeaddrinfo my_freeaddrinfo
|
||||
#define getaddrinfo my_getaddrinfo
|
||||
#define getnameinfo my_getnameinfo
|
||||
#endif
|
||||
*/
|
||||
|
||||
/********************************************************************/
|
||||
/*
|
||||
* Error codes.
|
||||
*/
|
||||
#define EAI_ADDRFAMILY 1
|
||||
#define EAI_AGAIN 2
|
||||
#define EAI_BADFLAGS 3
|
||||
#define EAI_FAIL 4
|
||||
#define EAI_FAMILY 5
|
||||
#define EAI_MEMORY 6
|
||||
#define EAI_NONAME 7
|
||||
#define EAI_OVERFLOW 8
|
||||
#define EAI_SERVICE 9
|
||||
#define EAI_SOCKTYPE 10
|
||||
#define EAI_SYSTEM 11
|
||||
|
||||
/*
|
||||
* Flags for getaddrinfo().
|
||||
*/
|
||||
#define AI_ADDRCONFIG 0x0001
|
||||
#define AI_ALL 0x0002
|
||||
#define AI_CANONNAME 0x0004
|
||||
#define AI_NUMERICHOST 0x0008
|
||||
#define AI_NUMERICSERV 0x0010
|
||||
#define AI_PASSIVE 0x0020
|
||||
#define AI_V4MAPPED 0x0040
|
||||
#define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
|
||||
|
||||
/*
|
||||
* Flags for getnameinfo().
|
||||
*/
|
||||
#define NI_DGRAM 0x0001
|
||||
#define NI_NAMEREQD 0x0002
|
||||
#define NI_NOFQDN 0x0004
|
||||
#define NI_NUMERICHOST 0x0008
|
||||
#define NI_NUMERICSCOPE 0x0010
|
||||
#define NI_NUMERICSERV 0x0020
|
||||
|
||||
/*
|
||||
* Maximum length of FQDN and servie name for getnameinfo().
|
||||
*/
|
||||
#define NI_MAXHOST 1025
|
||||
#define NI_MAXSERV 32
|
||||
|
||||
/*
|
||||
* Address families and Protocol families.
|
||||
*/
|
||||
#if 0
|
||||
#ifndef AF_UNSPEC
|
||||
#define AF_UNSPEC AF_INET
|
||||
#endif
|
||||
#ifndef PF_UNSPEC
|
||||
#define PF_UNSPEC PF_INET
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <exec/types.h>
|
||||
extern struct SignalSemaphore GetaddrinfoSemaphore;
|
||||
|
||||
const char* gai_strerror(int);
|
||||
void freeaddrinfo(struct addrinfo *);
|
||||
int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
|
||||
int getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);
|
||||
|
||||
#endif
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* getopt.c --
|
||||
*
|
||||
* Standard UNIX getopt function. Code is from BSD.
|
||||
*
|
||||
* Copyright (c) 1987-2002 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* A. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* B. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* C. Neither the names of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* #if !defined(lint)
|
||||
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
|
||||
* #endif
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt, /* character checked for validity */
|
||||
optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt( int nargc,
|
||||
char * const *nargv,
|
||||
const char *ostr)
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (EOF);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return (EOF);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = (char*) strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means EOF.
|
||||
*/
|
||||
if (optopt == (int)'-')
|
||||
return (EOF);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
(void)fprintf(stderr,
|
||||
"illegal option -- %c\n", optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
}
|
||||
else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
return (BADARG);
|
||||
if (opterr)
|
||||
(void)fprintf(stderr,
|
||||
"option requires an argument -- %c\n",
|
||||
optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef _HAD_GETOPT_H
|
||||
#define _HAD_GETOPT_H
|
||||
|
||||
/*
|
||||
getopt.h -- header for getopt() replacement function
|
||||
Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner
|
||||
|
||||
This file is part of libzip, a library to manipulate ZIP archives.
|
||||
The authors can be contacted at <libzip@nih.at>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern int opterr;
|
||||
|
||||
extern int getopt(int, char * const *, const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _HAD_GETOPT_H */
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Carsten Larsen
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SOCKET_AMITCP_H
|
||||
#define _SOCKET_AMITCP_H
|
||||
//--------------------------------------------------------------------------//
|
||||
#define AMITCP_BASE_NAME SocketBase
|
||||
#include "inline/amitcp.h"
|
||||
//--------------------------------------------------------------------------//
|
||||
#define socket Socket
|
||||
#define bind Bind
|
||||
#define listen Listen
|
||||
#define accept Accept
|
||||
#define connect Connect
|
||||
#define send Send
|
||||
#define sendto SendTo
|
||||
#define sendmsg SendMsg
|
||||
#define recv Recv
|
||||
#define recvfrom RecvFrom
|
||||
#define recvmsg RecvMsg
|
||||
#define select Select
|
||||
#define shutdown ShutDown
|
||||
#define setsockopt SetSockOpt
|
||||
#define getsockopt GetSockOpt
|
||||
#define getsockname GetSockName
|
||||
#define getpeername GetPeerName
|
||||
#define inet_addr Inet_Addr
|
||||
#define inet_network Inet_Network
|
||||
#define inet_ntoa Inet_NtoA
|
||||
#define gethostbyname GetHostByName
|
||||
#define gethostbyaddr GetHostByAddr
|
||||
#define getnetbyname GetNetByName
|
||||
#define getnetbyaddr GetNetByAddr
|
||||
#define getservbyname GetServByName
|
||||
#define getservbyport GetServByPort
|
||||
#define getprotobyname GetProtoByName
|
||||
#define getprotobynumber GetProtoByNumber
|
||||
#define getdtablesize GetDTableSize
|
||||
#define gethostname GetHostName
|
||||
#define gethostid GetHostId
|
||||
#define vsyslog SyslogA
|
||||
#define syslog Syslog
|
||||
//--------------------------------------------------------------------------//
|
||||
#define Accept TCP_Accept
|
||||
#define Bind TCP_Bind
|
||||
#define CloseSocket TCP_CloseSocket
|
||||
#define Connect TCP_Connect
|
||||
#define Dup2Socket TCP_Dup2Socket
|
||||
#define Errno TCP_Errno
|
||||
#define GetDTableSize TCP_GetDTableSize
|
||||
#define GetHostByAddr TCP_GetHostByAddr
|
||||
#define GetHostByName TCP_GetHostByName
|
||||
#define GetHostId TCP_GetHostId
|
||||
#define GetHostName TCP_GetHostName
|
||||
#define GetNetByAddr TCP_GetNetByAddr
|
||||
#define GetNetByName TCP_GetNetByName
|
||||
#define GetPeerName TCP_GetPeerName
|
||||
#define GetProtoByName TCP_GetProtoByName
|
||||
#define GetProtoByNumber TCP_GetProtoByNumber
|
||||
#define GetServByName TCP_GetServByName
|
||||
#define GetServByPort TCP_GetServByPort
|
||||
#define GetSockName TCP_GetSockName
|
||||
#define GetSockOpt TCP_GetSockOpt
|
||||
#define GetSocketEvents TCP_GetSocketEvents
|
||||
#define Inet_Addr TCP_Inet_Addr
|
||||
#define Inet_LnaOf TCP_Inet_LnaOf
|
||||
#define Inet_MakeAddr TCP_Inet_MakeAddr
|
||||
#define Inet_NetOf TCP_Inet_NetOf
|
||||
#define Inet_Network TCP_Inet_Network
|
||||
#define Inet_NtoA(x) TCP_Inet_NtoA((x).s_addr)
|
||||
#define IoctlSocket TCP_IoctlSocket
|
||||
#define Listen TCP_Listen
|
||||
#define ObtainSocket TCP_ObtainSocket
|
||||
#define Recv TCP_Recv
|
||||
#define RecvFrom TCP_RecvFrom
|
||||
#define RecvMsg TCP_RecvMsg
|
||||
#define ReleaseCopyOfSocket TCP_ReleaseCopyOfSocket
|
||||
#define ReleaseSocket TCP_ReleaseSocket
|
||||
#define Send TCP_Send
|
||||
#define SendMsg TCP_SendMsg
|
||||
#define SendTo TCP_SendTo
|
||||
#define SetErrnoPtr TCP_SetErrnoPtr
|
||||
#define SetSockOpt TCP_SetSockOpt
|
||||
#define SetSocketSignals TCP_SetSocketSignals
|
||||
#define ShutDown TCP_ShutDown
|
||||
#define Socket TCP_Socket
|
||||
#define SocketBaseTagList TCP_SocketBaseTagList
|
||||
#define SocketBaseTags TCP_SocketBaseTags
|
||||
#define SyslogA TCP_SyslogA
|
||||
#define WaitSelect TCP_WaitSelect
|
||||
#define Select(n,r,w,e,t) TCP_WaitSelect(n,r,w,e,t,0)
|
||||
//--------------------------------------------------------------------------//
|
||||
#endif
|
||||
@@ -0,0 +1,203 @@
|
||||
/* Automatically generated header! Do not edit! */
|
||||
|
||||
#ifndef _INLINE_AMITCP_H
|
||||
#define _INLINE_AMITCP_H
|
||||
|
||||
#ifndef __INLINE_MACROS_H
|
||||
#include <inline/macros.h>
|
||||
#endif /* !__INLINE_MACROS_H */
|
||||
|
||||
#ifndef AMITCP_BASE_NAME
|
||||
#define AMITCP_BASE_NAME lss->lx_BsdSocketBase
|
||||
#endif /* !AMITCP_BASE_NAME */
|
||||
|
||||
#define TCP_Accept(s, addr, addrlen) \
|
||||
LP3(0x30, LONG, TCP_Accept, LONG, s, d0, struct sockaddr *, addr, a0, int *, addrlen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Bind(s, name, namelen) \
|
||||
LP3(0x24, LONG, TCP_Bind, LONG, s, d0, const struct sockaddr *, name, a0, LONG, namelen, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_CloseSocket(d) \
|
||||
LP1(0x78, LONG, TCP_CloseSocket, LONG, d, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Connect(s, name, namelen) \
|
||||
LP3(0x36, LONG, TCP_Connect, LONG, s, d0, const struct sockaddr *, name, a0, LONG, namelen, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Dup2Socket(fd1, fd2) \
|
||||
LP2(0x108, LONG, TCP_Dup2Socket, LONG, fd1, d0, LONG, fd2, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Errno() \
|
||||
LP0(0xa2, LONG, TCP_Errno, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetDTableSize() \
|
||||
LP0(0x8a, LONG, TCP_GetDTableSize, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostByAddr(addr, len, type) \
|
||||
LP3(0xd8, struct hostent *, TCP_GetHostByAddr, const UBYTE *, addr, a0, LONG, len, d0, LONG, type, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostByName(name) \
|
||||
LP1(0xd2, struct hostent *, TCP_GetHostByName, const UBYTE *, name, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostId() \
|
||||
LP0(0x120, ULONG, TCP_GetHostId, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetHostName(hostname, size) \
|
||||
LP2(0x11a, LONG, TCP_GetHostName, STRPTR, hostname, a0, LONG, size, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetNetByAddr(net, type) \
|
||||
LP2(0xe4, struct netent *, TCP_GetNetByAddr, LONG, net, d0, LONG, type, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetNetByName(name) \
|
||||
LP1(0xde, struct netent *, TCP_GetNetByName, const UBYTE *, name, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetPeerName(s, hostname, namelen) \
|
||||
LP3(0x6c, LONG, TCP_GetPeerName, LONG, s, d0, struct sockaddr *, hostname, a0, int *, namelen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetProtoByName(name) \
|
||||
LP1(0xf6, struct protoent *, TCP_GetProtoByName, const UBYTE *, name, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetProtoByNumber(proto) \
|
||||
LP1(0xfc, struct protoent *, TCP_GetProtoByNumber, LONG, proto, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetServByName(name, proto) \
|
||||
LP2(0xea, struct servent *, TCP_GetServByName, const UBYTE *, name, a0, const UBYTE *, proto, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetServByPort(port, proto) \
|
||||
LP2(0xf0, struct servent *, TCP_GetServByPort, LONG, port, d0, const UBYTE *, proto, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetSockName(s, hostname, namelen) \
|
||||
LP3(0x66, LONG, TCP_GetSockName, LONG, s, d0, struct sockaddr *, hostname, a0, int *, namelen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetSockOpt(s, level, optname, optval, optlen) \
|
||||
LP5(0x60, LONG, TCP_GetSockOpt, LONG, s, d0, LONG, level, d1, LONG, optname, d2, void *, optval, a0, int *, optlen, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_GetSocketEvents(eventmaskp) \
|
||||
LP1(0x12c, LONG, TCP_GetSocketEvents, ULONG *, eventmaskp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_Addr(cp) \
|
||||
LP1(0xb4, ULONG, TCP_Inet_Addr, const UBYTE *, cp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_LnaOf(in) \
|
||||
LP1(0xba, ULONG, TCP_Inet_LnaOf, LONG, in, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_MakeAddr(net, host) \
|
||||
LP2(0xc6, ULONG, TCP_Inet_MakeAddr, ULONG, net, d0, ULONG, host, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_NetOf(in) \
|
||||
LP1(0xc0, ULONG, TCP_Inet_NetOf, LONG, in, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_Network(cp) \
|
||||
LP1(0xcc, ULONG, TCP_Inet_Network, const UBYTE *, cp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Inet_NtoA(in) \
|
||||
LP1(0xae, char *, TCP_Inet_NtoA, ULONG, in, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_IoctlSocket(d, request, argp) \
|
||||
LP3(0x72, LONG, TCP_IoctlSocket, LONG, d, d0, ULONG, request, d1, char *, argp, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Listen(s, backlog) \
|
||||
LP2(0x2a, LONG, TCP_Listen, LONG, s, d0, LONG, backlog, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ObtainSocket(id, domain, type, protocol) \
|
||||
LP4(0x90, LONG, TCP_ObtainSocket, LONG, id, d0, LONG, domain, d1, LONG, type, d2, LONG, protocol, d3, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Recv(s, buf, len, flags) \
|
||||
LP4(0x4e, LONG, TCP_Recv, LONG, s, d0, UBYTE *, buf, a0, LONG, len, d1, LONG, flags, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_RecvFrom(s, buf, len, flags, from, fromlen) \
|
||||
LP6(0x48, LONG, TCP_RecvFrom, LONG, s, d0, UBYTE *, buf, a0, LONG, len, d1, LONG, flags, d2, struct sockaddr *, from, a1, int *, fromlen, a2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_RecvMsg(s, msg, flags) \
|
||||
LP3(0x114, LONG, TCP_RecvMsg, LONG, s, d0, struct msghdr *, msg, a0, LONG, flags, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ReleaseCopyOfSocket(fd, id) \
|
||||
LP2(0x9c, LONG, TCP_ReleaseCopyOfSocket, LONG, fd, d0, LONG, id, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ReleaseSocket(fd, id) \
|
||||
LP2(0x96, LONG, TCP_ReleaseSocket, LONG, fd, d0, LONG, id, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Send(s, msg, len, flags) \
|
||||
LP4(0x42, LONG, TCP_Send, LONG, s, d0, const UBYTE *, msg, a0, LONG, len, d1, LONG, flags, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SendMsg(s, msg, flags) \
|
||||
LP3(0x10e, LONG, TCP_SendMsg, LONG, s, d0, const struct msghdr *, msg, a0, LONG, flags, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SendTo(s, msg, len, flags, to, tolen) \
|
||||
LP6(0x3c, LONG, TCP_SendTo, LONG, s, d0, const UBYTE *, msg, a0, LONG, len, d1, LONG, flags, d2, const struct sockaddr *, to, a1, LONG, tolen, d3, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SetErrnoPtr(errno_p, size) \
|
||||
LP2(0xa8, LONG, TCP_SetErrnoPtr, void *, errno_p, a0, LONG, size, d0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SetSockOpt(s, level, optname, optval, optlen) \
|
||||
LP5(0x5a, LONG, TCP_SetSockOpt, LONG, s, d0, LONG, level, d1, LONG, optname, d2, const void *, optval, a0, LONG, optlen, d3, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SetSocketSignals(SIGINTR, SIGIO, SIGURG) \
|
||||
LP3NR(0x84, TCP_SetSocketSignals, ULONG, SIGINTR, d0, ULONG, SIGIO, d1, ULONG, SIGURG, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_ShutDown(s, how) \
|
||||
LP2(0x54, LONG, TCP_ShutDown, LONG, s, d0, LONG, how, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_Socket(domain, type, protocol) \
|
||||
LP3(0x1e, LONG, TCP_Socket, LONG, domain, d0, LONG, type, d1, LONG, protocol, d2, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_SocketBaseTagList(taglist) \
|
||||
LP1(0x126, LONG, TCP_SocketBaseTagList, struct TagItem *, taglist, a0, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#ifndef NO_INLINE_STDARG
|
||||
#define TCP_SocketBaseTags(tags...) \
|
||||
({ULONG _tags[] = { tags }; TCP_SocketBaseTagList((struct TagItem *)_tags);})
|
||||
#endif
|
||||
|
||||
#define TCP_SyslogA(level, format, ap) \
|
||||
LP3NR(0x102, TCP_SyslogA, ULONG, level, d0, const char *, format, a0, va_list, ap, a1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#define TCP_WaitSelect(nfds, readfds, writefds, execptfds, timeout, maskp) \
|
||||
LP6(0x7e, LONG, TCP_WaitSelect, LONG, nfds, d0, fd_set *, readfds, a0, fd_set *, writefds, a1, fd_set *, execptfds, a2, struct timeval *, timeout, a3, ULONG *, maskp, d1, \
|
||||
, AMITCP_BASE_NAME)
|
||||
|
||||
#endif /* !_INLINE_AMITCP_H */
|
||||
@@ -0,0 +1,253 @@
|
||||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain. //
|
||||
//--------------------------------------------------------------------------//
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <exec/io.h>
|
||||
#include <exec/types.h>
|
||||
#include <exec/memory.h>
|
||||
#include <exec/semaphores.h>
|
||||
#include <clib/exec_protos.h>
|
||||
//--------------------------------------------------------------------------//
|
||||
#include "mem.h"
|
||||
//--------------------------------------------------------------------------//
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
# include <stdio.h>
|
||||
# define DBG_MEMORY 128
|
||||
# define DBG_MEMORY_ADDR 256
|
||||
#endif
|
||||
//--------------------------------------------------------------------------//
|
||||
struct MemoryBlock
|
||||
{
|
||||
struct MemoryBlock *next;
|
||||
size_t size;
|
||||
void *address;
|
||||
};
|
||||
//--------------------------------------------------------------------------//
|
||||
struct MemoryList
|
||||
{
|
||||
struct MemoryBlock *first;
|
||||
struct MemoryBlock *last;
|
||||
long size;
|
||||
long count;
|
||||
long opcount;
|
||||
};
|
||||
//--------------------------------------------------------------------------//
|
||||
static struct MemoryList *list = NULL;
|
||||
//--------------------------------------------------------------------------//
|
||||
void allocerror(char*, size_t);
|
||||
void deallocerror(char*, void*);
|
||||
//--------------------------------------------------------------------------//
|
||||
void* allocmem(size_t size)
|
||||
{
|
||||
struct MemoryBlock *newblock;
|
||||
size_t allocsize;
|
||||
|
||||
if (list == NULL) {
|
||||
list =
|
||||
(struct MemoryList*)
|
||||
AllocVec(sizeof(struct MemoryList), MEMF_ANY | MEMF_CLEAR);
|
||||
|
||||
if (!list) {
|
||||
allocerror("list", sizeof(struct MemoryList));
|
||||
return 0;
|
||||
}
|
||||
|
||||
list->first = NULL;
|
||||
list->last = NULL;
|
||||
list->size = 0;
|
||||
list->count = 0;
|
||||
}
|
||||
|
||||
// Align to bytes of 4
|
||||
allocsize = (size + 3) & ~0x03;
|
||||
|
||||
newblock =
|
||||
(struct MemoryBlock*)
|
||||
AllocVec(sizeof(struct MemoryBlock), MEMF_ANY | MEMF_CLEAR);
|
||||
|
||||
if (!newblock) {
|
||||
allocerror("block", sizeof(struct MemoryBlock));
|
||||
return 0;
|
||||
}
|
||||
|
||||
newblock->address =
|
||||
(struct MemoryBlock*)
|
||||
AllocVec(allocsize, MEMF_ANY | MEMF_CLEAR);
|
||||
|
||||
if (!newblock->address) {
|
||||
FreeVec(newblock);
|
||||
allocerror("memory", allocsize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
newblock->size = allocsize;
|
||||
newblock->next = NULL;
|
||||
|
||||
if(list->first == NULL) {
|
||||
list->first = newblock;
|
||||
list->last = newblock;
|
||||
} else {
|
||||
list->last->next = newblock;
|
||||
list->last = newblock;
|
||||
}
|
||||
|
||||
list->size += allocsize;
|
||||
list->count++;
|
||||
|
||||
list->opcount++;
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if ( debugging & DBG_MEMORY_ADDR && list->opcount % 25 == 0) {
|
||||
fprintf(stderr,
|
||||
"Memory usage: %ld bytes allocated in %ld blocks.\n",
|
||||
list->size,
|
||||
list->count
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if( debugging & DBG_MEMORY_ADDR )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Memory allocated at address (%X)\n",
|
||||
(unsigned int)newblock->address);
|
||||
}
|
||||
#endif
|
||||
|
||||
return newblock->address;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
void freemem(void* block)
|
||||
{
|
||||
struct MemoryBlock *current, *last;
|
||||
|
||||
if (list == NULL || block == NULL) {
|
||||
deallocerror("list", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (block == NULL) {
|
||||
deallocerror("memory", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
last = NULL;
|
||||
current = list->first;
|
||||
while (current != NULL && current->address != block) {
|
||||
last = current;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
if (current == NULL) {
|
||||
deallocerror("address not found", block);
|
||||
return;
|
||||
}
|
||||
|
||||
list->size -= current->size;
|
||||
list->count--;
|
||||
|
||||
if (list->first == current) {
|
||||
list->first = NULL;
|
||||
list->last = NULL;
|
||||
} else if (list->last == current) {
|
||||
last->next = current->next;
|
||||
list->last = last;
|
||||
} else {
|
||||
last->next = current->next;
|
||||
}
|
||||
|
||||
FreeVec(current->address);
|
||||
FreeVec(current);
|
||||
|
||||
list->opcount++;
|
||||
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if( debugging & DBG_MEMORY_ADDR )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Memory deallocated at address (%X)\n",
|
||||
(unsigned int)block);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void freeall()
|
||||
{
|
||||
struct MemoryBlock *current, *next;
|
||||
|
||||
if (list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if( debugging & DBG_MEMORY )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Cleaning up (%ld) bytes in (%ld) blocks.\n",
|
||||
list->size,
|
||||
list->count
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
current = list->first;
|
||||
while (current != NULL) {
|
||||
next = current->next;
|
||||
FreeVec(current->address);
|
||||
FreeVec(current);
|
||||
current = next;
|
||||
}
|
||||
|
||||
FreeVec(list);
|
||||
list = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
void allocerror(char *descr, size_t size)
|
||||
{
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if( debugging & DBG_MEMORY_ADDR )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Memory allocation error (%s) with size (%ld)\n",
|
||||
descr,
|
||||
size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void deallocerror(char *descr, void *p)
|
||||
{
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
if( debugging & DBG_MEMORY_ADDR )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Memory deallocation error (%s) address (%X)\n",
|
||||
descr,
|
||||
(unsigned int)p);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
char *strdup(const char *s1)
|
||||
{
|
||||
char *s2;
|
||||
size_t len = strlen(s1);
|
||||
s2 = allocmem(++len);
|
||||
|
||||
if(s2 == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(s2, s1, --len);
|
||||
return s2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
@@ -0,0 +1,18 @@
|
||||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain. //
|
||||
//--------------------------------------------------------------------------//
|
||||
#ifndef AMIGA_MEM_H
|
||||
#define AMIGA_MEM_H
|
||||
//--------------------------------------------------------------------------//
|
||||
#include <stddef.h>
|
||||
//--------------------------------------------------------------------------//
|
||||
void* allocmem(size_t);
|
||||
void freemem(void*);
|
||||
void freeall();
|
||||
//--------------------------------------------------------------------------//
|
||||
#define strdup(s) managed_strdup(s)
|
||||
char *strdup(const char *s1);
|
||||
//--------------------------------------------------------------------------//
|
||||
extern unsigned int debugging;
|
||||
//--------------------------------------------------------------------------//
|
||||
#endif
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2016 - Carsten Larsen
|
||||
* Copyright (c) 1999 - 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Heimdal: inet_ntop.c 21005 2007-06-08 01:54:35Z lha $
|
||||
* $NetBSD: inet_ntop.c,v 1.2 2008/03/22 08:37:21 mlelstv Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifndef INET_ADDRSTRLEN
|
||||
# define INET_ADDRSTRLEN 16
|
||||
#endif
|
||||
|
||||
static const char *
|
||||
inet_ntop_v4 (const void *src, char *dst, size_t size)
|
||||
{
|
||||
const char digits[] = "0123456789";
|
||||
int i;
|
||||
struct in_addr *addr = (struct in_addr *)src;
|
||||
u_long a = ntohl(addr->s_addr);
|
||||
const char *orig_dst = dst;
|
||||
|
||||
if (size < INET_ADDRSTRLEN) {
|
||||
errno = ENOSPC;
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < 4; ++i) {
|
||||
int n = (a >> (24 - i * 8)) & 0xFF;
|
||||
int non_zerop = 0;
|
||||
|
||||
if (non_zerop || n / 100 > 0) {
|
||||
*dst++ = digits[n / 100];
|
||||
n %= 100;
|
||||
non_zerop = 1;
|
||||
}
|
||||
if (non_zerop || n / 10 > 0) {
|
||||
*dst++ = digits[n / 10];
|
||||
n %= 10;
|
||||
non_zerop = 1;
|
||||
}
|
||||
*dst++ = digits[n];
|
||||
if (i != 3)
|
||||
*dst++ = '.';
|
||||
}
|
||||
*dst++ = '\0';
|
||||
return orig_dst;
|
||||
}
|
||||
|
||||
#ifdef IPV6
|
||||
static const char *
|
||||
inet_ntop_v6 (const void *src, char *dst, size_t size)
|
||||
{
|
||||
const char xdigits[] = "0123456789abcdef";
|
||||
int i;
|
||||
const struct in6_addr *addr = (struct in6_addr *)src;
|
||||
const u_char *ptr = addr->s6_addr;
|
||||
const char *orig_dst = dst;
|
||||
|
||||
if (size < INET6_ADDRSTRLEN) {
|
||||
errno = ENOSPC;
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < 8; ++i) {
|
||||
int non_zerop = 0;
|
||||
|
||||
if (non_zerop || (ptr[0] >> 4)) {
|
||||
*dst++ = xdigits[ptr[0] >> 4];
|
||||
non_zerop = 1;
|
||||
}
|
||||
if (non_zerop || (ptr[0] & 0x0F)) {
|
||||
*dst++ = xdigits[ptr[0] & 0x0F];
|
||||
non_zerop = 1;
|
||||
}
|
||||
if (non_zerop || (ptr[1] >> 4)) {
|
||||
*dst++ = xdigits[ptr[1] >> 4];
|
||||
non_zerop = 1;
|
||||
}
|
||||
*dst++ = xdigits[ptr[1] & 0x0F];
|
||||
if (i != 7)
|
||||
*dst++ = ':';
|
||||
ptr += 2;
|
||||
}
|
||||
*dst++ = '\0';
|
||||
return orig_dst;
|
||||
}
|
||||
#endif /* IPV6 */
|
||||
|
||||
const char *
|
||||
inet_ntop(int af, const void *src, char *dst, size_t size)
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET :
|
||||
return inet_ntop_v4 (src, dst, size);
|
||||
#ifdef IPV6
|
||||
case AF_INET6 :
|
||||
return inet_ntop_v6 (src, dst, size);
|
||||
#endif
|
||||
default :
|
||||
errno = EAFNOSUPPORT;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+10
-13
@@ -1,20 +1,20 @@
|
||||
|
||||
/*
|
||||
* Interval is the minimum amount of time between sending a ping packet to
|
||||
/*
|
||||
* Interval is the minimum amount of time between sending a ping packet to
|
||||
* any host.
|
||||
*
|
||||
* Perhost_interval is the minimum amount of time between sending a ping
|
||||
*
|
||||
* Perhost_interval is the minimum amount of time between sending a ping
|
||||
* packet to a particular responding host (when count is > 1)
|
||||
*
|
||||
*
|
||||
* Timeout is the initial amount of time between sending a ping packet to
|
||||
* a particular non-responding host.
|
||||
*
|
||||
*
|
||||
* Retry is the number of ping packets to send to a non-responding host
|
||||
* before giving up (in is-it-alive mode).
|
||||
*
|
||||
*
|
||||
* Backoff factor is how much longer to wait on successive retries.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* constants */
|
||||
@@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DEFAULT_RETRY
|
||||
#ifndef DEFAULT_RETRY
|
||||
#define DEFAULT_RETRY 3 /* number of times to retry a host */
|
||||
#endif
|
||||
|
||||
@@ -49,6 +49,3 @@
|
||||
#ifndef DNS_TIMEOUT
|
||||
#define DNS_TIMEOUT 1000 /* time in micro_sec for dns retry */
|
||||
#endif
|
||||
|
||||
/* NIS_GROUPS allows input name to be an NIS netgroup name */
|
||||
/* #define NIS_GROUPS=1 */
|
||||
+304
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Copyright (c) 2016 by Carsten Larsen
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 1996,1999 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*
|
||||
* $NetBSD: inet_pton.c,v 1.9 2007/07/23 11:45:52 lukem Exp $
|
||||
* from NetBSD: inet_pton.c,v 1.3 2006/09/26 05:59:18 lukem Exp
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifndef uint32_t
|
||||
# define uint32_t u_int32_t
|
||||
#endif
|
||||
|
||||
#if !defined(NS_INADDRSZ)
|
||||
# define NS_INADDRSZ 4
|
||||
#endif
|
||||
#if !defined(NS_IN6ADDRSZ)
|
||||
# define NS_IN6ADDRSZ 16
|
||||
#endif
|
||||
#if !defined(NS_INT16SZ)
|
||||
# define NS_INT16SZ 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARNING: Don't even consider trying to compile this on a system where
|
||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||
*/
|
||||
|
||||
static int inet_pton4(const char *src, unsigned char *dst, int pton);
|
||||
#ifdef IPV6
|
||||
static int inet_pton6(const char *src, unsigned char *dst);
|
||||
#endif /* IPV6 */
|
||||
|
||||
/* int
|
||||
* inet_pton(af, src, dst)
|
||||
* convert from presentation format (which usually means ASCII printable)
|
||||
* to network format (which is usually some kind of binary format).
|
||||
* return:
|
||||
* 1 if the address was valid for the specified address family
|
||||
* 0 if the address wasn't valid (`dst' is untouched in this case)
|
||||
* -1 if some other error occurred (`dst' is untouched in this case, too)
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
int
|
||||
inet_pton(int af, const char *src, void *dst)
|
||||
{
|
||||
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_pton4(src, dst, 1));
|
||||
#ifdef IPV6
|
||||
case AF_INET6:
|
||||
return (inet_pton6(src, dst));
|
||||
#endif /* IPV6 */
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* int
|
||||
* inet_pton4(src, dst, pton)
|
||||
* when last arg is 0: inet_aton(). with hexadecimal, octal and shorthand.
|
||||
* when last arg is 1: inet_pton(). decimal dotted-quad only.
|
||||
* return:
|
||||
* 1 if `src' is a valid input, else 0.
|
||||
* notice:
|
||||
* does not touch `dst' unless it's returning 1.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static int
|
||||
inet_pton4(const char *src, unsigned char *dst, int pton)
|
||||
{
|
||||
uint32_t val;
|
||||
unsigned int digit, base;
|
||||
int n;
|
||||
unsigned char c;
|
||||
unsigned int parts[4];
|
||||
register unsigned int *pp = parts;
|
||||
|
||||
c = *src;
|
||||
for (;;) {
|
||||
/*
|
||||
* Collect number up to ``.''.
|
||||
* Values are specified as for C:
|
||||
* 0x=hex, 0=octal, isdigit=decimal.
|
||||
*/
|
||||
if (!isdigit(c))
|
||||
return (0);
|
||||
val = 0;
|
||||
base = 10;
|
||||
if (c == '0') {
|
||||
c = *++src;
|
||||
if (c == 'x' || c == 'X')
|
||||
base = 16, c = *++src;
|
||||
else if (isdigit(c) && c != '9')
|
||||
base = 8;
|
||||
}
|
||||
/* inet_pton() takes decimal only */
|
||||
if (pton && base != 10)
|
||||
return (0);
|
||||
for (;;) {
|
||||
if (isdigit(c)) {
|
||||
digit = c - '0';
|
||||
if (digit >= base)
|
||||
break;
|
||||
val = (val * base) + digit;
|
||||
c = *++src;
|
||||
} else if (base == 16 && isxdigit(c)) {
|
||||
digit = c + 10 - (islower(c) ? 'a' : 'A');
|
||||
if (digit >= 16)
|
||||
break;
|
||||
val = (val << 4) | digit;
|
||||
c = *++src;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
if (c == '.') {
|
||||
/*
|
||||
* Internet format:
|
||||
* a.b.c.d
|
||||
* a.b.c (with c treated as 16 bits)
|
||||
* a.b (with b treated as 24 bits)
|
||||
* a (with a treated as 32 bits)
|
||||
*/
|
||||
if (pp >= parts + 3)
|
||||
return (0);
|
||||
*pp++ = val;
|
||||
c = *++src;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Check for trailing characters.
|
||||
*/
|
||||
if (c != '\0' && !isspace(c))
|
||||
return (0);
|
||||
/*
|
||||
* Concoct the address according to
|
||||
* the number of parts specified.
|
||||
*/
|
||||
n = pp - parts + 1;
|
||||
/* inet_pton() takes dotted-quad only. it does not take shorthand. */
|
||||
if (pton && n != 4)
|
||||
return (0);
|
||||
switch (n) {
|
||||
|
||||
case 0:
|
||||
return (0); /* initial nondigit */
|
||||
|
||||
case 1: /* a -- 32 bits */
|
||||
break;
|
||||
|
||||
case 2: /* a.b -- 8.24 bits */
|
||||
if (parts[0] > 0xff || val > 0xffffff)
|
||||
return (0);
|
||||
val |= parts[0] << 24;
|
||||
break;
|
||||
|
||||
case 3: /* a.b.c -- 8.8.16 bits */
|
||||
if ((parts[0] | parts[1]) > 0xff || val > 0xffff)
|
||||
return (0);
|
||||
val |= (parts[0] << 24) | (parts[1] << 16);
|
||||
break;
|
||||
|
||||
case 4: /* a.b.c.d -- 8.8.8.8 bits */
|
||||
if ((parts[0] | parts[1] | parts[2] | val) > 0xff)
|
||||
return (0);
|
||||
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
|
||||
break;
|
||||
}
|
||||
if (dst) {
|
||||
val = htonl(val);
|
||||
memcpy(dst, &val, NS_INADDRSZ);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
#ifdef IPV6
|
||||
/* int
|
||||
* inet_pton6(src, dst)
|
||||
* convert presentation level address to network order binary form.
|
||||
* return:
|
||||
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
|
||||
* notice:
|
||||
* (1) does not touch `dst' unless it's returning 1.
|
||||
* (2) :: in a full address is silently ignored.
|
||||
* credit:
|
||||
* inspired by Mark Andrews.
|
||||
* author:
|
||||
* Paul Vixie, 1996.
|
||||
*/
|
||||
static int
|
||||
inet_pton6(const char *src, unsigned char *dst)
|
||||
{
|
||||
static const char xdigits_l[] = "0123456789abcdef",
|
||||
xdigits_u[] = "0123456789ABCDEF";
|
||||
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
|
||||
const char *xdigits, *curtok;
|
||||
int ch, saw_xdigit;
|
||||
unsigned int val;
|
||||
|
||||
memset((tp = tmp), '\0', NS_IN6ADDRSZ);
|
||||
endp = tp + NS_IN6ADDRSZ;
|
||||
colonp = NULL;
|
||||
/* Leading :: requires some special handling. */
|
||||
if (*src == ':')
|
||||
if (*++src != ':')
|
||||
return (0);
|
||||
curtok = src;
|
||||
saw_xdigit = 0;
|
||||
val = 0;
|
||||
while ((ch = *src++) != '\0') {
|
||||
const char *pch;
|
||||
|
||||
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
|
||||
pch = strchr((xdigits = xdigits_u), ch);
|
||||
if (pch != NULL) {
|
||||
val <<= 4;
|
||||
val |= (pch - xdigits);
|
||||
if (val > 0xffff)
|
||||
return (0);
|
||||
saw_xdigit = 1;
|
||||
continue;
|
||||
}
|
||||
if (ch == ':') {
|
||||
curtok = src;
|
||||
if (!saw_xdigit) {
|
||||
if (colonp)
|
||||
return (0);
|
||||
colonp = tp;
|
||||
continue;
|
||||
} else if (*src == '\0')
|
||||
return (0);
|
||||
if (tp + NS_INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
saw_xdigit = 0;
|
||||
val = 0;
|
||||
continue;
|
||||
}
|
||||
if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
|
||||
inet_pton4(curtok, tp, 1) > 0) {
|
||||
tp += NS_INADDRSZ;
|
||||
saw_xdigit = 0;
|
||||
break; /* '\0' was seen by inet_pton4(). */
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
if (saw_xdigit) {
|
||||
if (tp + NS_INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
}
|
||||
if (colonp != NULL) {
|
||||
/*
|
||||
* Since some memmove()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const int n = tp - colonp;
|
||||
int i;
|
||||
|
||||
if (tp == endp)
|
||||
return (0);
|
||||
for (i = 1; i <= n; i++) {
|
||||
endp[- i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
}
|
||||
tp = endp;
|
||||
}
|
||||
if (tp != endp)
|
||||
return (0);
|
||||
memcpy(dst, tmp, NS_IN6ADDRSZ);
|
||||
return (1);
|
||||
}
|
||||
#endif /* IPV6 */
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/* $NetBSD: rand.c,v 1.12 2012/06/25 22:32:45 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 1
|
||||
static char sccsid[] = "@(#)rand.c 8.1 (Berkeley) 6/14/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: rand.c,v 1.12 2012/06/25 22:32:45 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef RAND_MAX
|
||||
#define RAND_MAX 2147483647
|
||||
#endif
|
||||
|
||||
static u_long next = 1;
|
||||
|
||||
int
|
||||
rand(void)
|
||||
{
|
||||
/* LINTED integer overflow */
|
||||
return (int)((next = next * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
|
||||
}
|
||||
|
||||
void
|
||||
srand(u_int seed)
|
||||
{
|
||||
next = seed;
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* fping: fast-ping, file-ping, favorite-ping, funky-ping
|
||||
*
|
||||
* Ping a list of target hosts in a round robin fashion.
|
||||
* A better ping overall.
|
||||
*
|
||||
* fping website: http://www.fping.org
|
||||
*
|
||||
* Current maintainer of fping: David Schweikert
|
||||
* Please send suggestions and patches to: david@schweikert.ch
|
||||
*
|
||||
*
|
||||
* Original author: Roland Schemers <schemers@stanford.edu>
|
||||
* IPv6 Support: Jeroen Massar <jeroen@unfix.org / jeroen@ipng.nl>
|
||||
* Improved main loop: David Schweikert <david@schweikert.ch>
|
||||
* Debian Merge, TOS settings: Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Bugfixes, byte order & senseful seq.-numbers: Stephan Fuhrmann (stephan.fuhrmann AT 1und1.de)
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by Stanford University. The name of the University may not be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* seqmap.c: implementation of a mapping between sequence number and (host, ping_nr)
|
||||
* we can't just use ping_nr*host_count + host_nr, because it can
|
||||
* overflow the 16 bit of the icmp header field. See also:
|
||||
* https://github.com/schweikert/fping/issues/48
|
||||
*/
|
||||
|
||||
#include "seqmap.h"
|
||||
#include "options.h"
|
||||
#include <limits.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* description of the data structure used:
|
||||
*
|
||||
* - we assume that no more than SEQMAP_MAXSEQ (65535) pings are sent in
|
||||
* the timeout interval (SEQMAP_TIMEOUT_IN_S)
|
||||
* - we store the values in an array with SEQMAP_MAXSEQ elements
|
||||
* - current sequence number % SEQMAP_MAXSEQ gives the current index
|
||||
* - when entering a value, we check that the current entry is expired
|
||||
*/
|
||||
|
||||
static SEQMAP_VALUE *seqmap_map = NULL;
|
||||
static unsigned int seqmap_next_id = 0;
|
||||
|
||||
#define SEQMAP_TIMEOUT_IN_S 10
|
||||
#define SEQMAP_UNASSIGNED_HOST_NR UINT_MAX
|
||||
|
||||
void seqmap_init()
|
||||
{
|
||||
seqmap_map = calloc(SEQMAP_MAXSEQ, sizeof(SEQMAP_VALUE));
|
||||
if(seqmap_map == NULL) {
|
||||
perror("malloc error (can't allocate seqmap_map)");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int seqmap_add(unsigned int host_nr, unsigned int ping_count, struct timeval *now)
|
||||
{
|
||||
unsigned int current_id;
|
||||
SEQMAP_VALUE *next_value;
|
||||
|
||||
if(!seqmap_map) {
|
||||
fprintf(stderr, "fping internal error: seqmap not initialized.\n");
|
||||
exit(4);
|
||||
}
|
||||
|
||||
/* check if expired (note that unused seqmap values will have fields set to
|
||||
* 0, so will be seen as expired */
|
||||
next_value = &seqmap_map[seqmap_next_id];
|
||||
if(next_value->ping_ts.tv_sec != 0 && (now->tv_sec - next_value->ping_ts.tv_sec) < SEQMAP_TIMEOUT_IN_S) {
|
||||
fprintf(stderr, "fping error: not enough sequence numbers available! (expire_timeout=%d, host_nr=%d, ping_count=%d, seqmap_next_id=%d)\n",
|
||||
SEQMAP_TIMEOUT_IN_S, host_nr, ping_count, seqmap_next_id);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
/* store the value */
|
||||
next_value->host_nr = host_nr;
|
||||
next_value->ping_count = ping_count;
|
||||
next_value->ping_ts.tv_sec = now->tv_sec;
|
||||
next_value->ping_ts.tv_usec = now->tv_usec;
|
||||
|
||||
/* increase next id */
|
||||
current_id = seqmap_next_id;
|
||||
seqmap_next_id = (seqmap_next_id + 1) % SEQMAP_MAXSEQ;
|
||||
|
||||
return current_id;
|
||||
}
|
||||
|
||||
SEQMAP_VALUE *seqmap_fetch(unsigned int id, struct timeval *now)
|
||||
{
|
||||
SEQMAP_VALUE *value;
|
||||
|
||||
if(id > SEQMAP_MAXSEQ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
value = &seqmap_map[id];
|
||||
|
||||
/* verify that value is not expired */
|
||||
if(now->tv_sec - value->ping_ts.tv_sec >= SEQMAP_TIMEOUT_IN_S) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef SEQMAP_H
|
||||
#define SEQMAP_H
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
typedef struct seqmap_value
|
||||
{
|
||||
unsigned int host_nr;
|
||||
unsigned int ping_count;
|
||||
struct timeval ping_ts;
|
||||
|
||||
} SEQMAP_VALUE;
|
||||
|
||||
#define SEQMAP_MAXSEQ 65535
|
||||
|
||||
void seqmap_init();
|
||||
unsigned int seqmap_add(unsigned int host_nr, unsigned int ping_count, struct timeval *now);
|
||||
SEQMAP_VALUE *seqmap_fetch(unsigned int id, struct timeval *now);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* fping: fast-ping, file-ping, favorite-ping, funky-ping
|
||||
*
|
||||
* Ping a list of target hosts in a round robin fashion.
|
||||
* A better ping overall.
|
||||
*
|
||||
* fping website: http://www.fping.org
|
||||
*
|
||||
* Current maintainer of fping: David Schweikert
|
||||
* Please send suggestions and patches to: david@schweikert.ch
|
||||
*
|
||||
*
|
||||
* Original author: Roland Schemers <schemers@stanford.edu>
|
||||
* IPv6 Support: Jeroen Massar <jeroen@unfix.org / jeroen@ipng.nl>
|
||||
* Improved main loop: David Schweikert <david@schweikert.ch>
|
||||
* Debian Merge, TOS settings: Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Bugfixes, byte order & senseful seq.-numbers: Stephan Fuhrmann (stephan.fuhrmann AT 1und1.de)
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by Stanford University. The name of the University may not be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include "fping.h"
|
||||
|
||||
int open_ping_socket_ipv4();
|
||||
int open_ping_socket_ipv6();
|
||||
void init_ping_buffer_ipv4(size_t ping_data_size);
|
||||
void init_ping_buffer_ipv6(size_t ping_data_size);
|
||||
void socket_set_src_addr_ipv4(int s, FPING_INADDR src_addr);
|
||||
void socket_set_src_addr_ipv6(int s, FPING_INADDR src_addr);
|
||||
int socket_sendto_ping_ipv4(int s, struct sockaddr *saddr, socklen_t saddr_len, uint16_t icmp_seq_nr, uint16_t icmp_id_nr);
|
||||
int socket_sendto_ping_ipv6(int s, struct sockaddr *saddr, socklen_t saddr_len, uint16_t icmp_seq_nr, uint16_t icmp_id_nr);
|
||||
void close_ping_socket_ipv4();
|
||||
void cleanup_ping_buffer_ipv4();
|
||||
|
||||
int open_ping_socket()
|
||||
{
|
||||
#ifndef IPV6
|
||||
return open_ping_socket_ipv4();
|
||||
#else
|
||||
return open_ping_socket_ipv6();
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_ping_buffer(size_t ping_data_size)
|
||||
{
|
||||
#ifndef IPV6
|
||||
return init_ping_buffer_ipv4(ping_data_size);
|
||||
#else
|
||||
return init_ping_buffer_ipv6(ping_data_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void socket_set_src_addr(int s, FPING_INADDR src_addr)
|
||||
{
|
||||
#ifndef IPV6
|
||||
socket_set_src_addr_ipv4(s, src_addr);
|
||||
#else
|
||||
socket_set_src_addr_ipv6(s, src_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
int socket_sendto_ping(int s, struct sockaddr *saddr, socklen_t saddr_len, uint16_t icmp_seq_nr, uint16_t icmp_id_nr)
|
||||
{
|
||||
#ifndef IPV6
|
||||
return socket_sendto_ping_ipv4(s, saddr, saddr_len, icmp_seq_nr, icmp_id_nr);
|
||||
#else
|
||||
return socket_sendto_ping_ipv6(s, saddr, saddr_len, icmp_seq_nr, icmp_id_nr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void close_ping_socket()
|
||||
{
|
||||
#ifndef IPV6
|
||||
close_ping_socket_ipv4();
|
||||
#endif
|
||||
}
|
||||
|
||||
void cleanup_ping_buffer()
|
||||
{
|
||||
#ifndef IPV6
|
||||
cleanup_ping_buffer_ipv4();
|
||||
#endif
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* fping: fast-ping, file-ping, favorite-ping, funky-ping
|
||||
*
|
||||
* Ping a list of target hosts in a round robin fashion.
|
||||
* A better ping overall.
|
||||
*
|
||||
* fping website: http://www.fping.org
|
||||
*
|
||||
* Current maintainer of fping: David Schweikert
|
||||
* Please send suggestions and patches to: david@schweikert.ch
|
||||
*
|
||||
*
|
||||
* Original author: Roland Schemers <schemers@stanford.edu>
|
||||
* IPv6 Support: Jeroen Massar <jeroen@unfix.org / jeroen@ipng.nl>
|
||||
* Improved main loop: David Schweikert <david@schweikert.ch>
|
||||
* Debian Merge, TOS settings: Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Bugfixes, byte order & senseful seq.-numbers: Stephan Fuhrmann (stephan.fuhrmann AT 1und1.de)
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by Stanford University. The name of the University may not be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include "fping.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *ping_buffer = 0;
|
||||
size_t ping_pkt_size;
|
||||
int s = -1;
|
||||
|
||||
int open_ping_socket_ipv4()
|
||||
{
|
||||
struct protoent *proto;
|
||||
|
||||
/* confirm that ICMP is available on this machine */
|
||||
if( ( proto = getprotobyname( "icmp" ) ) == NULL )
|
||||
crash_and_burn( "icmp: unknown protocol" );
|
||||
|
||||
/* create raw socket for ICMP calls (ping) */
|
||||
s = Socket( AF_INET, SOCK_RAW, proto->p_proto );
|
||||
if( s < 0 ) {
|
||||
/* try non-privileged icmp (works on Mac OSX without privileges, for example) */
|
||||
s = Socket( AF_INET, SOCK_DGRAM, proto->p_proto );
|
||||
if( s < 0 ) {
|
||||
errno_crash_and_burn( "can't create socket (must run as root?)" );
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void init_ping_buffer_ipv4(size_t ping_data_size)
|
||||
{
|
||||
/* allocate ping buffer */
|
||||
ping_pkt_size = ping_data_size + ICMP_MINLEN;
|
||||
ping_buffer = (char *) calloc(1, ping_pkt_size);
|
||||
if(!ping_buffer)
|
||||
crash_and_burn( "can't malloc ping packet" );
|
||||
}
|
||||
|
||||
void socket_set_src_addr_ipv4(int s, FPING_INADDR src_addr)
|
||||
{
|
||||
struct sockaddr_in sa;
|
||||
memset( &sa, 0, sizeof( sa ) );
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_addr = src_addr;
|
||||
|
||||
if ( Bind( s, (struct sockaddr *)&sa, sizeof( sa ) ) < 0 )
|
||||
errno_crash_and_burn( "cannot bind source address" );
|
||||
}
|
||||
|
||||
unsigned short calcsum(unsigned short *buffer, int length)
|
||||
{
|
||||
unsigned long sum;
|
||||
|
||||
// initialize sum to zero and loop until length (in words) is 0
|
||||
for (sum=0; length>1; length-=2) // sizeof() returns number of bytes, we're interested in number of words
|
||||
sum += *buffer++; // add 1 word of buffer to sum and proceed to the next
|
||||
|
||||
// we may have an extra byte
|
||||
if (length==1)
|
||||
sum += (char)*buffer;
|
||||
|
||||
sum = (sum >> 16) + (sum & 0xFFFF); // add high 16 to low 16
|
||||
sum += (sum >> 16); // add carry
|
||||
return ~sum;
|
||||
}
|
||||
|
||||
int socket_sendto_ping_ipv4(int s, struct sockaddr *saddr, socklen_t saddr_len, uint16_t icmp_seq_nr, uint16_t icmp_id_nr)
|
||||
{
|
||||
struct icmp *icp;
|
||||
int n;
|
||||
|
||||
icp = (struct icmp *) ping_buffer;
|
||||
|
||||
icp->icmp_type = ICMP_ECHO;
|
||||
icp->icmp_code = 0;
|
||||
icp->icmp_cksum = 0;
|
||||
icp->icmp_seq = htons(icmp_seq_nr);
|
||||
icp->icmp_id = htons(icmp_id_nr);
|
||||
|
||||
if (random_data_flag) {
|
||||
for (n = ((void*)&icp->icmp_data - (void *)icp); n < ping_pkt_size; ++n) {
|
||||
ping_buffer[n] = random() & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
icp->icmp_cksum = calcsum((unsigned short *) icp, ping_pkt_size);
|
||||
|
||||
n = SendTo(s, (void*)icp, ping_pkt_size, 0, saddr, saddr_len);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void close_ping_socket_ipv4()
|
||||
{
|
||||
if(s > 0)
|
||||
CloseSocket(s);
|
||||
}
|
||||
|
||||
void cleanup_ping_buffer_ipv4()
|
||||
{
|
||||
if (ping_buffer != 0) {
|
||||
free(ping_buffer);
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* fping: fast-ping, file-ping, favorite-ping, funky-ping
|
||||
*
|
||||
* Ping a list of target hosts in a round robin fashion.
|
||||
* A better ping overall.
|
||||
*
|
||||
* fping website: http://www.fping.org
|
||||
*
|
||||
* Current maintainer of fping: David Schweikert
|
||||
* Please send suggestions and patches to: david@schweikert.ch
|
||||
*
|
||||
*
|
||||
* Original author: Roland Schemers <schemers@stanford.edu>
|
||||
* IPv6 Support: Jeroen Massar <jeroen@unfix.org / jeroen@ipng.nl>
|
||||
* Improved main loop: David Schweikert <david@schweikert.ch>
|
||||
* Debian Merge, TOS settings: Tobi Oetiker <tobi@oetiker.ch>
|
||||
* Bugfixes, byte order & senseful seq.-numbers: Stephan Fuhrmann (stephan.fuhrmann AT 1und1.de)
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by Stanford University. The name of the University may not be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include "fping.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <netinet/icmp6.h>
|
||||
|
||||
char *ping_buffer = 0;
|
||||
size_t ping_pkt_size;
|
||||
|
||||
int open_ping_socket_ipv6()
|
||||
{
|
||||
struct protoent *proto;
|
||||
int s;
|
||||
|
||||
/* confirm that ICMP is available on this machine */
|
||||
if( ( proto = getprotobyname( "ipv6-icmp" ) ) == NULL )
|
||||
crash_and_burn( "icmp: unknown protocol" );
|
||||
|
||||
/* create raw socket for ICMP calls (ping) */
|
||||
s = socket( AF_INET6, SOCK_RAW, proto->p_proto );
|
||||
if( s < 0 ) {
|
||||
/* try non-privileged icmp (works on Mac OSX without privileges, for example) */
|
||||
s = socket( AF_INET6, SOCK_DGRAM, proto->p_proto );
|
||||
if( s < 0 ) {
|
||||
errno_crash_and_burn( "can't create raw socket (must run as root?)" );
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void init_ping_buffer_ipv6(size_t ping_data_size)
|
||||
{
|
||||
/* allocate ping buffer */
|
||||
ping_pkt_size = ping_data_size + sizeof(struct icmp6_hdr);
|
||||
ping_buffer = (char *) calloc(1, ping_pkt_size);
|
||||
if(!ping_buffer)
|
||||
crash_and_burn( "can't malloc ping packet" );
|
||||
}
|
||||
|
||||
void socket_set_src_addr_ipv6(int s, FPING_INADDR src_addr)
|
||||
{
|
||||
struct sockaddr_in6 sa;
|
||||
memset( &sa, 0, sizeof( sa ) );
|
||||
sa.sin6_family = AF_INET6;
|
||||
sa.sin6_addr = src_addr;
|
||||
|
||||
if ( bind( s, (struct sockaddr *)&sa, sizeof( sa ) ) < 0 )
|
||||
errno_crash_and_burn( "cannot bind source address" );
|
||||
}
|
||||
|
||||
int socket_sendto_ping_ipv6(int s, struct sockaddr *saddr, socklen_t saddr_len, uint16_t icmp_seq_nr, uint16_t icmp_id_nr)
|
||||
{
|
||||
struct icmp6_hdr *icp;
|
||||
int n;
|
||||
|
||||
icp = (struct icmp6_hdr *) ping_buffer;
|
||||
icp->icmp6_type = ICMP6_ECHO_REQUEST;
|
||||
icp->icmp6_code = 0;
|
||||
icp->icmp6_seq = htons(icmp_seq_nr);
|
||||
icp->icmp6_id = htons(icmp_id_nr);
|
||||
|
||||
if (random_data_flag) {
|
||||
for (n = sizeof(struct icmp6_hdr); n < ping_pkt_size; ++n) {
|
||||
ping_buffer[n] = random() & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
icp->icmp6_cksum = 0; // The IPv6 stack calculates the checksum for us...
|
||||
|
||||
n = sendto(s, icp, ping_pkt_size, 0, saddr, saddr_len);
|
||||
|
||||
return n;
|
||||
}
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
gcc -DHAVE_CONFIG_H -D_BSD_SOURCE -D_POSIX_SOURCE -I.. -Wall -std=c89 -pedantic -c -o fping.o fping.c
|
||||
@@ -1 +0,0 @@
|
||||
timestamp
|
||||
Reference in New Issue
Block a user