X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_auth.c;h=778c607b2ba74f9fb9683b2df3414a375ac41e83;hb=127f2f99f3d43e0565782750f26f1d3980c72711;hp=b8d4ee8e7a0658ff1e353fa00f36d5a0ab472fbe;hpb=b0d80c7f28528c2c8857c5662b4aca779b3184bb;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;