summaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-28 17:13:37 -0400
committerNick Mathewson <nickm@torproject.org>2012-11-14 23:16:21 -0500
commitca8843df0adb088b028b5599cd3062ea608f716b (patch)
tree01ec663df0343f0e9a007981faf8fb1b6229a316 /src/or/connection_edge.c
parent7908ab209350782646dfc112d346ea75974b9dec (diff)
downloadtor-ca8843df0adb088b028b5599cd3062ea608f716b.tar.gz
tor-ca8843df0adb088b028b5599cd3062ea608f716b.zip
Refactor client_dns_set_{reverse_,}addressmap() to take a circ
We'd like these functions to be circuit-relative so that we can implement a per-circuit DNS cache and per-circuit DNS cache rules for proposal 205 or its successors. I'm doing this now, as a part of the IPv6 exits code, since there are about to be a few more instances of code using this.
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 1ee88f3cdd..f548576a2c 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1915,14 +1915,21 @@ connection_ap_handshake_socks_resolved(entry_connection_t *conn,
size_t replylen;
if (ttl >= 0) {
+ origin_circuit_t *origin_circ = NULL;
+ circuit_t *circ = ENTRY_TO_EDGE_CONN(conn)->on_circuit;
+ if (CIRCUIT_IS_ORIGIN(circ)) /* should always be true */
+ origin_circ = TO_ORIGIN_CIRCUIT(circ);
if (answer_type == RESOLVED_TYPE_IPV4 && answer_len == 4) {
uint32_t a = ntohl(get_uint32(answer));
- if (a)
- client_dns_set_addressmap(conn->socks_request->address, a,
+ if (a) {
+ client_dns_set_addressmap(origin_circ,
+ conn->socks_request->address, a,
conn->chosen_exit_name, ttl);
+ }
} else if (answer_type == RESOLVED_TYPE_HOSTNAME && answer_len < 256) {
char *cp = tor_strndup((char*)answer, answer_len);
- client_dns_set_reverse_addressmap(conn->socks_request->address,
+ client_dns_set_reverse_addressmap(origin_circ,
+ conn->socks_request->address,
cp,
conn->chosen_exit_name, ttl);
tor_free(cp);