aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-09-27 17:52:20 -0400
committerNick Mathewson <nickm@torproject.org>2010-09-27 17:52:20 -0400
commitaf7fab020accd31f95ba2037ccd25c65e3290571 (patch)
treeece006ac592b5d153e173332d6489acc22f98058 /src/or/router.c
parent5c83c06c985d314f31c72d3fb5a29c1c2f396f66 (diff)
parent8df3a909466217d6738d6fe4f7555f569b2a4cb7 (diff)
downloadtor-af7fab020accd31f95ba2037ccd25c65e3290571.tar
tor-af7fab020accd31f95ba2037ccd25c65e3290571.tar.gz
Merge remote branch 'origin/maint-0.2.2'
Conflicts: src/or/config.c
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 978078bf7..621cbaace 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -18,6 +18,7 @@
#include "geoip.h"
#include "hibernate.h"
#include "main.h"
+#include "networkstatus.h"
#include "policies.h"
#include "relay.h"
#include "rephist.h"
@@ -975,6 +976,19 @@ server_mode(or_options_t *options)
return (options->ORPort != 0 || options->ORListenAddress);
}
+/** Return true iff the combination of options in <b>options</b> and parameters
+ * in the consensus mean that we don't want to allow exits from circuits
+ * we got from addresses not known to be servers. */
+int
+should_refuse_unknown_exits(or_options_t *options)
+{
+ if (options->RefuseUnknownExits_ != -1) {
+ return options->RefuseUnknownExits_;
+ } else {
+ return networkstatus_get_param(NULL, "refuseunknownexits", 1);
+ }
+}
+
/** Remember if we've advertised ourselves to the dirservers. */
static int server_is_advertised=0;
@@ -1137,6 +1151,17 @@ router_compare_to_my_exit_policy(edge_connection_t *conn)
desc_routerinfo->exit_policy) != ADDR_POLICY_ACCEPTED;
}
+/** Return true iff my exit policy is reject *:*. Return -1 if we don't
+ * have a descriptor */
+int
+router_my_exit_policy_is_reject_star(void)
+{
+ if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */
+ return -1;
+
+ return desc_routerinfo->policy_is_reject_star;
+}
+
/** Return true iff I'm a server and <b>digest</b> is equal to
* my identity digest. */
int
@@ -1300,6 +1325,8 @@ router_rebuild_descriptor(int force)
policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy,
options->ExitPolicyRejectPrivate,
ri->address, !options->BridgeRelay);
+ ri->policy_is_reject_star =
+ policy_is_reject_star(ri->exit_policy);
if (desc_routerinfo) { /* inherit values */
ri->is_valid = desc_routerinfo->is_valid;