Prevent large amounts of UDP probes being sent consecutively.
[tinc] / src / protocol_edge.c
index 18b6bef..d650c36 100644 (file)
@@ -70,7 +70,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 +85,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;
@@ -237,7 +237,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;