Merge branch 'bug40249_squashed'

This commit is contained in:
Nick Mathewson
2021-02-08 10:31:30 -05:00
10 changed files with 53 additions and 25 deletions
+6 -1
View File
@@ -2733,6 +2733,11 @@ consider_recording_trackhost(const entry_connection_t *conn,
const or_options_t *options = get_options();
char *new_address = NULL;
char fp[HEX_DIGEST_LEN+1];
uint64_t stream_id = 0;
if (conn) {
stream_id = ENTRY_TO_CONN(conn)->global_identifier;
}
/* Search the addressmap for this conn's destination. */
/* If they're not in the address map.. */
@@ -2756,7 +2761,7 @@ consider_recording_trackhost(const entry_connection_t *conn,
addressmap_register(conn->socks_request->address, new_address,
time(NULL) + options->TrackHostExitsExpire,
ADDRMAPSRC_TRACKEXIT, 0, 0);
ADDRMAPSRC_TRACKEXIT, 0, 0, stream_id);
}
/** Attempt to attach the connection <b>conn</b> to <b>circ</b>, and send a
+9 -3
View File
@@ -3519,22 +3519,28 @@ tell_controller_about_resolved_result(entry_connection_t *conn,
int ttl,
time_t expires)
{
uint64_t stream_id = 0;
if (conn) {
stream_id = ENTRY_TO_CONN(conn)->global_identifier;
}
expires = time(NULL) + ttl;
if (answer_type == RESOLVED_TYPE_IPV4 && answer_len >= 4) {
char *cp = tor_dup_ip(ntohl(get_uint32(answer)));
if (cp)
control_event_address_mapped(conn->socks_request->address,
cp, expires, NULL, 0);
cp, expires, NULL, 0, stream_id);
tor_free(cp);
} else if (answer_type == RESOLVED_TYPE_HOSTNAME && answer_len < 256) {
char *cp = tor_strndup(answer, answer_len);
control_event_address_mapped(conn->socks_request->address,
cp, expires, NULL, 0);
cp, expires, NULL, 0, stream_id);
tor_free(cp);
} else {
control_event_address_mapped(conn->socks_request->address,
"<error>", time(NULL)+ttl,
"error=yes", 0);
"error=yes", 0, stream_id);
}
}