1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

[NEW PORT] net/fping+ipv6: Quickly ping N hosts w/o flooding the

network - IPv6 version

	This is an IPv6 only version of fping. The fping with IPv6 patch cannot handle
	IPv4 ping, therefore I think it is better to have two distinct port:
	fping - IPv4 only
	fping+ipv6 - IPv6 only

	Maintainer of fping also copied. He can maintain both port if he agrees.
	-------------------------------------------------

	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.
	This is an IPv6 only version.

	WWW: http://www.fping.com/

	Generated with FreeBSD Port Tools 0.77

PR:		ports/112185
Submitted by:	Janos Mohacsi <janos.mohacsi@bsd.hu>
This commit is contained in:
Edwin Groothuis 2007-09-28 12:26:52 +00:00
parent 5f310ab022
commit 52761a44f8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=200266
6 changed files with 240 additions and 0 deletions

View File

@ -129,6 +129,7 @@
SUBDIR += fpc-netdb
SUBDIR += fpc-pcap
SUBDIR += fping
SUBDIR += fping+ipv6
SUBDIR += freebsd-uucp
SUBDIR += freedbd
SUBDIR += freenet6

39
net/fping+ipv6/Makefile Normal file
View File

@ -0,0 +1,39 @@
# ex:ts=8
# Ports collection makefile for: fping
# Date created: Tue Mar 25, 1997
# Whom: David O'Brien (obrien@NUXI.com)
#
# $FreeBSD$
#
PORTNAME= fping
PORTVERSION= 2.4b2
CATEGORIES= net ipv6
MASTER_SITES= http://keyserver.kjsl.com/~jharris/distfiles/
#MASTER_SITES= http://www.fping.com/download/
PKGNAMESUFFIX= +ipv6
DISTNAME= ${PORTNAME}-${PORTVERSION}_to-ipv6
MAINTAINER= jharris@widomaker.com
COMMENT= Quickly ping N hosts w/o flooding the network - IPv6 version
PLIST_FILES= sbin/fping6
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --bindir="${PREFIX}/sbin"
MAN8= fping.8
USE_DOS2UNIX= fping.8
# IPv6 enabled since it is a IPv6 only version
CFLAGS+= -DIPV6
post-patch:
@${REINPLACE_CMD} -e 's/fping@/${MAINTAINER:S/@/\\@/g} or fping@/g' \
${WRKSRC}/fping.c
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/fping ${PREFIX}/sbin/fping6
@${CHMOD} 4555 ${PREFIX}/sbin/fping6
${INSTALL_MAN} ${WRKSRC}/fping.8 ${PREFIX}/man/man8
.include <bsd.port.mk>

5
net/fping+ipv6/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (fping-2.4b2_to-ipv6.tar.gz) = 3ad516765514249a40d3c5b6caab812a
SHA1 (fping-2.4b2_to-ipv6.tar.gz) = d310c6fe951f64660d4c0a5f2bd1c5379c1e5bde
RMD160 (fping-2.4b2_to-ipv6.tar.gz) = cff101a53baec9cc23063ff2004db69a3510c51f
SHA256 (fping-2.4b2_to-ipv6.tar.gz) = 77e1a90af4fff4a5ffc4b70542c6ff44130558357e7d549f99a9eff23108d172
SIZE (fping-2.4b2_to-ipv6.tar.gz) = 63333

View File

