[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r18575: {tor} Possible fix for broken country settings in ExcludeExitNodes (in tor/trunk: . src/or)
Author: nickm
Date: 2009-02-16 10:15:06 -0500 (Mon, 16 Feb 2009)
New Revision: 18575
Modified:
tor/trunk/ChangeLog
tor/trunk/src/or/config.c
tor/trunk/src/or/geoip.c
tor/trunk/src/or/or.h
tor/trunk/src/or/routerlist.c
Log:
Possible fix for broken country settings in ExcludeExitNodes.
It turns out that we weren't updating the _ExcludeExitNodesUnion set's
country numbers when we reloaded (or first loaded!) the IP-to-country
file. Spotted by Lark. Bugfix on 0.2.1.6-alpha.
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2009-02-16 14:59:07 UTC (rev 18574)
+++ tor/trunk/ChangeLog 2009-02-16 15:15:06 UTC (rev 18575)
@@ -1,4 +1,9 @@
Changes in version 0.2.1.13-????? - 2009-02-??
+ o Major bugfixes:
+ - Correctly update the list of countries to exclude as exits when
+ the GeoIP file is loaded or reloaded. Diagnosed by lark. Bugfix
+ on 0.2.1.6-alpha.
+
o Minor bugfixes:
- Automatically detect MacOSX versions earlier than 10.4.0, and
disable kqueue from inside Tor when running with these versions.
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2009-02-16 14:59:07 UTC (rev 18574)
+++ tor/trunk/src/or/config.c 2009-02-16 15:15:06 UTC (rev 18575)
@@ -1372,17 +1372,6 @@
#endif
geoip_load_file(actual_fname, options);
tor_free(actual_fname);
-
- /* XXXX Would iterating through all option_var's routersets be better? */
- if (options->EntryNodes)
- routerset_refresh_countries(options->EntryNodes);
- if (options->ExitNodes)
- routerset_refresh_countries(options->ExitNodes);
- if (options->ExcludeNodes)
- routerset_refresh_countries(options->ExcludeNodes);
- if (options->ExcludeExitNodes)
- routerset_refresh_countries(options->ExcludeExitNodes);
- routerlist_refresh_countries();
}
/* Check if we need to parse and add the EntryNodes config option. */
if (options->EntryNodes &&
Modified: tor/trunk/src/or/geoip.c
===================================================================
--- tor/trunk/src/or/geoip.c 2009-02-16 14:59:07 UTC (rev 18574)
+++ tor/trunk/src/or/geoip.c 2009-02-16 15:15:06 UTC (rev 18575)
@@ -206,6 +206,11 @@
fclose(f);
smartlist_sort(geoip_entries, _geoip_compare_entries);
+
+ /* Okay, now we need to maybe change our mind about what is in which
+ * country. */
+ refresh_all_country_info();
+
return 0;
}
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2009-02-16 14:59:07 UTC (rev 18574)
+++ tor/trunk/src/or/or.h 2009-02-16 15:15:06 UTC (rev 18575)
@@ -4514,6 +4514,7 @@
void routerset_free(routerset_t *routerset);
void routerinfo_set_country(routerinfo_t *ri);
void routerlist_refresh_countries(void);
+void refresh_all_country_info(void);
int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
const char *id);
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2009-02-16 14:59:07 UTC (rev 18574)
+++ tor/trunk/src/or/routerlist.c 2009-02-16 15:15:06 UTC (rev 18575)
@@ -5020,6 +5020,26 @@
return r;
}
+/** DOCDOC */
+void
+refresh_all_country_info(void)
+{
+ or_options_t *options = get_options();
+
+ if (options->EntryNodes)
+ routerset_refresh_countries(options->EntryNodes);
+ if (options->ExitNodes)
+ routerset_refresh_countries(options->ExitNodes);
+ if (options->ExcludeNodes)
+ routerset_refresh_countries(options->ExcludeNodes);
+ if (options->ExcludeExitNodes)
+ routerset_refresh_countries(options->ExcludeExitNodes);
+ if (options->_ExcludeExitNodesUnion)
+ routerset_refresh_countries(options->_ExcludeExitNodesUnion);
+
+ routerlist_refresh_countries();
+}
+
/** Add all members of the set <b>source</b> to <b>target</b>. */
void
routerset_union(routerset_t *target, const routerset_t *source)