summaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-13 16:59:31 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-13 16:59:31 -0400
commitda8297dbcb6a44d2291878b01779500640e4d0b1 (patch)
tree969bb6b8fdb514dd6100b20e3e65bcc4df50ef7f /src/or/config.c
parenta3ae591115ba5c4a43ff4fa3839be274aac9e5c3 (diff)
downloadtor-da8297dbcb6a44d2291878b01779500640e4d0b1.tar.gz
tor-da8297dbcb6a44d2291878b01779500640e4d0b1.zip
Handle transitions in Automap*, VirtualAddrNetwork correctly
Previously, if they changed in torrc during a SIGHUP, all was well, since we would just clear all transient entries from the addrmap thanks to bug 1345. But if you changed them from the controller, Tor would leave old mappings in place. The VirtualAddrNetwork bug has been here since 0.1.1.19-rc; the AutomapHosts* bug has been here since 0.2.0.1-alpha.
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 147cc66b6b..9c68b6fa59 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1265,6 +1265,7 @@ options_act(or_options_t *old_options)
/* Check for transitions that need action. */
if (old_options) {
int revise_trackexithosts = 0;
+ int revise_automap_entries = 0;
if ((options->UseEntryGuards && !old_options->UseEntryGuards) ||
!routerset_equal(old_options->ExcludeNodes,options->ExcludeNodes) ||
!routerset_equal(old_options->ExcludeExitNodes,
@@ -1287,6 +1288,20 @@ options_act(or_options_t *old_options)
if (revise_trackexithosts)
addressmap_clear_excluded_trackexithosts(options);
+ if (old_options->AutomapHostsOnResolve && !options->AutomapHostsOnResolve) {
+ revise_automap_entries = 1;
+ } else if (options->AutomapHostsOnResolve) {
+ if (!smartlist_strings_eq(old_options->AutomapHostsSuffixes,
+ options->AutomapHostsSuffixes))
+ revise_automap_entries = 1;
+ else if (!opt_streq(old_options->VirtualAddrNetwork,
+ options->VirtualAddrNetwork))
+ revise_automap_entries = 1;
+ }
+
+ if (revise_automap_entries)
+ addressmap_clear_invalid_automaps(options);
+
/* How long should we delay counting bridge stats after becoming a bridge?
* We use this so we don't count people who used our bridge thinking it is
* a relay. If you change this, don't forget to change the log message