X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finfo.c;h=562b5ff277afa7d79fc69ffe2670f6bfdcc9500d;hb=a6448291834ca7419553a807ee367c719c2956d0;hp=652c4aebcbecb44af6824f0b036876913f2ddb0d;hpb=0f0585d71b28428792e53258bc570dddc17b0b27;p=tinc diff --git a/src/info.c b/src/info.c index 652c4aeb..562b5ff2 100644 --- a/src/info.c +++ b/src/info.c @@ -70,16 +70,17 @@ static int info_node(int fd, const char *item) { } status_union; node_status_t status; long int last_state_change; - long int udp_ping_rtt; + int udp_ping_rtt; + uint64_t in_packets, in_bytes, out_packets, out_bytes; while(recvline(fd, line, sizeof(line))) { - int n = sscanf(line, "%d %d %4095s %4095s %4095s port %4095s %d %d %d %d %x %"PRIx32" %4095s %4095s %d %hd %hd %hd %ld %ld", &code, &req, node, id, host, port, &cipher, &digest, &maclength, &compression, &options, &status_union.raw, nexthop, via, &distance, &pmtu, &minmtu, &maxmtu, &last_state_change, &udp_ping_rtt); + int n = sscanf(line, "%d %d %4095s %4095s %4095s port %4095s %d %d %d %d %x %"PRIx32" %4095s %4095s %d %hd %hd %hd %ld %d %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, &code, &req, node, id, host, port, &cipher, &digest, &maclength, &compression, &options, &status_union.raw, nexthop, via, &distance, &pmtu, &minmtu, &maxmtu, &last_state_change, &udp_ping_rtt, &in_packets, &in_bytes, &out_packets, &out_bytes); if(n == 2) { break; } - if(n != 20) { + if(n != 24) { fprintf(stderr, "Unable to parse node dump from tincd.\n"); return 1; } @@ -144,8 +145,6 @@ static int info_node(int fd, const char *item) { if(status.udp_confirmed) { printf(" udp_confirmed"); - if(udp_ping_rtt != -1) - printf(" (rtt %ld.%03ld)", udp_ping_rtt/1000, udp_ping_rtt%1000); } printf("\n"); @@ -182,12 +181,19 @@ static int info_node(int fd, const char *item) { printf("unknown\n"); } else if(minmtu > 0) { printf("directly with UDP\nPMTU: %d\n", pmtu); + + if(udp_ping_rtt != -1) { + printf("RTT: %d.%03d\n", udp_ping_rtt / 1000, udp_ping_rtt % 1000); + } } else if(!strcmp(nexthop, item)) { printf("directly with TCP\n"); } else { printf("none, forwarded via %s\n", nexthop); } + printf("RX: %"PRIu64" packets %"PRIu64" bytes\n", in_packets, in_bytes); + printf("TX: %"PRIu64" packets %"PRIu64" bytes\n", out_packets, out_bytes); + // List edges printf("Edges: "); sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_EDGES, item);