X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_edge.c;h=524566f0d927d4528ac5e9d4f17d92992ad5a647;hb=04d8a8e34e1fe7f33f1946863b36a24ee358175f;hp=18b6befeca0b77d4b8aaad1e76efe39870973633;hpb=f6e87ab476a0faf8b124ecaaa27f967d825e6457;p=tinc diff --git a/src/protocol_edge.c b/src/protocol_edge.c index 18b6befe..524566f0 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -26,7 +26,6 @@ #include "edge.h" #include "graph.h" #include "logger.h" -#include "meta.h" #include "net.h" #include "netutl.h" #include "node.h" @@ -70,7 +69,7 @@ bool add_edge_h(connection_t *c, const char *request) { char to_port[MAX_STRING_SIZE]; char address_local[MAX_STRING_SIZE]; char port_local[MAX_STRING_SIZE]; - sockaddr_t address, local_address = {{0}}; + sockaddr_t address, local_address = {0}; uint32_t options; int weight; @@ -85,7 +84,7 @@ bool add_edge_h(connection_t *c, const char *request) { /* Check if names are valid */ - if(!check_id(from_name) || !check_id(to_name)) { + if(!check_id(from_name) || !check_id(to_name) || !strcmp(from_name, to_name)) { logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s): %s", "ADD_EDGE", c->name, c->hostname, "invalid name"); return false; @@ -178,9 +177,9 @@ bool add_edge_h(connection_t *c, const char *request) { } if(e->weight != weight) { - splay_node_t *node = splay_unlink(edge_weight_tree, e); + splay_node_t *node = splay_unlink(&edge_weight_tree, e); e->weight = weight; - splay_insert_node(edge_weight_tree, node); + splay_insert_node(&edge_weight_tree, node); } } else if(from == myself) { logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) for ourself which does not exist", @@ -237,7 +236,7 @@ bool del_edge_h(connection_t *c, const char *request) { /* Check if names are valid */ - if(!check_id(from_name) || !check_id(to_name)) { + if(!check_id(from_name) || !check_id(to_name) || !strcmp(from_name, to_name)) { logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s): %s", "DEL_EDGE", c->name, c->hostname, "invalid name"); return false;