@ -0,0 +1,146 @@
--- fping.c.orig Mon Jan 21 02:06:30 2002
+++ fping.c Tue Jul 12 18:11:30 2005
@@ -42,7 +42,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define IPV6 1 /* This should be a compiler option, or even better be done from the Makefile... ;) */
#ifndef _NO_PROTO
#if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \
@@ -67,7 +66,7 @@
/*** autoconf includes ***/
-
+#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
@@ -88,7 +87,6 @@
#include <string.h>
#include <stddef.h>
-#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
@@ -112,6 +110,10 @@
#include <arpa/inet.h>
#include <netdb.h>
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
/* RS6000 has sys/select.h */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
@@ -246,13 +248,13 @@
struct timeval last_send_time; /* time of last packet sent */
int num_sent; /* number of ping packets sent */
int num_recv; /* number of pings received */
- int max_reply; /* longest response time */
- int min_reply; /* shortest response time */
+ long max_reply; /* longest response time */
+ long min_reply; /* shortest response time */
int total_time; /* sum of response times */
int num_sent_i; /* number of ping packets sent */
int num_recv_i; /* number of pings received */
- int max_reply_i; /* longest response time */
- int min_reply_i; /* shortest response time */
+ long max_reply_i; /* longest response time */
+ long min_reply_i; /* shortest response time */
int total_time_i; /* sum of response times */
int *resp_times; /* individual response times */
#if defined( DEBUG ) || defined( _DEBUG )
@@ -482,7 +484,7 @@
}/* IF */
- prog = argv[0];
+ prog = (prog = strrchr(argv[0], '/')) ? prog + 1 : argv[0];
ident = getpid() & 0xFFFF;
verbose_flag = 1;
@@ -502,8 +504,8 @@
break;
case 'r':
- if( !( retry = ( u_int )atoi( optarg ) ) )
- usage();
+ retry = ( u_int )atoi( optarg );
+
break;
@@ -823,6 +825,7 @@
while( fgets( line, 132, ping_file ) )
{
+ line[132-1] = '\0';
if( sscanf( line, "%s", host ) != 1 )
continue;
@@ -1503,7 +1506,6 @@
memset( buffer, 0, ping_pkt_size * sizeof( char ) );
icp = ( FPING_ICMPHDR* )buffer;
- gettimeofday( &h->last_send_time, &tz );
#ifndef IPV6
icp->icmp_type = ICMP_ECHO;
icp->icmp_code = 0;
@@ -1512,6 +1514,8 @@
icp->icmp_id = ident;
pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
+ /* set the time at the very last possible point */
+ gettimeofday(&h->last_send_time,&tz);
pdp->ping_ts = h->last_send_time;
pdp->ping_count = h->num_sent;
@@ -1523,6 +1527,8 @@
icp->icmp6_id = ident;
pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
+ /* set the time at the very last possible point */
+ gettimeofday(&h->last_send_time,&tz);
pdp->ping_ts = h->last_send_time;
pdp->ping_count = h->num_sent;
@@ -1611,6 +1617,9 @@
result = recvfrom_wto( s, buffer, sizeof(buffer), &response_addr, select_time );
+ /* get time of receipt as close to the real time as possible */
+ gettimeofday(&current_time,&tz);
+
if( result < 0 )
return 0; /* timeout */
@@ -1625,7 +1634,7 @@
ip = ( struct ip* )buffer;
#ifndef IPV6
-#if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ )
+#if defined( __alpha__ ) && defined(__osf1__) && __STDC__ && !defined( __GLIBC__ )
/* The alpha headers are decidedly broken.
* Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
* ip_v. So, to get ip_hl, we mask off the bottom four bits.
@@ -1633,7 +1642,7 @@
hlen = ( ip->ip_vhl & 0x0F ) << 2;
#else
hlen = ip->ip_hl << 2;
-#endif /* defined(__alpha__) && __STDC__ */
+#endif /* defined(__alpha__) && defined(__osf1__) && __STDC__ */
if( result < hlen + ICMP_MINLEN )
#else
if( result < sizeof(FPING_ICMPHDR) )
@@ -1690,7 +1699,6 @@
h = table[n];
/* received ping is cool, so process it */
- gettimeofday( &current_time, &tz );
h->waiting = 0;
h->timeout = timeout;
h->num_recv++;

View File

@ -0,0 +1,32 @@
--- fping.8.orig Mon Jan 21 01:05:48 2002
+++ fping.8 Sun Jul 7 22:03:43 2002
@@ -1,4 +1,4 @@
-.TH fping l
+.TH fping 8
.SH NAME
fping \- send ICMP ECHO_REQUEST packets to network hosts
.SH SYNOPSIS
@@ -152,12 +152,12 @@
example none the less.
.nf
-#!/usr/local/bin/perl
+#!/usr/bin/perl
require 'open2.pl';
$MAILTO = "root";
-$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u");
+$pid = &open2("OUTPUT","INPUT","/usr/local/sbin/fping -u");
@check=("slapshot","foo","foobar");
@@ -178,7 +178,7 @@
that are currently reachable.
.nf
-#!/usr/local/bin/perl
+#!/usr/bin/perl
$hosts_to_backup = `cat /etc/hosts.backup | fping -a`;

17
net/fping+ipv6/pkg-descr Normal file
View File

@ -0,0 +1,17 @@
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.
This is an IPv6 only version.
WWW: http://www.fping.com/