From b83d1f1237e92d837a33d7aceaa3d400ffe98de0 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 15 Mar 2009 11:24:40 +0100 Subject: [PATCH] src/oping.c: Print the received TTL, too. --- src/oping.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/oping.c b/src/oping.c index cfbe18a..bc33c27 100644 --- a/src/oping.c +++ b/src/oping.c @@ -171,18 +171,26 @@ static void print_host (pingobj_iter_t *iter) { double latency; unsigned int sequence; + int recv_ttl; size_t buffer_len; size_t data_len; ping_context_t *context; + latency = -1.0; buffer_len = sizeof (latency); ping_iterator_get_info (iter, PING_INFO_LATENCY, &latency, &buffer_len); + sequence = 0; buffer_len = sizeof (sequence); ping_iterator_get_info (iter, PING_INFO_SEQUENCE, &sequence, &buffer_len); + recv_ttl = -1; + buffer_len = sizeof (recv_ttl); + ping_iterator_get_info (iter, PING_INFO_RECV_TTL, + &recv_ttl, &buffer_len); + data_len = 0; ping_iterator_get_info (iter, PING_INFO_DATA, NULL, &data_len); @@ -201,10 +209,10 @@ static void print_host (pingobj_iter_t *iter) if ((context->latency_min < 0.0) || (context->latency_min > latency)) context->latency_min = latency; - printf ("%zu bytes from %s (%s): icmp_seq=%u time=%.2f ms\n", + printf ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i time=%.2f ms\n", data_len, context->host, context->addr, - sequence, latency); + sequence, recv_ttl, latency); } else { -- 2.11.0