Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65cfc7bc89 | ||
|
|
38e93966d5 | ||
|
|
49d56451d4 | ||
|
|
54bcc5665d | ||
|
|
1ad4e3a4d9 | ||
|
|
26bc736025 | ||
|
|
14f45a6872 | ||
|
|
23848d5481 | ||
|
|
80122ac930 | ||
|
|
02b3289e69 | ||
|
|
e372ac97bc |
@@ -1,4 +1,4 @@
|
||||
Thu Dec 15 2011
|
||||
Thu Dec 28 2011
|
||||
David Schweikert <david@schweikert.ch>
|
||||
- Revision v3.0
|
||||
* rewritten main loop for improved performance
|
||||
|
||||
@@ -616,6 +616,9 @@ distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
-rm -f fping.plist
|
||||
-rm -rf autom4te.cache
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
fping README
|
||||
------------
|
||||
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>
|
||||
|
||||
David Schweikert <david@schweikert.ch>
|
||||
|
||||
|
||||
fping website: http://www.fping.org
|
||||
Website:
|
||||
http://www.fping.org
|
||||
|
||||
|
||||
Original author: Roland Schemers (schemers@stanford.edu)
|
||||
@@ -14,13 +18,9 @@ Previous maintainer: RL "Bob" Morgan (morgan@stanford.edu)
|
||||
IPv6 Support: Jeroen Massar (jeroen@unfix.org / jeroen@ipng.nl)
|
||||
to enable IPV6 compile with -DIPV6
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for fping 3.0-rc1.
|
||||
# Generated by GNU Autoconf 2.68 for fping 3.0.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -557,8 +557,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='fping'
|
||||
PACKAGE_TARNAME='fping'
|
||||
PACKAGE_VERSION='3.0-rc1'
|
||||
PACKAGE_STRING='fping 3.0-rc1'
|
||||
PACKAGE_VERSION='3.0'
|
||||
PACKAGE_STRING='fping 3.0'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1254,7 +1254,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures fping 3.0-rc1 to adapt to many kinds of systems.
|
||||
\`configure' configures fping 3.0 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1325,7 +1325,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of fping 3.0-rc1:";;
|
||||
short | recursive ) echo "Configuration of fping 3.0:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1414,7 +1414,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
fping configure 3.0-rc1
|
||||
fping configure 3.0
|
||||
generated by GNU Autoconf 2.68
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
@@ -1779,7 +1779,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by fping $as_me 3.0-rc1, which was
|
||||
It was created by fping $as_me 3.0, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2705,7 +2705,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='fping'
|
||||
VERSION='3.0-rc1'
|
||||
VERSION='3.0'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -4816,7 +4816,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by fping $as_me 3.0-rc1, which was
|
||||
This file was extended by fping $as_me 3.0, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -4882,7 +4882,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
fping config.status 3.0-rc1
|
||||
fping config.status 3.0
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
dnl Minimum Autoconf version required.
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
AC_INIT([fping],[3.0-rc1])
|
||||
AC_INIT([fping],[3.0])
|
||||
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
@@ -140,7 +140,7 @@ mode, this is the amount of time that
|
||||
waits for a response to its first request. Successive timeouts are
|
||||
multiplied by the backoff factor.
|
||||
.IP \fB-T\fIn\fR 5
|
||||
Select timeout in seconds (default 10).
|
||||
Ignored (for compatibility with fping 2.4).
|
||||
.IP \fB-u\fR 5
|
||||
Show targets that are unreachable.
|
||||
.IP \fB-T\fIn\fR 5
|
||||
@@ -200,7 +200,8 @@ foreach $host (split(/\\n/,$hosts_to_backup)) {
|
||||
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
|
||||
David Schweikert, versions 3.0 and up
|
||||
fping website: http://www.fping.org
|
||||
.ni
|
||||
.SH DIAGNOSTICS
|
||||
Exit status is 0 if all the hosts are reachable, 1 if some hosts were
|
||||
|
||||
@@ -366,13 +366,13 @@ void errno_crash_and_burn( char *message );
|
||||
char *get_host_by_address( struct in_addr in );
|
||||
int in_cksum( u_short *p, int n );
|
||||
void u_sleep( int u_sec );
|
||||
int recvfrom_wto ( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo );
|
||||
int recvfrom_wto ( int s, char *buf, int len, FPING_SOCKADDR *saddr, long timo );
|
||||
void remove_job( HOST_ENTRY *h );
|
||||
int send_ping( int s, HOST_ENTRY *h );
|
||||
long timeval_diff( struct timeval *a, struct timeval *b );
|
||||
void timeval_add(struct timeval *a, long t_10u);
|
||||
void usage( void );
|
||||
int wait_for_reply( u_int );
|
||||
int wait_for_reply( long );
|
||||
void print_per_system_stats( void );
|
||||
void print_per_system_splits( void );
|
||||
void print_global_stats( void );
|
||||
@@ -1106,7 +1106,7 @@ int main( int argc, char **argv )
|
||||
|
||||
/* main loop */
|
||||
main_loop();
|
||||
|
||||
|
||||
finish();
|
||||
|
||||
return 0;
|
||||
@@ -1114,7 +1114,7 @@ int main( int argc, char **argv )
|
||||
|
||||
void main_loop()
|
||||
{
|
||||
u_int lt;
|
||||
long lt;
|
||||
long wait_time;
|
||||
HOST_ENTRY *h;
|
||||
|
||||
@@ -1134,6 +1134,7 @@ void main_loop()
|
||||
h = ev_dequeue();
|
||||
|
||||
/* Send the ping */
|
||||
/*printf("Sending ping after %d ms\n", lt/100); */
|
||||
if(!send_ping(s, h)) goto wait_for_reply;
|
||||
|
||||
/* Check what needs to be done next */
|
||||
@@ -1141,8 +1142,8 @@ void main_loop()
|
||||
/* Normal mode: schedule retry */
|
||||
if(h->waiting < retry + 1) {
|
||||
h->ev_type = EV_TYPE_PING;
|
||||
h->ev_time.tv_sec = current_time.tv_sec;
|
||||
h->ev_time.tv_usec = current_time.tv_usec;
|
||||
h->ev_time.tv_sec = last_send_time.tv_sec;
|
||||
h->ev_time.tv_usec = last_send_time.tv_usec;
|
||||
timeval_add(&h->ev_time, h->timeout);
|
||||
ev_enqueue(h);
|
||||
|
||||
@@ -1153,8 +1154,8 @@ void main_loop()
|
||||
/* Normal mode: schedule timeout for last retry */
|
||||
else {
|
||||
h->ev_type = EV_TYPE_TIMEOUT;
|
||||
h->ev_time.tv_sec = current_time.tv_sec;
|
||||
h->ev_time.tv_usec = current_time.tv_usec;
|
||||
h->ev_time.tv_sec = last_send_time.tv_sec;
|
||||
h->ev_time.tv_usec = last_send_time.tv_usec;
|
||||
timeval_add(&h->ev_time, h->timeout);
|
||||
ev_enqueue(h);
|
||||
}
|
||||
@@ -1163,16 +1164,16 @@ void main_loop()
|
||||
else if(loop_flag || (count_flag && h->num_sent < count))
|
||||
{
|
||||
h->ev_type = EV_TYPE_PING;
|
||||
h->ev_time.tv_sec = current_time.tv_sec;
|
||||
h->ev_time.tv_usec = current_time.tv_usec;
|
||||
h->ev_time.tv_sec = last_send_time.tv_sec;
|
||||
h->ev_time.tv_usec = last_send_time.tv_usec;
|
||||
timeval_add(&h->ev_time, perhost_interval);
|
||||
ev_enqueue(h);
|
||||
}
|
||||
/* Count mode: schedule timeout after last ping */
|
||||
else if(count_flag && count_flag && h->num_sent >= count) {
|
||||
h->ev_type = EV_TYPE_TIMEOUT;
|
||||
h->ev_time.tv_sec = current_time.tv_sec;
|
||||
h->ev_time.tv_usec = current_time.tv_usec;
|
||||
h->ev_time.tv_sec = last_send_time.tv_sec;
|
||||
h->ev_time.tv_usec = last_send_time.tv_usec;
|
||||
timeval_add(&h->ev_time, h->timeout);
|
||||
ev_enqueue(h);
|
||||
}
|
||||
@@ -1188,13 +1189,24 @@ void main_loop()
|
||||
/* When can we expect the next event? */
|
||||
if(ev_first) {
|
||||
if(ev_first->ev_time.tv_sec == 0) {
|
||||
wait_time = interval;
|
||||
}
|
||||
else {
|
||||
wait_time = 0;
|
||||
}
|
||||
else {
|
||||
wait_time = timeval_diff(&ev_first->ev_time, ¤t_time);
|
||||
if(wait_time < (long) interval) {
|
||||
wait_time = interval;
|
||||
}
|
||||
if(wait_time < 0) wait_time = 0;
|
||||
}
|
||||
if(ev_first->ev_type == EV_TYPE_PING) {
|
||||
/* make sure that we wait enough, so that the inter-ping delay is
|
||||
* bigger than 'interval' */
|
||||
if(wait_time < interval) {
|
||||
lt = timeval_diff(¤t_time, &last_send_time);
|
||||
if(lt < interval) {
|
||||
wait_time = interval-lt;
|
||||
}
|
||||
else {
|
||||
wait_time = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
@@ -1664,7 +1676,7 @@ int send_ping( int s, HOST_ENTRY *h )
|
||||
#ifdef _NO_PROTO
|
||||
int wait_for_reply()
|
||||
#else
|
||||
int wait_for_reply(u_int wait_time)
|
||||
int wait_for_reply(long wait_time)
|
||||
#endif
|
||||
{
|
||||
int result;
|
||||
@@ -2566,11 +2578,8 @@ char *message;
|
||||
void errno_crash_and_burn( char *message )
|
||||
#endif /* _NO_PROTO */
|
||||
{
|
||||
if( verbose_flag )
|
||||
fprintf( stderr, "%s: %s : %s\n", prog, message, strerror( errno ) );
|
||||
|
||||
fprintf( stderr, "%s: %s : %s\n", prog, message, strerror( errno ) );
|
||||
exit( 4 );
|
||||
|
||||
} /* errno_crash_and_burn() */
|
||||
|
||||
|
||||
@@ -2599,12 +2608,15 @@ long timeval_diff( struct timeval *a, struct timeval *b )
|
||||
#endif /* _NO_PROTO */
|
||||
{
|
||||
long sec_diff = a->tv_sec - b->tv_sec;
|
||||
if(sec_diff > 100) {
|
||||
/* For such large differences, we don't really care about the microseconds... */
|
||||
return sec_diff * 100000;
|
||||
if(sec_diff == 0) {
|
||||
return (a->tv_usec - b->tv_usec) / 10;
|
||||
}
|
||||
else if(sec_diff < 100) {
|
||||
return (sec_diff * 1000000 + a->tv_usec - b->tv_usec) / 10;
|
||||
}
|
||||
else {
|
||||
return (sec_diff * 1000000 + a->tv_usec - b->tv_usec) / 10;
|
||||
/* For such large differences, we don't really care about the microseconds... */
|
||||
return sec_diff * 100000;
|
||||
}
|
||||
} /* timeval_diff() */
|
||||
|
||||
@@ -2705,9 +2717,18 @@ void u_sleep( int u_sec )
|
||||
|
||||
FD_ZERO( &readset );
|
||||
FD_ZERO( &writeset );
|
||||
|
||||
select_again:
|
||||
nfound = select( 0, &readset, &writeset, NULL, &to );
|
||||
if( nfound < 0 )
|
||||
errno_crash_and_burn( "select" );
|
||||
if(nfound < 0) {
|
||||
if(errno == EINTR) {
|
||||
/* interrupted system call: redo the select */
|
||||
goto select_again;
|
||||
}
|
||||
else {
|
||||
errno_crash_and_burn( "select" );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -2734,9 +2755,9 @@ void u_sleep( int u_sec )
|
||||
|
||||
#ifdef _NO_PROTO
|
||||
int recvfrom_wto( s, buf, len, saddr, timo )
|
||||
int s; char *buf; int len; FPING_SOCKADDR *saddr; int timo;
|
||||
int s; char *buf; int len; FPING_SOCKADDR *saddr; long timo;
|
||||
#else
|
||||
int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo )
|
||||
int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, long timo )
|
||||
#endif /* _NO_PROTO */
|
||||
{
|
||||
unsigned int slen;
|
||||
@@ -2750,9 +2771,18 @@ int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo )
|
||||
FD_ZERO( &readset );
|
||||
FD_ZERO( &writeset );
|
||||
FD_SET( s, &readset );
|
||||
|
||||
select_again:
|
||||
nfound = select( s + 1, &readset, &writeset, NULL, &to );
|
||||
if( nfound < 0 )
|
||||
errno_crash_and_burn( "select" );
|
||||
if(nfound < 0) {
|
||||
if(errno == EINTR) {
|
||||
/* interrupted system call: redo the select */
|
||||
goto select_again;
|
||||
}
|
||||
else {
|
||||
errno_crash_and_burn( "select" );
|
||||
}
|
||||
}
|
||||
|
||||
if( nfound == 0 )
|
||||
return -1; /* timeout */
|
||||
@@ -2928,6 +2958,7 @@ void usage( void )
|
||||
#endif
|
||||
fprintf( stderr, " -S addr set source address\n" );
|
||||
fprintf( stderr, " -t n individual target initial timeout (in millisec) (default %d)\n", timeout / 100 );
|
||||
fprintf( stderr, " -T n ignored (for compatibility with fping 2.4)\n");
|
||||
fprintf( stderr, " -u show targets that are unreachable\n" );
|
||||
fprintf( stderr, " -O n set the type of service (tos) flag on the ICMP packets\n" );
|
||||
fprintf( stderr, " -v show version\n" );
|
||||
|
||||
Reference in New Issue
Block a user