Introduce END_STREAM_REASON_NOROUTE

This commit is contained in:
Sebastian Hahn 2010-08-03 16:46:28 +02:00
parent b8aa14a39b
commit 150ed553df
4 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,4 @@
o Minor bugfixes: o Minor bugfixes:
- Exit nodes didn't recognize EHOSTUNREACH as a stream ending reason - Exit nodes didn't recognize EHOSTUNREACH as a stream ending reason
and sent back misc. Bugfix on 0.1.0.1-rc; fixes bug 1793. 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.

View File

@ -831,7 +831,8 @@ see tor-design.pdf.
6 -- REASON_DONE (Anonymized TCP connection was closed) 6 -- REASON_DONE (Anonymized TCP connection was closed)
7 -- REASON_TIMEOUT (Connection timed out, or OR timed out 7 -- REASON_TIMEOUT (Connection timed out, or OR timed out
while connecting) while connecting)
8 -- (unallocated) [**] 8 -- REASON_NOROUTE (Routing error while attempting to
contact destination)
9 -- REASON_HIBERNATING (OR is temporarily hibernating) 9 -- REASON_HIBERNATING (OR is temporarily hibernating)
10 -- REASON_INTERNAL (Internal error at the OR) 10 -- REASON_INTERNAL (Internal error at the OR)
11 -- REASON_RESOURCELIMIT (OR has no resources to fulfill request) 11 -- REASON_RESOURCELIMIT (OR has no resources to fulfill request)
@ -853,8 +854,6 @@ see tor-design.pdf.
[*] Older versions of Tor also send this reason when connections are [*] Older versions of Tor also send this reason when connections are
reset. 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.] --- [The rest of this section describes unimplemented functionality.]

View File

@ -544,7 +544,7 @@ typedef enum {
#define END_STREAM_REASON_DESTROY 5 #define END_STREAM_REASON_DESTROY 5
#define END_STREAM_REASON_DONE 6 #define END_STREAM_REASON_DONE 6
#define END_STREAM_REASON_TIMEOUT 7 #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_HIBERNATING 9
#define END_STREAM_REASON_INTERNAL 10 #define END_STREAM_REASON_INTERNAL 10
#define END_STREAM_REASON_RESOURCELIMIT 11 #define END_STREAM_REASON_RESOURCELIMIT 11

View File

@ -26,6 +26,7 @@ stream_end_reason_to_control_string(int reason)
case END_STREAM_REASON_DESTROY: return "DESTROY"; case END_STREAM_REASON_DESTROY: return "DESTROY";
case END_STREAM_REASON_DONE: return "DONE"; case END_STREAM_REASON_DONE: return "DONE";
case END_STREAM_REASON_TIMEOUT: return "TIMEOUT"; 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_HIBERNATING: return "HIBERNATING";
case END_STREAM_REASON_INTERNAL: return "INTERNAL"; case END_STREAM_REASON_INTERNAL: return "INTERNAL";
case END_STREAM_REASON_RESOURCELIMIT: return "RESOURCELIMIT"; case END_STREAM_REASON_RESOURCELIMIT: return "RESOURCELIMIT";
@ -60,6 +61,7 @@ stream_end_reason_to_string(int reason)
case END_STREAM_REASON_DESTROY: return "destroyed"; case END_STREAM_REASON_DESTROY: return "destroyed";
case END_STREAM_REASON_DONE: return "closed normally"; case END_STREAM_REASON_DONE: return "closed normally";
case END_STREAM_REASON_TIMEOUT: return "gave up (timeout)"; 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_HIBERNATING: return "server is hibernating";
case END_STREAM_REASON_INTERNAL: return "internal error at server"; case END_STREAM_REASON_INTERNAL: return "internal error at server";
case END_STREAM_REASON_RESOURCELIMIT: return "server out of resources"; case END_STREAM_REASON_RESOURCELIMIT: return "server out of resources";
@ -102,6 +104,8 @@ stream_end_reason_to_socks5_response(int reason)
return SOCKS5_SUCCEEDED; return SOCKS5_SUCCEEDED;
case END_STREAM_REASON_TIMEOUT: case END_STREAM_REASON_TIMEOUT:
return SOCKS5_TTL_EXPIRED; return SOCKS5_TTL_EXPIRED;
case END_STREAM_REASON_NOROUTE:
return SOCKS5_HOST_UNREACHABLE;
case END_STREAM_REASON_RESOURCELIMIT: case END_STREAM_REASON_RESOURCELIMIT:
return SOCKS5_GENERAL_ERROR; return SOCKS5_GENERAL_ERROR;
case END_STREAM_REASON_HIBERNATING: case END_STREAM_REASON_HIBERNATING:
@ -161,8 +165,9 @@ errno_to_stream_end_reason(int e)
E_CASE(EACCES): E_CASE(EACCES):
S_CASE(ENOTCONN): S_CASE(ENOTCONN):
S_CASE(ENETUNREACH): S_CASE(ENETUNREACH):
E_CASE(EHOSTUNREACH):
return END_STREAM_REASON_INTERNAL; return END_STREAM_REASON_INTERNAL;
E_CASE(EHOSTUNREACH):
return END_STREAM_REASON_NOROUTE;
S_CASE(ECONNREFUSED): S_CASE(ECONNREFUSED):
return END_STREAM_REASON_CONNECTREFUSED; return END_STREAM_REASON_CONNECTREFUSED;
S_CASE(ECONNRESET): S_CASE(ECONNRESET):