View | Details | Raw Unified | Return to bug 169949 | Differences between
and this patch

Collapse All | Expand All

(-)net/fping/Makefile (-15 / +3 lines)
Lines 7-20 Link Here
7
#
7
#
8
8
9
PORTNAME=	fping
9
PORTNAME=	fping
10
PORTVERSION=	2.4b2
10
PORTVERSION=	3.2
11
PORTREVISION=	1
12
CATEGORIES=	net ipv6
11
CATEGORIES=	net ipv6
13
MASTER_SITES=	http://keyserver.kjsl.com/~jharris/distfiles/
12
MASTER_SITES=   http://fping.org/dist/
14
#MASTER_SITES=	http://www.fping.com/download/
15
DISTNAME=	${PORTNAME}-${PORTVERSION}_to-ipv6
16
13
17
MAINTAINER=	jharris@widomaker.com
14
MAINTAINER=	rodrigo@bebik.net
18
COMMENT=	Quickly ping N hosts w/o flooding the network
15
COMMENT=	Quickly ping N hosts w/o flooding the network
19
16
20
PLIST_FILES=	sbin/fping
17
PLIST_FILES=	sbin/fping
Lines 23-37 Link Here
23
CONFIGURE_ARGS=	--bindir="${PREFIX}/sbin"
20
CONFIGURE_ARGS=	--bindir="${PREFIX}/sbin"
24
MAN8=		fping.8
21
MAN8=		fping.8
25
22
26
.if defined(WITH_IPV6)
27
# IPv6 not enabled by default, as it does not work together with IPv4.
28
CFLAGS+=	-DIPV6
29
.endif
30
31
post-patch:
32
	@${REINPLACE_CMD} -e 's/fping@/${MAINTAINER:S/@/\\@/g} or fping@/g' \
33
		${WRKSRC}/fping.c
34
35
post-install:
23
post-install:
36
	@${STRIP_CMD} ${PREFIX}/sbin/fping
24
	@${STRIP_CMD} ${PREFIX}/sbin/fping
37
	@${CHMOD} 4555 ${PREFIX}/sbin/fping
25
	@${CHMOD} 4555 ${PREFIX}/sbin/fping
(-)net/fping/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (fping-2.4b2_to-ipv6.tar.gz) = 77e1a90af4fff4a5ffc4b70542c6ff44130558357e7d549f99a9eff23108d172
1
SHA256 (fping-3.2.tar.gz) = b26739a1fa3471775ff1958a1e3d7597f12c9eb56429c29cf956e52f5046e2c1
2
SIZE (fping-2.4b2_to-ipv6.tar.gz) = 63333
2
SIZE (fping-3.2.tar.gz) = 137967
(-)net/fping/files/patch-02 (-146 lines)
Lines 1-146 Link Here
1
--- fping.c.orig	Mon Jan 21 02:06:30 2002
2
+++ fping.c	Tue Jul 12 18:11:30 2005
3
@@ -42,7 +42,6 @@
4
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
5
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6
  */
7
-#define IPV6 1						/* This should be a compiler option, or even better be done from the Makefile... ;) */
8
 
9
 #ifndef _NO_PROTO
10
 #if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \
11
@@ -67,7 +66,7 @@
12
 
13
 /*** autoconf includes ***/
14
 
15
-
16
+#include <sys/types.h>
17
 #include <stdio.h>
18
 #include <errno.h>
19
 #include <time.h>
20
@@ -88,7 +87,6 @@
21
 #include <string.h>
22
 #include <stddef.h>
23
 
24
-#include <sys/types.h>
25
 #include <sys/time.h>
26
 #include <sys/socket.h>
27
 
28
@@ -112,6 +110,10 @@
29
 #include <arpa/inet.h>
30
 #include <netdb.h>
31
 
32
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
33
+#include <sys/param.h>
34
+#endif
35
+
36
 /* RS6000 has sys/select.h */
37
 #ifdef HAVE_SYS_SELECT_H
38
 #include <sys/select.h>
39
@@ -246,13 +248,13 @@
40
      struct timeval       last_send_time;     /* time of last packet sent */
41
      int                  num_sent;           /* number of ping packets sent */
42
      int                  num_recv;           /* number of pings received */
43
-     int                  max_reply;          /* longest response time */
44
-     int                  min_reply;          /* shortest response time */
45
+     long                 max_reply;          /* longest response time */
46
+     long                 min_reply;          /* shortest response time */
47
      int                  total_time;         /* sum of response times */
48
      int                  num_sent_i;         /* number of ping packets sent */
49
      int                  num_recv_i;         /* number of pings received */
