From 2af6e8235f7843a86f6ec519655617f8b114a935 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 17 Jul 2009 09:39:35 +0200 Subject: [PATCH] src/liboping.c: Do not reset recv_ttl in ping_receive_one(). Instead, reset the value of all host object in ping_receive_all(). ping_receive_one() does not necessarily get a pointer to the host object for which we receive a reply, since ICMP messages may be received on _any_ raw socket. --- src/liboping.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/liboping.c b/src/liboping.c index 51071ad..2ccbf4d 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -478,7 +478,6 @@ static int ping_receive_one (int fd, pinghost_t *ph, struct timeval *now) /* Iterate over all auxiliary data in msghdr */ recv_ttl = -1; - ph->recv_ttl = -1; for (cmsg = CMSG_FIRSTHDR (&msghdr); /* {{{ */ cmsg != NULL; cmsg = CMSG_NXTHDR (&msghdr, cmsg)) @@ -592,7 +591,10 @@ static int ping_receive_all (pingobj_t *obj) ret = 0; for (ptr = ph; ptr != NULL; ptr = ptr->next) - ptr->latency = -1.0; + { + ptr->latency = -1.0; + ptr->recv_ttl = -1; + } if (gettimeofday (&nowtime, NULL) == -1) { -- 2.11.0