From: Sebastian Harl Date: Fri, 17 Jul 2009 07:39:35 +0000 (+0200) Subject: src/liboping.c: Do not reset recv_ttl in ping_receive_one(). X-Git-Tag: liboping-1.3.0~12 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2af6e8235f7843a86f6ec519655617f8b114a935;p=liboping.git 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. --- 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) {