summaryrefslogtreecommitdiff
path: root/src/or/policies.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-11-10 21:17:51 +0000
committerRoger Dingledine <arma@torproject.org>2007-11-10 21:17:51 +0000
commit42b8fb5a152301a1d1d89b390bec5245857dd0e6 (patch)
tree9909487817f05538fd1360154c351fbc99c774ba /src/or/policies.c
parent462643c756cb5b4791635ff39b2009608d971579 (diff)
downloadtor-42b8fb5a152301a1d1d89b390bec5245857dd0e6.tar.gz
tor-42b8fb5a152301a1d1d89b390bec5245857dd0e6.zip
Exit policies now reject connections that are addressed to a
relay's public (external) IP address too, unless ExitPolicyRejectPrivate is turned off. We do this because too many relays are running nearby to services that trust them based on network address. svn:r12459
Diffstat (limited to 'src/or/policies.c')
-rw-r--r--src/or/policies.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index 62b98a4762..ba3a375a1b 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -228,7 +228,7 @@ validate_addr_policies(or_options_t *options, char **msg)
*msg = NULL;
if (policies_parse_exit_policy(options->ExitPolicy, &addr_policy,
- options->ExitPolicyRejectPrivate))
+ options->ExitPolicyRejectPrivate, NULL))
REJECT("Error in ExitPolicy entry.");
/* The rest of these calls *append* to addr_policy. So don't actually
@@ -556,10 +556,16 @@ exit_policy_remove_redundancies(addr_policy_t **dest)
*/
int
policies_parse_exit_policy(config_line_t *cfg, addr_policy_t **dest,
- int rejectprivate)
+ int rejectprivate, const char *local_address)
{
- if (rejectprivate)
+ if (rejectprivate) {
append_exit_policy_string(dest, "reject private:*");
+ if (local_address) {
+ char buf[POLICY_BUF_LEN];
+ tor_snprintf(buf, sizeof(buf), "reject %s:*", local_address);
+ append_exit_policy_string(dest, buf);
+ }
+ }
if (parse_addr_policy(cfg, dest, -1))
return -1;
append_exit_policy_string(dest, DEFAULT_EXIT_POLICY);