X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnode.c;h=1f1f94d9625363e4205213fbeb9610c237b6a4b7;hb=6d97cb1e229c22d1d34aa9889aeaf17644ff06dc;hp=862bd69693ca9707e2ebd01076806e0e1bec43cf;hpb=886a6f61a1f4cc48a77b42d10f34f9126377d904;p=tinc diff --git a/src/node.c b/src/node.c index 862bd696..1f1f94d9 100644 --- a/src/node.c +++ b/src/node.c @@ -1,6 +1,6 @@ /* node.c -- node tree management - Copyright (C) 2001-2009 Guus Sliepen , + Copyright (C) 2001-2011 Guus Sliepen , 2001-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -142,6 +142,11 @@ node_t *lookup_node_udp(const sockaddr_t *sa) { } void update_node_udp(node_t *n, const sockaddr_t *sa) { + if(n == myself) { + logger(LOG_WARNING, "Trying to update UDP address of myself!\n"); + return; + } + splay_delete(node_udp_tree, n); if(n->hostname) @@ -174,3 +179,16 @@ bool dump_nodes(connection_t *c) { return send_request(c, "%d %d", CONTROL, REQ_DUMP_NODES); } + +bool dump_traffic(connection_t *c) { + splay_node_t *node; + node_t *n; + + for(node = node_tree->head; node; node = node->next) { + n = node->data; + send_request(c, "%d %d %s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, CONTROL, REQ_DUMP_TRAFFIC, + n->name, n->in_packets, n->in_bytes, n->out_packets, n->out_bytes); + } + + return send_request(c, "%d %d", CONTROL, REQ_DUMP_TRAFFIC); +}