summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2016-02-02 15:05:59 +1100
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>2016-02-02 15:05:59 +1100
commit92b1c3b6041d3c760e5351b17d64523965ff99a1 (patch)
tree953707e164872b35c66fb60d53e20ae98e032b77 /src/or
parentf09d03c384b85d64dfe2abca156cd63bf7597979 (diff)
downloadtor-92b1c3b6041d3c760e5351b17d64523965ff99a1.tar.gz
tor-92b1c3b6041d3c760e5351b17d64523965ff99a1.zip
Update ExitPolicy when interface addresses change
Tor exit relays reject local interface addresses in their exit policy. Make sure those policies are updated when interface addresses change.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c
index bd4f7eaa71..1e8c175222 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2195,7 +2195,10 @@ got_libevent_error(void)
void
ip_address_changed(int at_interface)
{
- int server = server_mode(get_options());
+ const or_options_t *options = get_options();
+ int server = server_mode(options);
+ int exit_reject_private = (server && options->ExitRelay
+ && options->ExitPolicyRejectPrivate);
if (at_interface) {
if (! server) {
@@ -2209,10 +2212,15 @@ ip_address_changed(int at_interface)
reset_bandwidth_test();
stats_n_seconds_working = 0;
router_reset_reachability();
- mark_my_descriptor_dirty("IP address changed");
}
}
+ /* Exit relays incorporate interface addresses in their exit policies when
+ * ExitPolicyRejectPrivate is set */
+ if (exit_reject_private || (server && !at_interface)) {
+ mark_my_descriptor_dirty("IP address changed");
+ }
+
dns_servers_relaunch_checks();
}