Ticket #15421: 15421-workaround-for-non-exits.diff

File 15421-workaround-for-non-exits.diff, 2.0 KB (added by fk, 3 years ago)

#15421 workaround for non-exits

  • src/or/config.c

    From b466e180f8700ae9f5fd6f105ce41f801cf06814 Mon Sep 17 00:00:00 2001
    From: Fabian Keil <fk@fabiankeil.de>
    Date: Thu, 19 Nov 2015 11:52:34 +0100
    Subject: [PATCH 1/2] options_act(): Deduplicate code by moving dns_reset() out
     of both if branches
    
    ---
     src/or/config.c | 8 +++-----
     1 file changed, 3 insertions(+), 5 deletions(-)
    
    diff --git a/src/or/config.c b/src/or/config.c
    index fa860af..db34d7f 100644
    a b options_act(const or_options_t *old_options) 
    17431743          inform_testing_reachability();
    17441744      }
    17451745      cpuworkers_rotate_keyinfo();
    1746       if (dns_reset())
    1747         return -1;
    1748     } else {
    1749       if (dns_reset())
    1750         return -1;
    17511746    }
    17521747
     1748    if (dns_reset())
     1749      return -1;
     1750
    17531751    if (options->PerConnBWRate != old_options->PerConnBWRate ||
    17541752        options->PerConnBWBurst != old_options->PerConnBWBurst)
    17551753      connection_or_update_token_buckets(get_connection_array(), options);
  • src/or/dns.c

    -- 
    2.7.4
    
    
    From 35d1c5676ade70a49675ca5829e27d1117352fae Mon Sep 17 00:00:00 2001
    From: Fabian Keil <fk@fabiankeil.de>
    Date: Thu, 19 Nov 2015 11:58:24 +0100
    Subject: [PATCH 2/2] or/dns: Only configure nameservers when running as exit
    
    Protects non-exits from #15421.
    ---
     src/or/dns.c | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/or/dns.c b/src/or/dns.c
    index d71246d..73d2934 100644
    a b dns_randfn_(char *b, size_t n) 
    218218int
    219219dns_init(void)
    220220{
     221  const or_options_t *options = get_options();
    221222  init_cache_map();
    222223  evdns_set_random_bytes_fn(dns_randfn_);
    223   if (server_mode(get_options())) {
     224  if (options->ExitRelay) {
    224225    int r = configure_nameservers(1);
    225226    return r;
    226227  }
    int 
    233234dns_reset(void)
    234235{
    235236  const or_options_t *options = get_options();
    236   if (! server_mode(options)) {
     237  if (! options->ExitRelay) {
    237238
    238239    if (!the_evdns_base) {
    239240      if (!(the_evdns_base = evdns_base_new(tor_libevent_get_base(), 0))) {