]>
Commit | Line | Data |
---|---|---|
1dabfe82 MP |
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 | |
4 | @@ -1,4 +1,4 @@ | |
5 | -/* config.h.in. Generated automatically from configure.in by autoheader. */ | |
6 | +/* config.h.in. Generated from configure.in by autoheader. */ | |
7 | #ifndef CONFIG_H | |
8 | #define CONFIG_H | |
9 | ||
10 | @@ -6,31 +6,77 @@ | |
11 | /* VERSION (from configure.in) */ | |
12 | #undef VERSION | |
13 | ||
14 | -/* Define if you have the <stdlib.h> header file. */ | |
15 | + | |
16 | + | |
17 | +/* Define if you want to enable IPv6 support */ | |
18 | +#undef ENABLE_IPV6 | |
19 | + | |
20 | +/* Define if getaddrinfo exists and works */ | |
21 | +#undef HAVE_GETADDRINFO | |
22 | + | |
23 | +/* Define to 1 if you have the <inttypes.h> header file. */ | |
24 | +#undef HAVE_INTTYPES_H | |
25 | + | |
26 | +/* Define to 1 if you have the `nsl' library (-lnsl). */ | |
27 | +#undef HAVE_LIBNSL | |
28 | + | |
29 | +/* Define to 1 if you have the `socket' library (-lsocket). */ | |
30 | +#undef HAVE_LIBSOCKET | |
31 | + | |
32 | +/* Define to 1 if you have the <memory.h> header file. */ | |
33 | +#undef HAVE_MEMORY_H | |
34 | + | |
35 | +/* Define to 1 if you have the <stdint.h> header file. */ | |
36 | +#undef HAVE_STDINT_H | |
37 | + | |
38 | +/* Define to 1 if you have the <stdlib.h> header file. */ | |
39 | #undef HAVE_STDLIB_H | |
40 | ||
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 | |
44 | + | |
45 | +/* Define to 1 if you have the <string.h> header file. */ | |
46 | +#undef HAVE_STRING_H | |
47 | + | |
48 | +/* Define to 1 if you have the <sys/file.h> header file. */ | |
49 | #undef HAVE_SYS_FILE_H | |
50 | ||
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 | |
54 | ||
55 | -/* Define if you have the <unistd.h> header file. */ | |
56 | -#undef HAVE_UNISTD_H | |
57 | +/* Define to 1 if you have the <sys/stat.h> header file. */ | |
58 | +#undef HAVE_SYS_STAT_H | |
59 | ||
60 | -/* Define if you have the nsl library (-lnsl). */ | |
61 | -#undef HAVE_LIBNSL | |
62 | +/* Define to 1 if you have the <sys/types.h> header file. */ | |
63 | +#undef HAVE_SYS_TYPES_H | |
64 | ||
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. */ | |
68 | +#undef HAVE_UNISTD_H | |
69 | ||
70 | /* Name of package */ | |
71 | #undef PACKAGE | |
72 | ||
73 | +/* Define to the address where bug reports for this package should be sent. */ | |
74 | +#undef PACKAGE_BUGREPORT | |
75 | + | |
76 | +/* Define to the full name of this package. */ | |
77 | +#undef PACKAGE_NAME | |
78 | + | |
79 | +/* Define to the full name and version of this package. */ | |
80 | +#undef PACKAGE_STRING | |
81 | + | |
82 | +/* Define to the one symbol short name of this package. */ | |
83 | +#undef PACKAGE_TARNAME | |
84 | + | |
85 | +/* Define to the version of this package. */ | |
86 | +#undef PACKAGE_VERSION | |
87 | + | |
88 | +/* Define to 1 if you have the ANSI C header files. */ | |
89 | +#undef STDC_HEADERS | |
90 | + | |
91 | /* Version number of package */ | |
92 | #undef VERSION | |
93 | ||
94 | - | |
95 | /* some OSes do not define this ... lets take a wild guess */ | |
96 | ||
97 | #ifndef INADDR_NONE | |
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 | |
101 | @@ -14,6 +14,84 @@ | |
102 | AC_PROG_CC | |
103 | AC_PROG_CPP | |
104 | AC_PROG_INSTALL | |
105 | +AC_PROG_AWK | |
106 | + | |
107 | +dnl ********************************************************************** | |
108 | +dnl Checks for IPv6 | |
109 | +dnl ********************************************************************** | |
110 | +dnl borrowed from curl | |
111 | + | |
112 | +AC_MSG_CHECKING([whether to enable ipv6]) | |
113 | +AC_ARG_ENABLE(ipv6, | |
114 | +[ --enable-ipv6 Enable ipv6 (with ipv4) support | |
115 | + --disable-ipv6 Disable ipv6 support], | |
116 | +[ case "$enableval" in | |
117 | + no) | |
118 | + AC_MSG_RESULT(no) | |
119 | + ipv6=no | |
120 | + ;; | |
121 | + *) AC_MSG_RESULT(yes) | |
122 | + ipv6=yes | |
123 | + ;; | |
124 | + esac ], | |
125 | + | |
126 | + AC_TRY_RUN([ /* is AF_INET6 available? */ | |
127 | +#include <sys/types.h> | |
128 | +#include <sys/socket.h> | |
129 | +main() | |
130 | +{ | |
131 | + if (socket(AF_INET6, SOCK_STREAM, 0) < 0) | |
132 | + exit(1); | |
133 | + else | |
134 | + exit(0); | |
135 | +} | |
136 | +], | |
137 | + AC_MSG_RESULT(yes) | |
138 | + ipv6=yes, | |
139 | + AC_MSG_RESULT(no) | |
140 | + ipv6=no, | |
141 | + AC_MSG_RESULT(no) | |
142 | + ipv6=no | |
143 | +)) | |
144 | + | |
145 | +if test "$ipv6" = "yes"; then | |
146 | + AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[ | |
147 | + AC_TRY_RUN( [ | |
148 | +#include <netdb.h> | |
149 | +#include <sys/types.h> | |
150 | +#include <sys/socket.h> | |
151 | + | |
152 | +void main(void) { | |
153 | + struct addrinfo hints, *ai; | |
154 | + int error; | |
155 | + | |
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); | |
160 | + if (error) { | |
161 | + exit(1); | |
162 | + } | |
163 | + else { | |
164 | + exit(0); | |
165 | + } | |
166 | +} | |
167 | +],[ | |
168 | + ac_cv_working_getaddrinfo="yes" | |
169 | +],[ | |
170 | + ac_cv_working_getaddrinfo="no" | |
171 | +],[ | |
172 | + ac_cv_working_getaddrinfo="yes" | |
173 | +])]) | |
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]) | |
177 | + | |
178 | + IPV6_ENABLED=1 | |
179 | + AC_SUBST(IPV6_ENABLED) | |
180 | +fi | |
181 | +fi | |
182 | + | |
183 | ||
184 | dnl Checks for libraries. | |
185 | ||
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 | |
189 | @@ -42,7 +42,6 @@ | |
190 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
191 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
192 | */ | |
193 | -#define IPV6 1 /* This should be a compiler option, or even better be done from the Makefile... ;) */ | |
194 | ||
195 | #ifndef _NO_PROTO | |
196 | #if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \ | |
197 | @@ -96,7 +95,7 @@ | |
198 | #include <sys/file.h> | |
199 | #endif /* HAVE_SYS_FILE_H */ | |
200 | ||
201 | -#ifdef IPV6 | |
202 | +#ifdef ENABLE_IPV6 | |
203 | #include <netinet/icmp6.h> | |
204 | #endif | |
205 | #include <netinet/in_systm.h> | |
206 | @@ -222,7 +221,7 @@ | |
207 | }; | |
208 | ||
209 | #define ICMP_UNREACH_MAXTYPE 15 | |
210 | -#ifndef IPV6 | |
211 | +#ifndef ENABLE_IPV6 | |
212 | #define FPING_SOCKADDR struct sockaddr_in | |
213 | #define FPING_ICMPHDR struct icmp | |
214 | #else | |
215 | @@ -349,7 +348,7 @@ | |
216 | #else | |
217 | ||
218 | void add_name( char *name ); | |
219 | -#ifndef IPV6 | |
220 | +#ifndef ENABLE_IPV6 | |
221 | void add_addr( char *name, char *host, struct in_addr ipaddr ); | |
222 | #else | |
223 | void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr ); | |
224 | @@ -400,7 +399,7 @@ | |
225 | #endif /* _NO_PROTO */ | |
226 | { | |
227 | int c, i, n; | |
228 | -#ifdef IPV6 | |
229 | +#ifdef ENABLE_IPV6 | |
230 | int opton = 1; | |
231 | #endif | |
232 | u_int lt, ht; | |
233 | @@ -420,7 +419,7 @@ | |
234 | }/* IF */ | |
235 | ||
236 | /* confirm that ICMP is available on this machine */ | |
237 | -#ifndef IPV6 | |
238 | +#ifndef ENABLE_IPV6 | |
239 | if( ( proto = getprotobyname( "icmp" ) ) == NULL ) | |
240 | #else | |
241 | if( ( proto = getprotobyname( "ipv6-icmp" ) ) == NULL ) | |
242 | @@ -428,7 +427,7 @@ | |
243 | crash_and_burn( "icmp: unknown protocol" ); | |
244 | ||
245 | /* create raw socket for ICMP calls (ping) */ | |
246 | -#ifndef IPV6 | |
247 | +#ifndef ENABLE_IPV6 | |
248 | s = socket( AF_INET, SOCK_RAW, proto->p_proto ); | |
249 | #else | |
250 | s = socket( AF_INET6, SOCK_RAW, proto->p_proto ); | |
251 | @@ -437,7 +436,7 @@ | |
252 | if( s < 0 ) | |
253 | errno_crash_and_burn( "can't create raw socket" ); | |
254 | ||
255 | -#ifdef IPV6 | |
256 | +#ifdef ENABLE_IPV6 | |
257 | /* | |
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; | |
262 | ||
263 | gettimeofday( &h->last_send_time, &tz ); | |
264 | -#ifndef IPV6 | |
265 | +#ifndef ENABLE_IPV6 | |
266 | icp->icmp_type = ICMP_ECHO; | |
267 | icp->icmp_code = 0; | |
268 | icp->icmp_cksum = 0; | |
269 | @@ -1624,7 +1623,7 @@ | |
270 | #endif /* DEBUG || _DEBUG */ | |
271 | ||
272 | ip = ( struct ip* )buffer; | |
273 | -#ifndef IPV6 | |
274 | +#ifndef ENABLE_IPV6 | |
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 @@ | |
279 | { | |
280 | if( verbose_flag ) | |
281 | { | |
282 | -#ifndef IPV6 | |
283 | +#ifndef ENABLE_IPV6 | |
284 | printf( "received packet too short for ICMP (%d bytes from %s)\n", result, | |
285 | inet_ntoa( response_addr.sin_addr ) ); | |
286 | #else | |
287 | @@ -1654,7 +1653,7 @@ | |
288 | }/* IF */ | |
289 | ||
290 | icp = ( FPING_ICMPHDR* )( buffer + hlen ); | |
291 | -#ifndef IPV6 | |
292 | +#ifndef ENABLE_IPV6 | |
293 | if( icp->icmp_type != ICMP_ECHOREPLY ) | |
294 | #else | |
295 | if( icp->icmp6_type != ICMP6_ECHO_REPLY ) | |
296 | @@ -1666,7 +1665,7 @@ | |
297 | return 1; | |
298 | }/* IF */ | |
299 | ||
300 | -#ifndef IPV6 | |
301 | +#ifndef ENABLE_IPV6 | |
302 | if( icp->icmp_id != ident ) | |
303 | #else | |
304 | if( icp->icmp6_id != ident ) | |
305 | @@ -1675,14 +1674,14 @@ | |
306 | ||
307 | num_pingreceived++; | |
308 | ||
309 | -#ifndef IPV6 | |
310 | +#ifndef ENABLE_IPV6 | |
311 | if( icp->icmp_seq >= ( n_short )num_hosts ) | |
312 | #else | |
313 | if( icp->icmp6_seq >= ( n_short )num_hosts ) | |
314 | #endif | |
315 | return( 1 ); /* packet received, don't worry about it anymore */ | |
316 | ||
317 | -#ifndef IPV6 | |
318 | +#ifndef ENABLE_IPV6 | |
319 | n = icp->icmp_seq; | |
320 | #else | |
321 | n = icp->icmp6_seq; | |
322 | @@ -1696,7 +1695,7 @@ | |
323 | h->num_recv++; | |
324 | h->num_recv_i++; | |
325 | ||
326 | -#ifndef IPV6 | |
327 | +#ifndef ENABLE_IPV6 | |
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 ) ); | |
330 | #else | |
331 | @@ -1732,7 +1731,7 @@ | |
332 | { | |
333 | fprintf( stderr, "%s : duplicate for [%d], %d bytes, %s ms", | |
334 | h->host, this_count, result, sprint_tm( this_reply ) ); | |
335 | -#ifndef IPV6 | |
336 | +#ifndef ENABLE_IPV6 | |
337 | if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr ) | |
338 | fprintf( stderr, " [<- %s]", inet_ntoa( response_addr.sin_addr ) ); | |
339 | #else | |
340 | @@ -1773,7 +1772,7 @@ | |
341 | ||
342 | if( elapsed_flag ) | |
343 | printf( " (%s ms)", sprint_tm( this_reply ) ); | |
344 | -#ifndef IPV6 | |
345 | +#ifndef ENABLE_IPV6 | |
346 | if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr ) | |
347 | printf( " [<- %s]", inet_ntoa( response_addr.sin_addr ) ); | |
348 | #else | |
349 | @@ -1808,7 +1807,7 @@ | |
350 | ( h->num_recv * 100 ) / h->num_sent ); | |
351 | ||
352 | }/* ELSE */ | |
353 | -#ifndef IPV6 | |
354 | +#ifndef ENABLE_IPV6 | |
355 | if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr ) | |
356 | printf( " [<- %s]", inet_ntoa( response_addr.sin_addr ) ); | |
357 | #else | |
358 | @@ -1856,13 +1855,13 @@ | |
359 | struct ip *sent_ip; | |
360 | u_char *c; | |
361 | HOST_ENTRY *h; | |
362 | -#ifdef IPV6 | |
363 | +#ifdef ENABLE_IPV6 | |
364 | char addr_ascii[INET6_ADDRSTRLEN]; | |
365 | inet_ntop(addr->sin6_family, &addr->sin6_addr, addr_ascii, INET6_ADDRSTRLEN); | |
366 | #endif | |
367 | ||
368 | c = ( u_char* )p; | |
369 | -#ifndef IPV6 | |
370 | +#ifndef ENABLE_IPV6 | |
371 | switch( p->icmp_type ) | |
372 | #else | |
373 | switch( p->icmp6_type ) | |
374 | @@ -1871,7 +1870,7 @@ | |
375 | case ICMP_UNREACH: | |
376 | sent_icmp = ( FPING_ICMPHDR* )( c + 28 ); | |
377 | ||
378 | -#ifndef IPV6 | |
379 | +#ifndef ENABLE_IPV6 | |
380 | sent_icmp = ( struct icmp* )( c + 28 ); | |
381 | ||
382 | if( ( sent_icmp->icmp_type == ICMP_ECHO ) && | |
383 | @@ -1903,7 +1902,7 @@ | |
384 | else | |
385 | { | |
386 | fprintf( stderr, "%s from %s for ICMP Echo sent to %s", | |
387 | -#ifndef IPV6 | |
388 | +#ifndef ENABLE_IPV6 | |
389 | icmp_unreach_str[p->icmp_code], inet_ntoa( addr->sin_addr ), h->host ); | |
390 | #else | |
391 | icmp_unreach_str[p->icmp6_code], addr_ascii, h->host ); | |
392 | @@ -1912,7 +1911,7 @@ | |
393 | }/* ELSE */ | |
394 | ||
395 | if( inet_addr( h->host ) == -1 ) | |
396 | -#ifndef IPV6 | |
397 | +#ifndef ENABLE_IPV6 | |
398 | fprintf( stderr, " (%s)", inet_ntoa( h->saddr.sin_addr ) ); | |
399 | #else | |
400 | fprintf( stderr, " (%s)", addr_ascii); | |
401 | @@ -1929,7 +1928,7 @@ | |
402 | case ICMP_TIMXCEED: | |
403 | case ICMP_PARAMPROB: | |
404 | sent_icmp = ( FPING_ICMPHDR* )( c + 28 ); | |
405 | -#ifndef IPV6 | |
406 | +#ifndef ENABLE_IPV6 | |
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 */ | |
413 | { | |
414 | -#ifndef IPV6 | |
415 | +#ifndef ENABLE_IPV6 | |
416 | struct hostent *host_ent; | |
417 | u_int ipaddress; | |
418 | struct in_addr *ipa = ( struct in_addr* )&ipaddress; | |
419 | @@ -2243,13 +2242,13 @@ | |
420 | void add_addr( name, host, ipaddr ) | |
421 | char *name; | |
422 | char *host; | |
423 | -#ifndef IPV6 | |
424 | +#ifndef ENABLE_IPV6 | |
425 | struct in_addr ipaddr; | |
426 | #else | |
427 | FPING_SOCKADDR *ipaddr; | |
428 | #endif | |
429 | #else | |
430 | -#ifndef IPV6 | |
431 | +#ifndef ENABLE_IPV6 | |
432 | void add_addr( char *name, char *host, struct in_addr ipaddr ) | |
433 | #else | |
434 | void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr ) | |
435 | @@ -2267,7 +2266,7 @@ | |
436 | ||
437 | p->name = name; | |
438 | p->host = host; | |
439 | -#ifndef IPV6 | |
440 | +#ifndef ENABLE_IPV6 | |
441 | p->saddr.sin_family = AF_INET; | |
442 | p->saddr.sin_addr = ipaddr; | |
443 | #else | |
444 | @@ -2401,7 +2400,7 @@ | |
445 | #endif /* _NO_PROTO */ | |
446 | { | |
447 | struct hostent *h; | |
448 | -#ifndef IPV6 | |
449 | +#ifndef ENABLE_IPV6 | |
450 | h = gethostbyaddr( ( char* )&in, sizeof( struct in_addr ),AF_INET ); | |
451 | #else | |
452 | h = gethostbyaddr( ( char* )&in, sizeof( FPING_SOCKADDR ),AF_INET6 ); | |
453 | @@ -2677,7 +2676,7 @@ | |
454 | if( nfound == 0 ) | |
455 | return -1; /* timeout */ | |
456 | ||
457 | -#ifndef IPV6 | |
458 | +#ifndef ENABLE_IPV6 | |
459 | slen = sizeof( struct sockaddr ); | |
460 | #else | |
461 | slen = sizeof( FPING_SOCKADDR ); |