X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fprotocol_auth.c;h=778c607b2ba74f9fb9683b2df3414a375ac41e83;hb=bfce56d473e1e01a8af0260262ca84f09154e71f;hp=b8d4ee8e7a0658ff1e353fa00f36d5a0ab472fbe;hpb=762db91ef7d3b2eab00c23250ca61c7f814899c7;p=tinc diff --git a/src/protocol_auth.c b/src/protocol_auth.c index b8d4ee8e..778c607b 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -822,6 +822,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;