diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-09-19 15:53:36 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-09-19 15:53:36 +0000 |
commit | 5e81b0ecb8ef0b6747491fe91051097dc3526b4d (patch) | |
tree | dd4d4c82a09222628adc17d75caef7aee5c0f62d /src/or/dns.c | |
parent | faeedbb8af87aebcf2ebd66c937994d11b5343fd (diff) | |
download | tor-5e81b0ecb8ef0b6747491fe91051097dc3526b4d.tar.gz tor-5e81b0ecb8ef0b6747491fe91051097dc3526b4d.zip |
r15170@catbus: nickm | 2007-09-19 11:41:50 -0400
Carry a new evdns function over from libevent: do not rely on compile-time code to set the transaction ID correctly. This will be important when we finally drop our internal copy of eventdns.c
svn:r11517
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index b03cbb5aad..64cfcb024e 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -179,11 +179,21 @@ evdns_log_cb(int warn, const char *msg) log(severity, LD_EXIT, "eventdns: %s", msg); } +/** Helper: generate a good random transaction ID. */ +static uint16_t +dns_get_transaction_id(void) +{ + uint16_t result; + crypto_rand((void*)&result, sizeof(result)); + return result; +} + /** Initialize the DNS subsystem; called by the OR process. */ int dns_init(void) { init_cache_map(); + evdns_set_transaction_id_fn(dns_get_transaction_id); if (server_mode(get_options())) return configure_nameservers(1); return 0; |