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
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],
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);
0
};
int timestamp_set = 0;
+ struct cmsghdr *cmsg;
recv_len = recvmsg(socket, &recv_msghdr, 0);
if(recv_len <= 0) {
#if HAVE_SO_TIMESTAMP
/* ancilliary data */
- struct cmsghdr *cmsg;
for(cmsg = CMSG_FIRSTHDR(&recv_msghdr);
cmsg != NULL;
cmsg = CMSG_NXTHDR(&recv_msghdr, cmsg))
{
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;
}
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;
}
}
}
}
- 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);
-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