diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2011-11-16 14:07:10 +0100 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2011-11-16 16:05:46 +0100 |
commit | 688b53059e56ddbc287de688258ebdd51b94e001 (patch) | |
tree | ed40654308125e94e61a5de370e7e75435b5bb83 /src/or/connection_or.c | |
parent | c4a4ac7de6d32482fad36ce5af9b1e932cd506cb (diff) | |
download | tor-688b53059e56ddbc287de688258ebdd51b94e001.tar.gz tor-688b53059e56ddbc287de688258ebdd51b94e001.zip |
Don't fail to send netinfo if real_addr is unset
If we haven't set real_addr on a connection, we also now that _base.addr
hasn't been tampered with. So we can use that.
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r-- | src/or/connection_or.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 18ee0dfcf8..320d8cb501 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -1923,7 +1923,11 @@ connection_or_send_netinfo(or_connection_t *conn) /* Their address. */ out = cell.payload + 4; - len = append_address_to_payload(out, &conn->real_addr); + /* We use &conn->real_addr below, unless it hasn't yet been set. If it + * hasn't yet been set, we know that _base.addr hasn't been tampered with + * yet either. */ + len = append_address_to_payload(out, !tor_addr_is_null(&conn->real_addr) + ? &conn->real_addr : &conn->_base.addr); if (len<0) return -1; out += len; |