aboutsummaryrefslogtreecommitdiff
path: root/src/or/nodelist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-03-11 23:37:47 -0400
committerNick Mathewson <nickm@torproject.org>2013-03-11 23:37:47 -0400
commit2b22c0aeef6e71d56b12411d10484aaece769178 (patch)
tree3d27f93cbd2c98f472c42becb6dfa5e86005ac89 /src/or/nodelist.c
parent051b1e8ac4114fb23904cdf8dead72d585904e0a (diff)
downloadtor-2b22c0aeef6e71d56b12411d10484aaece769178.tar
tor-2b22c0aeef6e71d56b12411d10484aaece769178.tar.gz
On END_REASON_EXITPOLICY, mark circuit as unusable for that address.
Also, don't call the exit node 'reject *' unless our decision to pick that node was based on a non-summarized version of that node's exit policy. rransom and arma came up with the ideas for this fix. Fix for 7582; the summary-related part is a bugfix on 0.2.3.2-alpha.
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r--src/or/nodelist.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index ee1bc392e..5f3b843d0 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -688,6 +688,24 @@ node_exit_policy_rejects_all(const node_t *node)
return 1;
}
+/** Return true iff the exit policy for <b>node</b> is such that we can treat
+ * rejecting an address of type <b>family</b> unexpectedly as a sign of that
+ * node's failure. */
+int
+node_exit_policy_is_exact(const node_t *node, sa_family_t family)
+{
+ if (family == AF_UNSPEC) {
+ return 1; /* Rejecting an address but not telling us what address
+ * is a bad sign. */
+ } else if (family == AF_INET) {
+ return node->ri != NULL;
+ } else if (family == AF_INET6) {
+ return 0;
+ }
+ tor_fragile_assert();
+ return 1;
+}
+
/** Return list of tor_addr_port_t with all OR ports (in the sense IP
* addr + TCP port) for <b>node</b>. Caller must free all elements
* using tor_free() and free the list using smartlist_free().