Ticket #1094: 0001-Make-Nowhere-explicitly-listable-in-torrc.patch

File 0001-Make-Nowhere-explicitly-listable-in-torrc.patch, 2.1 KB (added by nickm, 11 years ago)
  • ChangeLog

    From 57fae70c2d26309ae4dae66438e1ed7418e53933 Mon Sep 17 00:00:00 2001
    From: Nick Mathewson <nickm@torproject.org>
    Date: Tue, 15 Sep 2009 13:41:36 -0400
    Subject: [PATCH] Make Nowhereistan explicitly listable in torrc.
    
    We already had the country code ?? indicating an unknown country, so all we
    needed to do to make unknown countries excludable was to make the ?? code
    discoverable.
    ---
     ChangeLog           |    5 +++++
     src/or/geoip.c      |    1 +
     src/or/routerlist.c |    4 ++++
     3 files changed, 10 insertions(+), 0 deletions(-)
    
    diff --git a/ChangeLog b/ChangeLog
    index 0873136..6643170 100644
    a b Changes in version 0.2.2.2-alpha - 2009-09-?? 
    1414    - Fix parsing for memory or time units given without a space between
    1515      the number and the unit.  Bugfix on 0.2.2.1-alpha; fixes bug 1076.
    1616
     17  o Minor features:
     18    - Add support for the country code "{??}" in torrc options like
     19      ExcludeNodes, to indicate all routers of unknown country.  Fixes bug
     20      1094.
     21
    1722
    1823Changes in version 0.2.2.1-alpha - 2009-08-26
    1924  o Security fixes:
  • src/or/geoip.c

    diff --git a/src/or/geoip.c b/src/or/geoip.c
    index 00e6082..f72541a 100644
    a b geoip_load_file(const char *filename, or_options_t *options) 
    195195            sizeof(geoip_unresolved->countrycode));
    196196    smartlist_add(geoip_countries, geoip_unresolved);
    197197    country_idxplus1_by_lc_code = strmap_new();
     198    strmap_set_lc(country_idxplus1_by_lc_code, "??", (void*)(1));
    198199  }
    199200  if (geoip_entries) {
    200201    SMARTLIST_FOREACH(geoip_entries, geoip_entry_t *, e, tor_free(e));
  • src/or/routerlist.c

    diff --git a/src/or/routerlist.c b/src/or/routerlist.c
    index 0a32f78..5fd42c2 100644
    a b routerset_contains(const routerset_t *set, const tor_addr_t *addr, 
    51175117    if (country < 0 && addr)
    51185118      country = geoip_get_country_by_ip(tor_addr_to_ipv4h(addr));
    51195119
     5120    /* XXXX can we safely move this into geoip_get_country_by_ip? */
     5121    if (country < 0)
     5122      country = 0;
     5123
    51205124    if (country >= 0 && country < set->n_countries &&
    51215125        bitarray_is_set(set->countries, country))
    51225126      return 2;