1 diff -Naur fping-2.4b2_to-ipv6/config.h.in fping-2.4b2_to-ipv6-ac/config.h.in
2 --- fping-2.4b2_to-ipv6/config.h.in Wed Jan 16 01:49:45 2002
3 +++ fping-2.4b2_to-ipv6-ac/config.h.in Thu Nov 7 20:53:14 2002
5 -/* config.h.in. Generated automatically from configure.in by autoheader. */
6 +/* config.h.in. Generated from configure.in by autoheader. */
11 /* VERSION (from configure.in) */
14 -/* Define if you have the <stdlib.h> header file. */
17 +/* Define if you want to enable IPv6 support */
20 +/* Define if getaddrinfo exists and works */
21 +#undef HAVE_GETADDRINFO
23 +/* Define to 1 if you have the <inttypes.h> header file. */
24 +#undef HAVE_INTTYPES_H
26 +/* Define to 1 if you have the `nsl' library (-lnsl). */
29 +/* Define to 1 if you have the `socket' library (-lsocket). */
30 +#undef HAVE_LIBSOCKET
32 +/* Define to 1 if you have the <memory.h> header file. */
35 +/* Define to 1 if you have the <stdint.h> header file. */
38 +/* Define to 1 if you have the <stdlib.h> header file. */
41 -/* Define if you have the <sys/file.h> header file. */
42 +/* Define to 1 if you have the <strings.h> header file. */
43 +#undef HAVE_STRINGS_H
45 +/* Define to 1 if you have the <string.h> header file. */
48 +/* Define to 1 if you have the <sys/file.h> header file. */
49 #undef HAVE_SYS_FILE_H
51 -/* Define if you have the <sys/select.h> header file. */
52 +/* Define to 1 if you have the <sys/select.h> header file. */
53 #undef HAVE_SYS_SELECT_H
55 -/* Define if you have the <unistd.h> header file. */
57 +/* Define to 1 if you have the <sys/stat.h> header file. */
58 +#undef HAVE_SYS_STAT_H
60 -/* Define if you have the nsl library (-lnsl). */
62 +/* Define to 1 if you have the <sys/types.h> header file. */
63 +#undef HAVE_SYS_TYPES_H
65 -/* Define if you have the socket library (-lsocket). */
66 -#undef HAVE_LIBSOCKET
67 +/* Define to 1 if you have the <unistd.h> header file. */
73 +/* Define to the address where bug reports for this package should be sent. */
74 +#undef PACKAGE_BUGREPORT
76 +/* Define to the full name of this package. */
79 +/* Define to the full name and version of this package. */
80 +#undef PACKAGE_STRING
82 +/* Define to the one symbol short name of this package. */
83 +#undef PACKAGE_TARNAME
85 +/* Define to the version of this package. */
86 +#undef PACKAGE_VERSION
88 +/* Define to 1 if you have the ANSI C header files. */
91 /* Version number of package */
95 /* some OSes do not define this ... lets take a wild guess */
98 diff -Naur fping-2.4b2_to-ipv6/configure.in fping-2.4b2_to-ipv6-ac/configure.in
99 --- fping-2.4b2_to-ipv6/configure.in Wed Jan 16 01:48:02 2002
100 +++ fping-2.4b2_to-ipv6-ac/configure.in Thu Nov 7 20:52:17 2002
107 +dnl **********************************************************************
109 +dnl **********************************************************************
110 +dnl borrowed from curl
112 +AC_MSG_CHECKING([whether to enable ipv6])
114 +[ --enable-ipv6 Enable ipv6 (with ipv4) support
115 + --disable-ipv6 Disable ipv6 support],
116 +[ case "$enableval" in
121 + *) AC_MSG_RESULT(yes)
126 + AC_TRY_RUN([ /* is AF_INET6 available? */
127 +#include <sys/types.h>
128 +#include <sys/socket.h>
131 + if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
145 +if test "$ipv6" = "yes"; then
146 + AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
149 +#include <sys/types.h>
150 +#include <sys/socket.h>
153 + struct addrinfo hints, *ai;
156 + memset(&hints, 0, sizeof(hints));
157 + hints.ai_family = AF_UNSPEC;
158 + hints.ai_socktype = SOCK_STREAM;
159 + error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
168 + ac_cv_working_getaddrinfo="yes"
170 + ac_cv_working_getaddrinfo="no"
172 + ac_cv_working_getaddrinfo="yes"
174 +if test "$ac_cv_working_getaddrinfo" = "yes"; then
175 + AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
176 + AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
179 + AC_SUBST(IPV6_ENABLED)
184 dnl Checks for libraries.
186 diff -Naur fping-2.4b2_to-ipv6/fping.c fping-2.4b2_to-ipv6-ac/fping.c
187 --- fping-2.4b2_to-ipv6/fping.c Mon Jan 21 02:06:30 2002
188 +++ fping-2.4b2_to-ipv6-ac/fping.c Thu Nov 7 20:56:42 2002
190 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
191 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
193 -#define IPV6 1 /* This should be a compiler option, or even better be done from the Makefile... ;) */
196 #if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \
198 #include <sys/file.h>
199 #endif /* HAVE_SYS_FILE_H */
203 #include <netinet/icmp6.h>
205 #include <netinet/in_systm.h>
209 #define ICMP_UNREACH_MAXTYPE 15
212 #define FPING_SOCKADDR struct sockaddr_in
213 #define FPING_ICMPHDR struct icmp
218 void add_name( char *name );
221 void add_addr( char *name, char *host, struct in_addr ipaddr );
223 void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr );
225 #endif /* _NO_PROTO */
236 /* confirm that ICMP is available on this machine */
239 if( ( proto = getprotobyname( "icmp" ) ) == NULL )
241 if( ( proto = getprotobyname( "ipv6-icmp" ) ) == NULL )
243 crash_and_burn( "icmp: unknown protocol" );
245 /* create raw socket for ICMP calls (ping) */
248 s = socket( AF_INET, SOCK_RAW, proto->p_proto );
250 s = socket( AF_INET6, SOCK_RAW, proto->p_proto );
253 errno_crash_and_burn( "can't create raw socket" );
258 * let the kerel pass extension headers of incoming packets,
259 * for privileged socket options
260 @@ -1504,7 +1503,7 @@
261 icp = ( FPING_ICMPHDR* )buffer;
263 gettimeofday( &h->last_send_time, &tz );
266 icp->icmp_type = ICMP_ECHO;
269 @@ -1624,7 +1623,7 @@
270 #endif /* DEBUG || _DEBUG */
272 ip = ( struct ip* )buffer;
275 #if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ )
276 /* The alpha headers are decidedly broken.
277 * Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
278 @@ -1641,7 +1640,7 @@
284 printf( "received packet too short for ICMP (%d bytes from %s)\n", result,
285 inet_ntoa( response_addr.sin_addr ) );
287 @@ -1654,7 +1653,7 @@
290 icp = ( FPING_ICMPHDR* )( buffer + hlen );
293 if( icp->icmp_type != ICMP_ECHOREPLY )
295 if( icp->icmp6_type != ICMP6_ECHO_REPLY )
296 @@ -1666,7 +1665,7 @@
302 if( icp->icmp_id != ident )
304 if( icp->icmp6_id != ident )
305 @@ -1675,14 +1674,14 @@
311 if( icp->icmp_seq >= ( n_short )num_hosts )
313 if( icp->icmp6_seq >= ( n_short )num_hosts )
315 return( 1 ); /* packet received, don't worry about it anymore */
322 @@ -1696,7 +1695,7 @@
328 memcpy( &sent_time, icp->icmp_data + offsetof( PING_DATA, ping_ts ), sizeof( sent_time ) );
329 memcpy( &this_count, icp->icmp_data, sizeof( this_count ) );
331 @@ -1732,7 +1731,7 @@
333 fprintf( stderr, "%s : duplicate for [%d], %d bytes, %s ms",
334 h->host, this_count, result, sprint_tm( this_reply ) );
337 if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr )
338 fprintf( stderr, " [<- %s]", inet_ntoa( response_addr.sin_addr ) );
340 @@ -1773,7 +1772,7 @@
343 printf( " (%s ms)", sprint_tm( this_reply ) );
346 if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr )
347 printf( " [<- %s]", inet_ntoa( response_addr.sin_addr ) );
349 @@ -1808,7 +1807,7 @@
350 ( h->num_recv * 100 ) / h->num_sent );
355 if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr )
356 printf( " [<- %s]", inet_ntoa( response_addr.sin_addr ) );
358 @@ -1856,13 +1855,13 @@
364 char addr_ascii[INET6_ADDRSTRLEN];
365 inet_ntop(addr->sin6_family, &addr->sin6_addr, addr_ascii, INET6_ADDRSTRLEN);
371 switch( p->icmp_type )
373 switch( p->icmp6_type )
374 @@ -1871,7 +1870,7 @@
376 sent_icmp = ( FPING_ICMPHDR* )( c + 28 );
380 sent_icmp = ( struct icmp* )( c + 28 );
382 if( ( sent_icmp->icmp_type == ICMP_ECHO ) &&
383 @@ -1903,7 +1902,7 @@
386 fprintf( stderr, "%s from %s for ICMP Echo sent to %s",
389 icmp_unreach_str[p->icmp_code], inet_ntoa( addr->sin_addr ), h->host );
391 icmp_unreach_str[p->icmp6_code], addr_ascii, h->host );
392 @@ -1912,7 +1911,7 @@
395 if( inet_addr( h->host ) == -1 )
398 fprintf( stderr, " (%s)", inet_ntoa( h->saddr.sin_addr ) );
400 fprintf( stderr, " (%s)", addr_ascii);
401 @@ -1929,7 +1928,7 @@
404 sent_icmp = ( FPING_ICMPHDR* )( c + 28 );
407 if( ( sent_icmp->icmp_type = ICMP_ECHO ) &&
408 ( sent_icmp->icmp_id = ident ) &&
409 ( sent_icmp->icmp_seq < ( n_short )num_hosts ) )
410 @@ -2053,7 +2052,7 @@
411 void add_name( char *name )
412 #endif /* _NO_PROTO */
416 struct hostent *host_ent;
418 struct in_addr *ipa = ( struct in_addr* )&ipaddress;
419 @@ -2243,13 +2242,13 @@
420 void add_addr( name, host, ipaddr )
425 struct in_addr ipaddr;
427 FPING_SOCKADDR *ipaddr;
432 void add_addr( char *name, char *host, struct in_addr ipaddr )
434 void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr )
435 @@ -2267,7 +2266,7 @@
441 p->saddr.sin_family = AF_INET;
442 p->saddr.sin_addr = ipaddr;
444 @@ -2401,7 +2400,7 @@
445 #endif /* _NO_PROTO */
450 h = gethostbyaddr( ( char* )&in, sizeof( struct in_addr ),AF_INET );
452 h = gethostbyaddr( ( char* )&in, sizeof( FPING_SOCKADDR ),AF_INET6 );
453 @@ -2677,7 +2676,7 @@
455 return -1; /* timeout */
459 slen = sizeof( struct sockaddr );
461 slen = sizeof( FPING_SOCKADDR );