e = lookup_edge(from, to);
if(e) {
- if(e->weight != weight || e->options != options || sockaddrcmp(&e->address, &address) || sockaddrcmp(&e->local_address, &local_address)) {
+ if(e->weight != weight || e->options != options || sockaddrcmp(&e->address, &address)) {
if(from == myself) {
logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) for ourself which does not match existing entry",
"ADD_EDGE", c->name, c->hostname);
edge_del(e);
graph();
}
+ } else if(sockaddrcmp(&e->local_address, &local_address)) {
+ if(from == myself) {
+ if(e->local_address.sa.sa_family && local_address.sa.sa_family) {
+ // Someone has the wrong local address for ourself. Correct then.
+ logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) for ourself which does not match existing entry",
+ "ADD_EDGE", c->name, c->hostname);
+ send_add_edge(c, e);
+ return true;
+ }
+ // Otherwise, just ignore it.
+ return true;
+ } else if(local_address.sa.sa_family) {
+ // We learned a new local address for this edge.
+ sockaddrfree(&e->local_address);
+ e->local_address = local_address;
+
+ // Tell others about it.
+ if(!tunnelserver)
+ forward_request(c, request);
+
+ return true;
+ }
} else
return true;
} else if(from == myself) {