Fix for botched cherry-pick commit 60fb230.
[tinc] / src / protocol_edge.c
index c000ec0..dc0cf05 100644 (file)
@@ -142,8 +142,18 @@ bool add_edge_h(connection_t *c, const char *request) {
                        } else {
                                logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) which does not match existing entry",
                                                   "ADD_EDGE", c->name, c->hostname);
-                               edge_del(e);
-                               graph();
+                               e->options = options;
+                               if(sockaddrcmp(&e->address, &address)) {
+                                       sockaddrfree(&e->address);
+                                       e->address = address;
+                               }
+                               if(e->weight != weight) {
+                                       splay_node_t *node = splay_unlink(edge_weight_tree, e);
+                                       e->weight = weight;
+                                       splay_insert_node(edge_weight_tree, node);
+                               }
+
+                               goto done;
                        }
                } else if(sockaddrcmp(&e->local_address, &local_address)) {
                        if(from == myself) {
@@ -201,6 +211,7 @@ bool add_edge_h(connection_t *c, const char *request) {
        e->weight = weight;
        edge_add(e);
 
+done:
        /* Tell the rest about the new edge */
 
        if(!tunnelserver)