X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finfo.c;h=25e6b60c971dad1ed1044474efa1bed210a0f0d5;hb=c44b08613508c993e7fd9f625e0b1b4775efffed;hp=4ca67ec4fd8a60c2e3502d2b730f60e829b78e85;hpb=70e1e467f93f885da3e49289e96757d5cd2ae5ba;p=tinc diff --git a/src/info.c b/src/info.c index 4ca67ec4..25e6b60c 100644 --- a/src/info.c +++ b/src/info.c @@ -1,6 +1,6 @@ /* info.c -- Show information about a node, subnet or address - Copyright (C) 2012-2017 Guus Sliepen + Copyright (C) 2012-2022 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,26 @@ #include "system.h" #include "control_common.h" -#include "list.h" +#include "info.h" +#include "logger.h" #include "subnet.h" #include "tincctl.h" -#include "info.h" #include "utils.h" -#include "xalloc.h" void logger(int level, int priority, const char *format, ...) { + (void)level; + (void)priority; va_list ap; + va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); + fputc('\n', stderr); } char *strip_weight(char *netstr) { - int len = strlen(netstr); + size_t len = strlen(netstr); if(len >= 3 && !strcmp(netstr + len - 3, "#10")) { netstr[len - 3] = 0; @@ -145,8 +148,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"); @@ -183,6 +184,10 @@ 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 { @@ -293,7 +298,7 @@ static int info_subnet(int fd, const char *item) { continue; } - if(memcmp(&find.net.ipv4.address, &subnet.net.ipv4.address, sizeof(subnet.net.ipv4))) { + if(memcmp(&find.net.ipv4.address, &subnet.net.ipv4.address, sizeof(subnet.net.ipv4.address))) { continue; } } @@ -307,14 +312,14 @@ static int info_subnet(int fd, const char *item) { continue; } - if(memcmp(&find.net.ipv6.address, &subnet.net.ipv6.address, sizeof(subnet.net.ipv6))) { + if(memcmp(&find.net.ipv6.address, &subnet.net.ipv6.address, sizeof(subnet.net.ipv6.address))) { continue; } } } if(find.type == SUBNET_MAC) { - if(memcmp(&find.net.mac.address, &subnet.net.mac.address, sizeof(subnet.net.mac))) { + if(memcmp(&find.net.mac.address, &subnet.net.mac.address, sizeof(subnet.net.mac.address))) { continue; } }