]> git.gsnw.org Git - fping.git/commitdiff
compatibility fixes and prepare rc2
authorDavid Schweikert <david@schweikert.ch>
Tue, 31 Jan 2017 12:53:47 +0000 (13:53 +0100)
committerDavid Schweikert <david@schweikert.ch>
Tue, 31 Jan 2017 12:53:47 +0000 (13:53 +0100)
ChangeLog
configure.ac
src/fping.c
src/socket4.c
src/socket6.c
src/test-c89.sh

index 4cff164f86887485a0f743ffdde8448981bbf17b..4610320ce684c310573f1016d39751feeeb27422 100644 (file)
--- 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
index acb1ebcbecc8da9872258ac1cf189144f28dd465..2a178da04422e46ae3193b2af9aa52bb2097d3ff 100644 (file)
@@ -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],
index ff56162ded30acd3e374024d4bfbb797d6a5e565..d2e1c35703c760f3cff12061aecbb681f3f62249 100644 (file)
@@ -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))
index 8b80d6dd4728dc5808b364380ec5149673d449ae..6d8782b70e7ccf0d2b19324d9dfc3c6a75048736 100644 (file)
@@ -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;
         }
     }
index fac7a09845aa8dce9b40f54cafd757a56aadc7f3..1a2f27facd38ada90da9da3d385e5488151c2bd0 100644 (file)
@@ -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);
 
index aa5f3e9877aecab9d6ab9335e0884e00fa0d0b42..c90a1483184e5da30896e50a3a608869d0a000fc 100755 (executable)
@@ -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