summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cf72bb2)
raw | patch | inline | side by side (parent: cf72bb2)
author | Vladimir V. Melnikov <wlad.w.m@gmail.com> | |
Mon, 23 Mar 2009 08:30:26 +0000 (09:30 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 23 Mar 2009 08:30:26 +0000 (09:30 +0100) |
If it's not included in the auxiliary data, fall back to the value
included in the IPv4 header which is provided via the raw socket.
included in the IPv4 header which is provided via the raw socket.
src/liboping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index f00e0b6dd040baeb16668541a23b5b6e7ffa427c..101c9606d58138b0420afc7f563ebb86be8d4dbe 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
@@ -342,6 +342,8 @@ static pinghost_t *ping_receive_ipv4 (pinghost_t *ph, char *buffer, size_t buffe
dprintf ("No match found for ident = 0x%04x, seq = %i\n",
ident, seq);
}
+
+ ptr->recv_ttl = ip_hdr->ip_ttl;
return (ptr);
}
dprintf ("Read %zi bytes from fd = %i\n", payload_buffer_len, fd);
/* Iterate over all auxiliary data in msghdr */
- family = -1;
+ family = ph->addrfamily;
recv_ttl = -1;
for (cmsg = CMSG_FIRSTHDR (&msghdr); /* {{{ */
cmsg != NULL;
(int) diff.tv_sec,
(int) diff.tv_usec);
+ if (recv_ttl >= 0)
+ host->recv_ttl = recv_ttl;
+
host->latency = ((double) diff.tv_usec) / 1000.0;
host->latency += ((double) diff.tv_sec) * 1000.0;
- host->recv_ttl = recv_ttl;
-
timerclear (host->timer);
return (0);