diff options
author | Neel Chauhan <neel@neelc.org> | 2021-01-19 14:51:00 -0800 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-02-08 10:23:41 -0500 |
commit | 2391c60c5c89b104572323a439e3560a09c1a6e2 (patch) | |
tree | 09374510094b2f87717c1535272db4409474deea /src/feature/client/addressmap.c | |
parent | b0af4ddc7c2fe80a79e41e31b7050d949561e044 (diff) | |
download | tor-2391c60c5c89b104572323a439e3560a09c1a6e2.tar.gz tor-2391c60c5c89b104572323a439e3560a09c1a6e2.zip |
Add stream ID to ADDRMAP control event
Diffstat (limited to 'src/feature/client/addressmap.c')
-rw-r--r-- | src/feature/client/addressmap.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/feature/client/addressmap.c b/src/feature/client/addressmap.c index e5bf2cc49c..316fb7ceaa 100644 --- a/src/feature/client/addressmap.c +++ b/src/feature/client/addressmap.c @@ -576,7 +576,7 @@ void addressmap_register(const char *address, char *new_address, time_t expires, addressmap_entry_source_t source, const int wildcard_addr, - const int wildcard_new_addr) + const int wildcard_new_addr, uint64_t stream_id) { addressmap_entry_t *ent; @@ -626,7 +626,8 @@ addressmap_register(const char *address, char *new_address, time_t expires, log_info(LD_CONFIG, "Addressmap: (re)mapped '%s' to '%s'", safe_str_client(address), safe_str_client(ent->new_address)); - control_event_address_mapped(address, ent->new_address, expires, NULL, 1); + control_event_address_mapped(address, ent->new_address, + expires, NULL, 1, stream_id); } /** An attempt to resolve <b>address</b> failed at some OR. @@ -680,11 +681,15 @@ client_dns_set_addressmap_impl(entry_connection_t *for_conn, int ttl) { char *extendedaddress=NULL, *extendedval=NULL; - (void)for_conn; + uint64_t stream_id = 0; tor_assert(address); tor_assert(name); + if (for_conn) { + stream_id = ENTRY_TO_CONN(for_conn)->global_identifier; + } + if (ttl<0) ttl = DEFAULT_DNS_TTL; else @@ -705,7 +710,7 @@ client_dns_set_addressmap_impl(entry_connection_t *for_conn, "%s", name); } addressmap_register(extendedaddress, extendedval, - time(NULL) + ttl, ADDRMAPSRC_DNS, 0, 0); + time(NULL) + ttl, ADDRMAPSRC_DNS, 0, 0, stream_id); tor_free(extendedaddress); } @@ -1043,7 +1048,7 @@ addressmap_register_virtual_address(int type, char *new_address) log_info(LD_APP, "Registering map from %s to %s", *addrp, new_address); if (vent_needs_to_be_added) strmap_set(virtaddress_reversemap, new_address, vent); - addressmap_register(*addrp, new_address, 2, ADDRMAPSRC_AUTOMAP, 0, 0); + addressmap_register(*addrp, new_address, 2, ADDRMAPSRC_AUTOMAP, 0, 0, 0); /* FFFF register corresponding reverse mapping. */ |