diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-10-28 17:13:37 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-11-14 23:16:21 -0500 |
commit | ca8843df0adb088b028b5599cd3062ea608f716b (patch) | |
tree | 01ec663df0343f0e9a007981faf8fb1b6229a316 /src/or/addressmap.c | |
parent | 7908ab209350782646dfc112d346ea75974b9dec (diff) | |
download | tor-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/addressmap.c')
-rw-r--r-- | src/or/addressmap.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/or/addressmap.c b/src/or/addressmap.c index fec83a7eb0..4aa46fc6ec 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -571,7 +571,8 @@ client_dns_clear_failures(const char *address) * <b>ttl</b>seconds; otherwise, we use the default. */ static void -client_dns_set_addressmap_impl(const char *address, const char *name, +client_dns_set_addressmap_impl(origin_circuit_t *on_circ, + const char *address, const char *name, const char *exitname, int ttl) { @@ -579,6 +580,7 @@ client_dns_set_addressmap_impl(const char *address, const char *name, char extendedaddress[MAX_SOCKS_ADDR_LEN+MAX_VERBOSE_NICKNAME_LEN+10]; /* 123.123.123.123.<hex or nickname>.exit\0 or just 123.123.123.123\0 */ char extendedval[INET_NTOA_BUF_LEN+MAX_VERBOSE_NICKNAME_LEN+10]; + (void)on_circ; tor_assert(address); tor_assert(name); @@ -617,7 +619,8 @@ client_dns_set_addressmap_impl(const char *address, const char *name, * <b>ttl</b>seconds; otherwise, we use the default. */ void -client_dns_set_addressmap(const char *address, uint32_t val, +client_dns_set_addressmap(origin_circuit_t *on_circ, + const char *address, uint32_t val, const char *exitname, int ttl) { @@ -631,7 +634,7 @@ client_dns_set_addressmap(const char *address, uint32_t val, in.s_addr = htonl(val); tor_inet_ntoa(&in,valbuf,sizeof(valbuf)); - client_dns_set_addressmap_impl(address, valbuf, exitname, ttl); + client_dns_set_addressmap_impl(on_circ, address, valbuf, exitname, ttl); } /** Add a cache entry noting that <b>address</b> (ordinarily a dotted quad) @@ -644,13 +647,14 @@ client_dns_set_addressmap(const char *address, uint32_t val, * <b>ttl</b>seconds; otherwise, we use the default. */ void -client_dns_set_reverse_addressmap(const char *address, const char *v, +client_dns_set_reverse_addressmap(origin_circuit_t *on_circ, + const char *address, const char *v, const char *exitname, int ttl) { char *s = NULL; tor_asprintf(&s, "REVERSE[%s]", address); - client_dns_set_addressmap_impl(s, v, exitname, ttl); + client_dns_set_addressmap_impl(on_circ, s, v, exitname, ttl); tor_free(s); } |