diff --git a/ChangeLog b/ChangeLog index 4cff164f..4610320c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,18 @@ Unreleased + * INCOMPATIBILITY WARNING: + fping and fping6 are now unified into one binary. This means that for + example doing 'fping www.google.com' is going to ping the IPv6 IP of + www.google.com on IPv6-enabled hosts. If you need exact compatibility with + old versions, you can: + - compile fping with --disable-ipv6 (or use a wrapper, and call 'fping -4') + - compile fping with --enable-ipv6 and rename it to fping6 (same as 'fping -6') + * (feature) Unified 'fping' and 'fping6' into one binary * (feature) New option '-4' to force IPv4 * (feature) New option '-6' to force IPv6 * (feature) Support kernel-timestamping of received packets (#46) * (feature) Simplify restrictions: only -i >= 1 and -p >= 10 are enforced now + * (feature) --enable-ipv6 is now default (you can use --disable-ipv6 to disable IPv6 support) * (bugfix) Fix option -m to return all IPs of a hostname * (bugfix) Fix option -H (ttl) for IPv6 * (bugfix) Fix option -M (don't fragment) for IPv6 diff --git a/configure.ac b/configure.ac index acb1ebcb..2a178da0 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script. dnl Minimum Autoconf version required. AC_PREREQ(2.59) -AC_INIT([fping],[3.16-rc1]) +AC_INIT([fping],[3.16-rc2]) dnl make ipv4 and ipv6 options AC_ARG_ENABLE([ipv4], diff --git a/src/fping.c b/src/fping.c index ff56162d..d2e1c357 100644 --- a/src/fping.c +++ b/src/fping.c @@ -405,12 +405,14 @@ int main( int argc, char **argv ) perror("setsockopt IP_MTU_DISCOVER"); } } +#ifdef IPV6 if(socket6) { int val = IPV6_PMTUDISC_DO; if (setsockopt(socket6, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val, sizeof(val))) { perror("setsockopt IPV6_MTU_DISCOVER"); } } +#endif #else fprintf(stderr, "%s, -M option not supported on this platform\n", prog); exit(1); @@ -1728,6 +1730,7 @@ int receive_packet(int socket, 0 }; int timestamp_set = 0; + struct cmsghdr *cmsg; recv_len = recvmsg(socket, &recv_msghdr, 0); if(recv_len <= 0) { @@ -1736,7 +1739,6 @@ int receive_packet(int socket, #if HAVE_SO_TIMESTAMP /* ancilliary data */ - struct cmsghdr *cmsg; for(cmsg = CMSG_FIRSTHDR(&recv_msghdr); cmsg != NULL; cmsg = CMSG_NXTHDR(&recv_msghdr, cmsg)) diff --git a/src/socket4.c b/src/socket4.c index 8b80d6dd..6d8782b7 100644 --- a/src/socket4.c +++ b/src/socket4.c @@ -104,16 +104,16 @@ unsigned short calcsum(unsigned short *buffer, int length) { unsigned long sum; - // initialize sum to zero and loop until length (in words) is 0 - for (sum=0; length>1; length-=2) // sizeof() returns number of bytes, we're interested in number of words - sum += *buffer++; // add 1 word of buffer to sum and proceed to the next + /* initialize sum to zero and loop until length (in words) is 0 */ + for (sum=0; length>1; length-=2) /* sizeof() returns number of bytes, we're interested in number of words */ + sum += *buffer++; /* add 1 word of buffer to sum and proceed to the next */ - // we may have an extra byte + /* we may have an extra byte */ if (length==1) sum += (char)*buffer; - sum = (sum >> 16) + (sum & 0xFFFF); // add high 16 to low 16 - sum += (sum >> 16); // add carry + sum = (sum >> 16) + (sum & 0xFFFF); /* add high 16 to low 16 */ + sum += (sum >> 16); /* add carry */ return ~sum; } @@ -131,7 +131,7 @@ int socket_sendto_ping_ipv4(int s, struct sockaddr *saddr, socklen_t saddr_len, icp->icmp_id = htons(icmp_id_nr); if (random_data_flag) { - for (n = ((void*)&icp->icmp_data - (void *)icp); n < ping_pkt_size_ipv4; ++n) { + for (n = ((char*)&icp->icmp_data - (char *)icp); n < ping_pkt_size_ipv4; ++n) { ping_buffer_ipv4[n] = random() & 0xFF; } } diff --git a/src/socket6.c b/src/socket6.c index fac7a098..1a2f27fa 100644 --- a/src/socket6.c +++ b/src/socket6.c @@ -116,7 +116,7 @@ int socket_sendto_ping_ipv6(int s, struct sockaddr *saddr, socklen_t saddr_len, } } - icp->icmp6_cksum = 0; // The IPv6 stack calculates the checksum for us... + icp->icmp6_cksum = 0; /* The IPv6 stack calculates the checksum for us... */ n = sendto(s, icp, ping_pkt_size_ipv6, 0, saddr, saddr_len); diff --git a/src/test-c89.sh b/src/test-c89.sh index aa5f3e98..c90a1483 100755 --- a/src/test-c89.sh +++ b/src/test-c89.sh @@ -1 +1,5 @@ -gcc -DHAVE_CONFIG_H -D_BSD_SOURCE -D_POSIX_SOURCE -I.. -Wall -std=c89 -pedantic -c -o fping.o fping.c +#!/bin/sh + +for f in fping.c socket4.c socket6.c seqmap.c; do + gcc -DHAVE_CONFIG_H -D_BSD_SOURCE -D_POSIX_SOURCE -I.. -Wall -std=c89 -pedantic -c -o /dev/null $f +done