From: octo Date: Tue, 9 May 2006 06:22:33 +0000 (+0000) Subject: Fixed the nasty bug in the ping plugin: The sequence wasn't checked correctly. Argh. X-Git-Tag: svn-trunk~32 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fd2768eefe98a7fa7cc4d53a1a6c83a61f9e52b9;p=collectd.git Fixed the nasty bug in the ping plugin: The sequence wasn't checked correctly. Argh. --- diff --git a/src/liboping/liboping.c b/src/liboping/liboping.c index de66cd53..469907b2 100644 --- a/src/liboping/liboping.c +++ b/src/liboping/liboping.c @@ -248,7 +248,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; @@ -259,7 +259,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", @@ -311,7 +311,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; @@ -322,7 +322,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",