Code

svn merge -r773:775 branches/collectd-3.9 branches/collectd-3.8
[collectd.git] / src / liboping / liboping.c
index b57f8e2201c857fcc14c611991801bdb556d1e0b..46db24471be5dd8d84e93da91018d2b1033e47c1 100644 (file)
@@ -198,7 +198,7 @@ static pinghost_t *ping_receive_ipv4 (pinghost_t *ph, char *buffer, size_t buffe
        for (ptr = ph; ptr != NULL; ptr = ptr->next)
        {
                dprintf ("hostname = %s, ident = 0x%04x, seq = %i\n",
-                               ptr->hostname, ptr->ident, ptr->sequence - 1);
+                               ptr->hostname, ptr->ident, ((ptr->sequence - 1) & 0xFFFF));
 
                if (ptr->addrfamily != AF_INET)
                        continue;
@@ -209,7 +209,7 @@ static pinghost_t *ping_receive_ipv4 (pinghost_t *ph, char *buffer, size_t buffe
                if (ptr->ident != ident)
                        continue;
 
-               if ((ptr->sequence - 1) != seq)
+               if (((ptr->sequence - 1) & 0xFFFF) != seq)
                        continue;
 
                dprintf ("Match found: hostname = %s, ident = 0x%04x, seq = %i\n",
@@ -261,7 +261,7 @@ static pinghost_t *ping_receive_ipv6 (pinghost_t *ph, char *buffer, size_t buffe
        for (ptr = ph; ptr != NULL; ptr = ptr->next)
        {
                dprintf ("hostname = %s, ident = 0x%04x, seq = %i\n",
-                               ptr->hostname, ptr->ident, ptr->sequence - 1);
+                               ptr->hostname, ptr->ident, ((ptr->sequence - 1) & 0xFFFF));
 
                if (ptr->addrfamily != AF_INET6)
                        continue;
@@ -272,7 +272,7 @@ static pinghost_t *ping_receive_ipv6 (pinghost_t *ph, char *buffer, size_t buffe
                if (ptr->ident != ident)
                        continue;
 
-               if ((ptr->sequence - 1) != seq)
+               if (((ptr->sequence - 1) & 0xFFFF) != seq)
                        continue;
 
                dprintf ("Match found: hostname = %s, ident = 0x%04x, seq = %i\n",
@@ -856,6 +856,7 @@ int ping_host_add (pingobj_t *obj, const char *host)
                        continue;
                }
 
+#if 0
                if (bind (ph->fd, (struct sockaddr *) &sockaddr, sockaddr_len) == -1)
                {
                        dprintf ("bind: %s\n", strerror (errno));
@@ -863,6 +864,7 @@ int ping_host_add (pingobj_t *obj, const char *host)
                        ph->fd = -1;
                        continue;
                }
+#endif
 
                assert (sizeof (struct sockaddr_storage) >= ai_ptr->ai_addrlen);
                memset (ph->addr, '\0', sizeof (struct sockaddr_storage));