50
-     int                  max_reply_i;        /* longest response time */
51
-     int                  min_reply_i;        /* shortest response time */
52
+     long                 max_reply_i;        /* longest response time */
53
+     long                 min_reply_i;        /* shortest response time */
54
      int                  total_time_i;       /* sum of response times */
55
      int                  *resp_times;        /* individual response times */
56
 #if defined( DEBUG ) || defined( _DEBUG )
57
@@ -482,7 +484,7 @@
58
 
59
 	}/* IF */
60
 
61
-	prog = argv[0];
62
+	prog = (prog = strrchr(argv[0], '/')) ? prog + 1 : argv[0];
63
 	ident = getpid() & 0xFFFF;
64
 
65
 	verbose_flag = 1;
66
@@ -502,8 +504,8 @@
67
 			break;
68
 		
69
 		case 'r':
70
-			if( !( retry = ( u_int )atoi( optarg ) ) )
71
-				usage();
72
+			retry = ( u_int )atoi( optarg );
73
+
74
 
75
 			break;
76
 		
77
@@ -823,6 +825,7 @@
78
 
79
 		while( fgets( line, 132, ping_file ) )
80
 		{
81
+			line[132-1] = '\0';
82
 			if( sscanf( line, "%s", host ) != 1 )
83
 				continue;
84
 			
85
@@ -1503,7 +1506,6 @@
86
 	memset( buffer, 0, ping_pkt_size * sizeof( char ) );
87
 	icp = ( FPING_ICMPHDR* )buffer;
88
 
89
-	gettimeofday( &h->last_send_time, &tz );
90
 #ifndef IPV6
91
 	icp->icmp_type = ICMP_ECHO;
92
 	icp->icmp_code = 0;
93
@@ -1512,6 +1514,8 @@
94
 	icp->icmp_id = ident;
95
 
96
 	pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
97
+	/* set the time at the very last possible point */
98
+	gettimeofday(&h->last_send_time,&tz);
99
 	pdp->ping_ts = h->last_send_time;
100
 	pdp->ping_count = h->num_sent;
101
 
102
@@ -1523,6 +1527,8 @@
103
 	icp->icmp6_id = ident;
104
 
105
 	pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR );
106
+	/* set the time at the very last possible point */
107
+	gettimeofday(&h->last_send_time,&tz);
108
 	pdp->ping_ts = h->last_send_time;
109
 	pdp->ping_count = h->num_sent;
110
 
111
@@ -1611,6 +1617,9 @@
112
 
113
 	result = recvfrom_wto( s, buffer, sizeof(buffer), &response_addr, select_time );
114
 
115
+	/* get time of receipt as close to the real time as possible */
116
+	gettimeofday(&current_time,&tz);
117
+
118
 	if( result < 0 )
119
 		return 0;	/* timeout */
120
   
121
@@ -1625,7 +1634,7 @@
122
 
123
 	ip = ( struct ip* )buffer;
124
 #ifndef IPV6
125
-#if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ )
126
+#if defined( __alpha__ ) && defined(__osf1__) && __STDC__ && !defined( __GLIBC__ )
127
 	/* The alpha headers are decidedly broken.
128
 	 * Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
129
 	 * ip_v.  So, to get ip_hl, we mask off the bottom four bits.
130
@@ -1633,7 +1642,7 @@
131
 	hlen = ( ip->ip_vhl & 0x0F ) << 2;
132
 #else
133
 	hlen = ip->ip_hl << 2;
134
-#endif /* defined(__alpha__) && __STDC__ */
135
+#endif /* defined(__alpha__) && defined(__osf1__) && __STDC__ */
136
 	if( result < hlen + ICMP_MINLEN )
137
 #else
138
 	if( result < sizeof(FPING_ICMPHDR) )
139
@@ -1690,7 +1699,6 @@
140
 	h = table[n];
141
 
142
 	/* received ping is cool, so process it */
143
-	gettimeofday( &current_time, &tz );
144
 	h->waiting = 0;
145
 	h->timeout = timeout;
146
 	h->num_recv++;
(-)net/fping/files/patch-03 (-32 lines)
Lines 1-32 Link Here
1
--- fping.8.orig	Mon Jan 21 01:05:48 2002
2
+++ fping.8	Sun Jul  7 22:03:43 2002
3
@@ -1,4 +1,4 @@
4
-.TH fping l
5
+.TH fping 8
6
 .SH NAME
7
 fping \- send ICMP ECHO_REQUEST packets to network hosts
8
 .SH SYNOPSIS
9
@@ -152,12 +152,12 @@
10
 example none the less. 
