X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_auth.c;h=ac486ea6f0ba0b34b12eacc75b66990d45f7391f;hb=b22499668a7aa63c619cb8fa8535282a38841ce9;hp=b8d4ee8e7a0658ff1e353fa00f36d5a0ab472fbe;hpb=b0d80c7f28528c2c8857c5662b4aca779b3184bb;p=tinc diff --git a/src/protocol_auth.c b/src/protocol_auth.c index b8d4ee8e..ac486ea6 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -805,7 +805,6 @@ bool ack_h(connection_t *c, const char *request) { /* Activate this connection */ c->allow_request = ALL; - c->status.active = true; logger(DEBUG_CONNECTIONS, LOG_NOTICE, "Connection with %s (%s) activated", c->name, c->hostname); @@ -822,6 +821,16 @@ bool ack_h(connection_t *c, const char *request) { sockaddr2str(&c->address, &hisaddress, NULL); c->edge->address = str2sockaddr(hisaddress, hisport); free(hisaddress); + sockaddr_t local_sa; + socklen_t local_salen = sizeof local_sa; + if (getsockname(c->socket, &local_sa.sa, &local_salen) < 0) + logger(DEBUG_ALWAYS, LOG_WARNING, "Could not get local socket address for connection with %s", c->name); + else { + char *local_address; + sockaddr2str(&local_sa, &local_address, NULL); + c->edge->local_address = str2sockaddr(local_address, myport); + free(local_address); + } c->edge->weight = (weight + c->estimated_weight) / 2; c->edge->connection = c; c->edge->options = c->options;