diff options
author | abs <abs@pkgsrc.org> | 2000-05-19 10:20:35 +0000 |
---|---|---|
committer | abs <abs@pkgsrc.org> | 2000-05-19 10:20:35 +0000 |
commit | abb758ad71b4fcebfc90ba8dd8dffc52d2783873 (patch) | |
tree | c78b9279116660ba548d1794066458a2118747da | |
parent | b1f20bf6b950ee934c00df127021efaa93f7c618 (diff) | |
download | pkgsrc-abb758ad71b4fcebfc90ba8dd8dffc52d2783873.tar.gz |
fping 1.20 - Quickly ping many hosts w/o flooding the network
-rw-r--r-- | net/fping/Makefile | 22 | ||||
-rw-r--r-- | net/fping/files/md5 | 3 | ||||
-rw-r--r-- | net/fping/files/patch-sum | 5 | ||||
-rw-r--r-- | net/fping/patches/patch-aa | 18 | ||||
-rw-r--r-- | net/fping/patches/patch-ab | 119 | ||||
-rw-r--r-- | net/fping/patches/patch-ac | 54 | ||||
-rw-r--r-- | net/fping/pkg/COMMENT | 1 | ||||
-rw-r--r-- | net/fping/pkg/DESCR | 14 | ||||
-rw-r--r-- | net/fping/pkg/PLIST | 2 |
9 files changed, 238 insertions, 0 deletions
diff --git a/net/fping/Makefile b/net/fping/Makefile new file mode 100644 index 00000000000..ff495695091 --- /dev/null +++ b/net/fping/Makefile @@ -0,0 +1,22 @@ +# $NetBSD: Makefile,v 1.1.1.1 2000/05/19 10:20:35 abs Exp $ +# FreeBSD Id: ports/net/fping/Makefile,v 1.10 2000/04/20 20:18:57 mharo Exp + +DISTNAME= part01 +PKGNAME= fping-1.20 +CATEGORIES= net +MASTER_SITES= ftp://ftp.uu.net/usenet/comp.sources.unix/volume26/fping/ \ + ftp://ftp.digital.com/pub/usenet/comp.sources.unix/volume26/fping/ \ + ftp://ftp.wustl.edu/usenet/comp.sources.unix/volume26/fping/ \ + ftp://ftp.isnet.is/pub/Usenet/Usenet.src/comp.sources.unix/v26/fping/ +EXTRACT_SUFX= .Z + +MAINTAINER= abs@netbsd.org + +DIST_SUBDIR= fping +EXTRACT_CMD= zcat ${DOWNLOADED_DISTFILE} | ${SED} -e '1,/Archive-Name/d' | ${SH} +NO_WRKSUBDIR= yes + +post-install: + @strip ${PREFIX}/sbin/fping + +.include "../../mk/bsd.pkg.mk" diff --git a/net/fping/files/md5 b/net/fping/files/md5 new file mode 100644 index 00000000000..038ad62cdfb --- /dev/null +++ b/net/fping/files/md5 @@ -0,0 +1,3 @@ +$NetBSD: md5,v 1.1.1.1 2000/05/19 10:20:36 abs Exp $ + +MD5 (fping/part01.Z) = b472b9936f814051370f5cada5e3ab0a diff --git a/net/fping/files/patch-sum b/net/fping/files/patch-sum new file mode 100644 index 00000000000..be2dee4633a --- /dev/null +++ b/net/fping/files/patch-sum @@ -0,0 +1,5 @@ +$NetBSD: patch-sum,v 1.1.1.1 2000/05/19 10:20:36 abs Exp $ + +MD5 (patch-aa) = a4f9658f461a6dce17f8d65161c9fe2f +MD5 (patch-ab) = 5dc3570e2329537a1ea4bf7434f4418f +MD5 (patch-ac) = e068d70c22cd515422429f450195e455 diff --git a/net/fping/patches/patch-aa b/net/fping/patches/patch-aa new file mode 100644 index 00000000000..7f0c5a23a80 --- /dev/null +++ b/net/fping/patches/patch-aa @@ -0,0 +1,18 @@ +$NetBSD: patch-aa,v 1.1.1.1 2000/05/19 10:20:36 abs Exp $ + +--- Makefile.orig Tue Mar 25 01:18:00 1997 ++++ Makefile Tue Mar 25 01:18:58 1997 +@@ -2,10 +2,10 @@ + PROG= fping + OBJS= fping.o + SRC= fping.c +-BIN= /usr/local/bin +-MAN= /usr/man/manl ++BIN= $(PREFIX)/sbin ++MAN= $(PREFIX)/man/man8 + MANSRC= fping.man +-MANDST= fping.l ++MANDST= fping.8 + + # + # Interval is the minimum amount of time between sending a ping packet to diff --git a/net/fping/patches/patch-ab b/net/fping/patches/patch-ab new file mode 100644 index 00000000000..a737324961a --- /dev/null +++ b/net/fping/patches/patch-ab @@ -0,0 +1,119 @@ +$NetBSD: patch-ab,v 1.1.1.1 2000/05/19 10:20:36 abs Exp $ + +--- fping.c.orig Mon Sep 20 13:10:23 1999 ++++ fping.c Mon Sep 20 13:15:05 1999 +@@ -185,7 +185,9 @@ + + extern char *optarg; + extern int optind,opterr; ++#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) + extern char *sys_errlist[]; ++#endif + + + #ifdef __cplusplus +@@ -234,9 +236,9 @@ + int timeout = DEFAULT_TIMEOUT; + int interval = DEFAULT_INTERVAL; + +-long max_reply=0; +-long min_reply=10000; +-int total_replies=0; ++long max_reply=0; /* usec */ ++long min_reply=10000; /* usec */ ++int total_replies=0; /* usec */ + double sum_replies=0; + + struct timeval timeout_timeval; +@@ -385,6 +387,7 @@ + } + if (!ping_file) errno_crash_and_burn("fopen"); + while(fgets(line,132,ping_file)) { ++ line[132-1] = '\0'; + sscanf(line,"%s",host); + if ((!*host) || (host[0]=='#')) /* magic to avoid comments */ + continue; +@@ -411,8 +414,8 @@ + cursor=cursor->next; + } + +- gettimeofday(&start_time,&tz); + cursor=rrlist; ++ gettimeofday(&start_time,&tz); + while (num_waiting) { /* while pings are outstanding */ + if ( (timeval_diff(¤t_time,&cursor->last_time)> timeout) || + cursor->num_packets_sent==0) { +@@ -455,11 +458,11 @@ + min_reply=0; max_reply=0; total_replies=1; sum_replies=0; + } + +- fprintf(stderr," %8d msec (min round trip time)\n",min_reply); +- fprintf(stderr," %8d msec (avg round trip time)\n",(int)sum_replies/total_replies); +- fprintf(stderr," %8d msec (max round trip time)\n",max_reply); ++ fprintf(stderr," %8.3f msec (min round trip time)\n",min_reply/1000.0); ++ fprintf(stderr," %8.3f msec (avg round trip time)\n",sum_replies/total_replies/1000.0); ++ fprintf(stderr," %8.3f msec (max round trip time)\n",max_reply/1000.0); + fprintf(stderr," %8.3f sec (elapsed real time)\n", +- timeval_diff( &end_time,&start_time)/1000.0); ++ timeval_diff( &end_time,&start_time)/1000000.0); + fprintf(stderr,"\n"); + + } +@@ -493,8 +496,6 @@ + struct icmp *icp = (struct icmp *) buffer; + int n,len; + +- gettimeofday(&h->last_time,&tz); +- + icp->icmp_type = ICMP_ECHO; + icp->icmp_code = 0; + icp->icmp_cksum = 0; +@@ -504,12 +505,15 @@ + #define SIZE_PACK_SENT (sizeof(h->num_packets_sent)) + #define SIZE_LAST_TIME (sizeof(h->last_time)) + +- bcopy(&h->last_time,&buffer[SIZE_ICMP_HDR],SIZE_LAST_TIME); + bcopy(&h->num_packets_sent, + &buffer[SIZE_ICMP_HDR+SIZE_LAST_TIME], SIZE_PACK_SENT); + + len = SIZE_ICMP_HDR+SIZE_LAST_TIME+SIZE_PACK_SENT; + ++ /* set the time at the very last possible point */ ++ gettimeofday(&h->last_time,&tz); ++ bcopy(&h->last_time,&buffer[SIZE_ICMP_HDR],SIZE_LAST_TIME); ++ + icp->icmp_cksum = in_cksum( (u_short *)icp, len ); + + n = sendto( s, buffer, len, 0, (struct sockaddr *)&h->saddr, +@@ -578,10 +582,12 @@ + return 1; /* packet received, don't about it anymore */ + } + ++ /* get time of receipt as close to the real time as possible */ ++ gettimeofday(¤t_time,&tz); ++ + n=icp->icmp_seq; + h=table[n]; + +- gettimeofday(¤t_time,&tz); + bcopy(&icp->icmp_data[0],&sent_time,sizeof(sent_time)); + bcopy(&icp->icmp_data[SIZE_LAST_TIME],&the_index, sizeof(the_index)); + this_reply = timeval_diff(¤t_time,&sent_time); +@@ -594,7 +600,7 @@ + if (dns_flag) printf("%s",get_host_by_address(response_addr.sin_addr)); + else printf("%s",h->host); + if (verbose_flag) printf(" is alive"); +- if (elapsed_flag) printf(" (%d msec)",this_reply); ++ if (elapsed_flag) printf(" (%.3f msec)",this_reply/1000.0); + printf("\n"); + } + num_alive++; +@@ -756,7 +762,7 @@ + + temp = + (((a->tv_sec*1000000)+ a->tv_usec) - +- ((b->tv_sec*1000000)+ b->tv_usec))/1000; ++ ((b->tv_sec*1000000)+ b->tv_usec)); + + return (long) temp; + diff --git a/net/fping/patches/patch-ac b/net/fping/patches/patch-ac new file mode 100644 index 00000000000..b6d0ebaad82 --- /dev/null +++ b/net/fping/patches/patch-ac @@ -0,0 +1,54 @@ +$NetBSD: patch-ac,v 1.1.1.1 2000/05/19 10:20:36 abs Exp $ + +--- fping.man.orig Sat Jan 22 15:46:58 2000 ++++ fping.man Sat Jan 22 15:47:38 2000 +@@ -1,4 +1,4 @@ +-.TH fping l ++.TH fping 8 + .SH NAME + fping \- send ICMP ECHO_REQUEST packets to network hosts + .SH SYNOPSIS +@@ -45,7 +45,7 @@ + .IP \fB-f\fR 5 + Read list of system from a file. + .IP \fB-i\fIn\fR 5 +-The minimum amount of time (in milliseconds) between sending a ping packet to any host (default is 25). ++The minimum amount of time (in microseconds) between sending a ping packet to any host (default is 25). + .IP \fB-q\fR 5 + Quiet. Don't show per host results, just set final exit status. + .IP \fB-r\fIn\fR 5 +@@ -54,8 +54,8 @@ + .IP \fB-s\fR 5 + Dump final statistics. + .IP \fB-t\fIn\fR 5 +-Individual host timeout in milliseconds (default 2500). This is the +-minimum number of milliseconds between ping packets directed towards a given ++Individual host timeout in microseconds (default 2500). This is the ++minimum number of microseconds between ping packets directed towards a given + host. + .IP \fB-u\fR 5 + Show systems that are unreachable. +@@ -70,12 +70,12 @@ + example none the less. + .nf + +-#!/usr/local/bin/perl ++#!/usr/pkg/bin/perl + require 'open2.pl'; + + $MAILTO = "root"; + +-$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u"); ++$pid = &open2("OUTPUT","INPUT","/usr/pkg/sbin/fping -u"); + + @check=("slapshot","foo","foobar"); + +@@ -96,7 +96,7 @@ + that are currently reachable. + .nf + +-#!/usr/local/bin/perl ++#!/usr/pkg/bin/perl + + $hosts_to_backup = `cat /etc/hosts.backup | fping -a`; + diff --git a/net/fping/pkg/COMMENT b/net/fping/pkg/COMMENT new file mode 100644 index 00000000000..76a6849ec08 --- /dev/null +++ b/net/fping/pkg/COMMENT @@ -0,0 +1 @@ +Quickly ping many hosts w/o flooding the network diff --git a/net/fping/pkg/DESCR b/net/fping/pkg/DESCR new file mode 100644 index 00000000000..0e7d998a6ca --- /dev/null +++ b/net/fping/pkg/DESCR @@ -0,0 +1,14 @@ +A tool to quickly ping N number of hosts to determine their reachability +without flooding the network. + + fping is different from ping in that you can specify any number of + hosts on the command line, or specify a file containing the lists + of hosts to ping. Instead of trying one host until it timeouts or + replies, fping will send out a ping packet and move on to the next + host in a round-robin fashion. If a host replies, it is noted and + removed from the list of hosts to check. If a host does not respond + within a certain time limit and/or retry limit it will be considered + unreachable. + + Unlike ping, fping is meant to be used in scripts and its + output is easy to parse. diff --git a/net/fping/pkg/PLIST b/net/fping/pkg/PLIST new file mode 100644 index 00000000000..4caf6733468 --- /dev/null +++ b/net/fping/pkg/PLIST @@ -0,0 +1,2 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2000/05/19 10:20:36 abs Exp $ +sbin/fping |