--- AnyEvent-FastPing/FPing.xs 2007/05/04 15:16:14 1.4 +++ AnyEvent-FastPing/FPing.xs 2007/05/04 15:33:56 1.5 @@ -31,6 +31,9 @@ #ifdef __linux # include #endif +#if IPV6 +# include +#endif #define ICMP4_ECHO 8 #define ICMP4_ECHO_REPLY 0 @@ -196,6 +199,12 @@ tstamp now = NOW (); tstamp next = now; + { + int r; + for (r = req->nranges; r--; ) + inc_addr (&req->ranges [r].hi); + } + while (req->nranges) { RANGE *range = req->ranges; @@ -349,10 +358,6 @@ croak ("Net::FPing: unable to create receive pipe"); icmp4_fd = socket (AF_INET, SOCK_RAW, IPPROTO_ICMP); -#if IPV6 - icmp6_fd = socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); -#endif - #ifdef ICMP_FILTER { struct icmp_filter oval; @@ -361,6 +366,18 @@ } #endif +#if IPV6 + icmp6_fd = socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); +# ifdef ICMP6_FILTER + { + struct icmp6_filter oval; + ICMP6_FILTER_SETBLOCKALL (&oval); + ICMP6_FILTER_SETPASS (ICMP6_ECHO_REPLY, &oval); + setsockopt (icmp6_fd, IPPROTO_ICMPV6, ICMP6_FILTER, &oval, sizeof oval); + } +# endif +#endif + pthread_attr_init (&attr); pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); #ifdef PTHREAD_SCOPE_PROCESS