PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/specs/fping/fping-ipv6-ac.patch

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