Also, reformat the code and fix a compiler warning.
if(status.udp_confirmed) {
printf(" udp_confirmed");
- if(udp_ping_rtt != -1)
- printf(" (rtt %ld.%03ld)", udp_ping_rtt / 1000, udp_ping_rtt % 1000);
++
++ if(udp_ping_rtt != -1) {
++ printf(" (rtt %d.%03d)", udp_ping_rtt / 1000, udp_ping_rtt % 1000);
++ }
}
printf("\n");
len = ntohs(len16);
}
- logger(DEBUG_TRAFFIC, LOG_INFO, "Got type %d UDP probe reply %d from %s (%s)", DATA(packet)[0], len, n->name, n->hostname);
- if (n->udp_ping_sent.tv_sec != 0) { // a probe in flight
++ if(n->udp_ping_sent.tv_sec != 0) { // a probe in flight
+ gettimeofday(&now, NULL);
+ struct timeval rtt;
+ timersub(&now, &n->udp_ping_sent, &rtt);
- n->udp_ping_rtt = rtt.tv_sec*1000000 + rtt.tv_usec;
++ n->udp_ping_rtt = rtt.tv_sec * 1000000 + rtt.tv_usec;
+ logger(DEBUG_TRAFFIC, LOG_INFO, "Got type %d UDP probe reply %d from %s (%s) rtt=%d.%03d", DATA(packet)[0], len, n->name, n->hostname, n->udp_ping_rtt / 1000, n->udp_ping_rtt % 1000);
+ } else {
+ logger(DEBUG_TRAFFIC, LOG_INFO, "Got type %d UDP probe reply %d from %s (%s)", DATA(packet)[0], len, n->name, n->hostname);
+ }
/* It's a valid reply: now we know bidirectional communication
is possible using the address and socket that the reply
continue;
}
- printf("%s id %s at %s port %s cipher %d digest %d maclength %d compression %d options %x status %04x nexthop %s via %s distance %d pmtu %d (min %d max %d)\n",
- node, id, host, port, cipher, digest, maclength, compression, options, status_int, nexthop, via, distance, pmtu, minmtu, maxmtu);
+ printf("%s id %s at %s port %s cipher %d digest %d maclength %d compression %d options %x status %04x nexthop %s via %s distance %d pmtu %d (min %d max %d) rx %"PRIu64" %"PRIu64" tx %"PRIu64" %"PRIu64,
+ node, id, host, port, cipher, digest, maclength, compression, options, status_int, nexthop, via, distance, pmtu, minmtu, maxmtu, in_packets, in_bytes, out_packets, out_bytes);
- if (udp_ping_rtt != -1)
++
++ if(udp_ping_rtt != -1) {
+ printf(" rtt %d.%03d", udp_ping_rtt / 1000, udp_ping_rtt % 1000);
++ }
++
+ printf("\n");
}
}
break;