11
 .nf
12
 
13
-#!/usr/local/bin/perl
14
+#!/usr/bin/perl
15
 require 'open2.pl';
16
 
17
 $MAILTO = "root";
18
 
19
-$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u");
20
+$pid = &open2("OUTPUT","INPUT","/usr/local/sbin/fping -u");
21
 
22
 @check=("slapshot","foo","foobar");
23
 
24
@@ -178,7 +178,7 @@
25
 that are currently reachable.
26
 .nf
27
 
28
-#!/usr/local/bin/perl
29
+#!/usr/bin/perl
30
 
31
 $hosts_to_backup = `cat /etc/hosts.backup | fping -a`;
32
 
(-)net/fping/files/patch-sourceaddr (-88 lines)
Lines 1-88 Link Here
1
diff -ru ../fping-2.4b2_to-ipv6-orig/fping.c ./fping.c
2
--- ../fping-2.4b2_to-ipv6-orig/fping.c	Sun Jan 20 19:06:30 2002
3
+++ ./fping.c	Fri Apr 13 14:36:02 2007
4
@@ -283,6 +283,12 @@
5
 u_int count = 1;
6
 u_int trials;
7
 u_int report_interval = 0;
8
+int src_addr_present = 0;
9
+#ifndef IPV6
10
+struct in_addr src_addr;
11
+#else
12
+struct in6_addr src_addr;
13
+#endif
14
 
15
 /* global stats */
16
 long max_reply = 0;
17
@@ -408,6 +414,11 @@
18
 	struct protoent *proto;
19
 	char *buf;
20
 	uid_t uid;
21
+#ifndef IPV6
22
+	struct sockaddr_in sa;
23
+#else
24
+	struct sockaddr_in6 sa;
25
+#endif
26
 	/* check if we are root */
27
 
28
 	if( geteuid() )
29
@@ -491,7 +502,7 @@
30
 
31
 	/* get command line options */
32
 
33
-	while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:" ) ) != EOF )
34
+	while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:S:" ) ) != EOF )
35
 	{
36
 		switch( c )
37
 		{
38
@@ -639,6 +650,16 @@
39
 			generate_flag = 1;
40
 			break;
41
 
42
+		case 'S':
43
+#ifndef IPV6
44
+			if( ! inet_pton( AF_INET, optarg, &src_addr ) )
45
+#else
46
+			if( ! inet_pton( AF_INET6, optarg, &src_addr ) )
47
+#endif
48
+				usage();
49
+			src_addr_present = 1;
50
+			break;
51
+
52
 		default:
53
 			usage();
54
 			break;
55
@@ -962,6 +983,22 @@
56
 	if( !num_hosts )
57
 		exit( 2 );
58
 
59
+	/* set the source address */
60
+
61
+	if( src_addr_present )
62
+	{
63
+		memset( &sa, 0, sizeof( sa ) );
64
+#ifndef IPV6
65
+		sa.sin_family = AF_INET;
66
+		sa.sin_addr = src_addr;
67
+#else
68
+		sa.sin6_family = AF_INET6;
69
+		sa.sin6_addr = src_addr;
70
+#endif
71
+		if ( bind( s, (struct sockaddr *)&sa, sizeof( sa ) ) < 0 )
72
+			errno_crash_and_burn( "cannot bind source address" );
73
+	}
74
+
75
 	/* allocate array to hold outstanding ping requests */
76
 
77
 	table = ( HOST_ENTRY** )malloc( sizeof( HOST_ENTRY* ) * num_hosts );
78
@@ -2732,6 +2769,7 @@
79
 	fprintf( stderr, "   -Q n       same as -q, but show summary every n seconds\n" );
80
 	fprintf( stderr, "   -r n       number of retries (default %d)\n", retry );
81
 	fprintf( stderr, "   -s         print final stats\n" );
82
+	fprintf( stderr, "   -S addr    set source address\n" );
83
 	fprintf( stderr, "   -t n       individual target initial timeout (in millisec) (default %d)\n", timeout / 100 );
84
 	fprintf( stderr, "   -u         show targets that are unreachable\n" );
85
 	fprintf( stderr, "   -v         show version\n" );
86
87
88
(-)net/fping/pkg-descr (-1 / +1 lines)
Lines 13-16 Link Here
13
     Unlike ping, fping is meant to be used in scripts and its
13
     Unlike ping, fping is meant to be used in scripts and its
14
     output is easy to parse.
14
     output is easy to parse.
15
15
16
WWW: http://www.fping.com/
16
WWW: http://www.fping.org/

Return to bug 169949