summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-15 21:27:32 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-15 21:27:32 -0400
commit9bcea4a8ef33bc3f1b66682a0eea463b891cd7ba (patch)
treeae59b0189576acc89aad1fdb4e6a447989295dda
parent5757f47fc34235675d67b71c68b207582b245ca8 (diff)
parent161b275028e90d38582c3cddf65d906e8a181368 (diff)
downloadtor-9bcea4a8ef33bc3f1b66682a0eea463b891cd7ba.tar.gz
tor-9bcea4a8ef33bc3f1b66682a0eea463b891cd7ba.zip
Merge commit 'sebastian/misc-reason'
-rw-r--r--changes/misc-reason4
-rw-r--r--doc/spec/control-spec.txt2
-rw-r--r--doc/spec/tor-spec.txt5
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/reasons.c6
-rw-r--r--src/or/relay.c1
6 files changed, 15 insertions, 5 deletions
diff --git a/changes/misc-reason b/changes/misc-reason
new file mode 100644
index 0000000000..cd21718533
--- /dev/null
+++ b/changes/misc-reason
@@ -0,0 +1,4 @@
+ o Minor bugfixes:
+ - Exit nodes didn't recognize EHOSTUNREACH as a stream ending reason
+ and sent back END_STREAM_REASON_NOROUTE. Also update the spec to
+ reflect this new reason. Bugfix on 0.1.0.1-rc; fixes bug 1793.
diff --git a/doc/spec/control-spec.txt b/doc/spec/control-spec.txt
index 333b1a36a2..31ce35074b 100644
--- a/doc/spec/control-spec.txt
+++ b/doc/spec/control-spec.txt
@@ -1049,7 +1049,7 @@
Reason = "MISC" / "RESOLVEFAILED" / "CONNECTREFUSED" /
"EXITPOLICY" / "DESTROY" / "DONE" / "TIMEOUT" /
- "HIBERNATING" / "INTERNAL"/ "RESOURCELIMIT" /
+ "NOROUTE" / "HIBERNATING" / "INTERNAL"/ "RESOURCELIMIT" /
"CONNRESET" / "TORPROTOCOL" / "NOTDIRECTORY" / "END"
The "REASON" field is provided only for FAILED, CLOSED, and DETACHED
diff --git a/doc/spec/tor-spec.txt b/doc/spec/tor-spec.txt
index f448f6da2c..2b1223ba7a 100644
--- a/doc/spec/tor-spec.txt
+++ b/doc/spec/tor-spec.txt
@@ -835,7 +835,8 @@ see tor-design.pdf.
6 -- REASON_DONE (Anonymized TCP connection was closed)
7 -- REASON_TIMEOUT (Connection timed out, or OR timed out
while connecting)
- 8 -- (unallocated) [**]
+ 8 -- REASON_NOROUTE (Routing error while attempting to
+ contact destination)
9 -- REASON_HIBERNATING (OR is temporarily hibernating)
10 -- REASON_INTERNAL (Internal error at the OR)
11 -- REASON_RESOURCELIMIT (OR has no resources to fulfill request)
@@ -857,8 +858,6 @@ see tor-design.pdf.
[*] Older versions of Tor also send this reason when connections are
reset.
- [**] Due to a bug in versions of Tor through 0095, error reason 8 must
- remain allocated until that version is obsolete.
--- [The rest of this section describes unimplemented functionality.]
diff --git a/src/or/or.h b/src/or/or.h
index e1f4541a7e..4098cd284e 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -551,7 +551,7 @@ typedef enum {
#define END_STREAM_REASON_DESTROY 5
#define END_STREAM_REASON_DONE 6
#define END_STREAM_REASON_TIMEOUT 7
-/* 8 is unallocated for historical reasons. */
+#define END_STREAM_REASON_NOROUTE 8
#define END_STREAM_REASON_HIBERNATING 9
#define END_STREAM_REASON_INTERNAL 10
#define END_STREAM_REASON_RESOURCELIMIT 11
diff --git a/src/or/reasons.c b/src/or/reasons.c
index 2dd5fe9463..8d71f3b39e 100644
--- a/src/or/reasons.c
+++ b/src/or/reasons.c
@@ -28,6 +28,7 @@ stream_end_reason_to_control_string(int reason)
case END_STREAM_REASON_DESTROY: return "DESTROY";
case END_STREAM_REASON_DONE: return "DONE";
case END_STREAM_REASON_TIMEOUT: return "TIMEOUT";
+ case END_STREAM_REASON_NOROUTE: "return "NOROUTE";
case END_STREAM_REASON_HIBERNATING: return "HIBERNATING";
case END_STREAM_REASON_INTERNAL: return "INTERNAL";
case END_STREAM_REASON_RESOURCELIMIT: return "RESOURCELIMIT";
@@ -62,6 +63,7 @@ stream_end_reason_to_string(int reason)
case END_STREAM_REASON_DESTROY: return "destroyed";
case END_STREAM_REASON_DONE: return "closed normally";
case END_STREAM_REASON_TIMEOUT: return "gave up (timeout)";
+ case END_STREAM_REASON_NOROUTE: return "no route to host";
case END_STREAM_REASON_HIBERNATING: return "server is hibernating";
case END_STREAM_REASON_INTERNAL: return "internal error at server";
case END_STREAM_REASON_RESOURCELIMIT: return "server out of resources";
@@ -104,6 +106,8 @@ stream_end_reason_to_socks5_response(int reason)
return SOCKS5_SUCCEEDED;
case END_STREAM_REASON_TIMEOUT:
return SOCKS5_TTL_EXPIRED;
+ case END_STREAM_REASON_NOROUTE:
+ return SOCKS5_HOST_UNREACHABLE;
case END_STREAM_REASON_RESOURCELIMIT:
return SOCKS5_GENERAL_ERROR;
case END_STREAM_REASON_HIBERNATING:
@@ -164,6 +168,8 @@ errno_to_stream_end_reason(int e)
S_CASE(ENOTCONN):
S_CASE(ENETUNREACH):
return END_STREAM_REASON_INTERNAL;
+ E_CASE(EHOSTUNREACH):
+ return END_STREAM_REASON_NOROUTE;
S_CASE(ECONNREFUSED):
return END_STREAM_REASON_CONNECTREFUSED;
S_CASE(ECONNRESET):
diff --git a/src/or/relay.c b/src/or/relay.c
index 22ecdaafa0..ad3e9afe47 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -787,6 +787,7 @@ connection_ap_process_end_not_open(
case END_STREAM_REASON_RESOLVEFAILED:
case END_STREAM_REASON_TIMEOUT:
case END_STREAM_REASON_MISC:
+ case END_STREAM_REASON_NOROUTE:
if (client_dns_incr_failures(conn->socks_request->address)
< MAX_RESOLVE_FAILURES) {
/* We haven't retried too many times; reattach the connection. */