diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-09-22 00:44:07 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-09-22 00:44:07 +0000 |
commit | 6b3f6afb5863e670cf69c1c5219e1177e2ab26b2 (patch) | |
tree | dc522721106de4817b0e9de7554b049e34524b52 /src/or | |
parent | 213658f117f88eaeb21ffd61451155f451f67604 (diff) | |
download | tor-6b3f6afb5863e670cf69c1c5219e1177e2ab26b2.tar.gz tor-6b3f6afb5863e670cf69c1c5219e1177e2ab26b2.zip |
r8895@Kushana: nickm | 2006-09-21 20:05:11 -0400
Debug client-side reverse dns code.
svn:r8452
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuituse.c | 3 | ||||
-rw-r--r-- | src/or/connection_edge.c | 18 | ||||
-rw-r--r-- | src/or/control.c | 3 | ||||
-rw-r--r-- | src/or/relay.c | 3 |
4 files changed, 18 insertions, 9 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 74e6895946..310e8278fb 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -947,7 +947,8 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn, tor_assert(conn); tor_assert(circp); tor_assert(conn->_base.state == AP_CONN_STATE_CIRCUIT_WAIT); - is_resolve = conn->socks_request->command == SOCKS_COMMAND_RESOLVE; + is_resolve = (conn->socks_request->command == SOCKS_COMMAND_RESOLVE || + conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR); need_uptime = smartlist_string_num_isin(get_options()->LongLivedPorts, conn->socks_request->port); diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 8d6c9273ba..9ab672ff07 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1120,7 +1120,7 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn, return -1; } - if (socks->command == SOCKS_COMMAND_RESOLVE) { // resolve_ptr XXXX NM + if (socks->command == SOCKS_COMMAND_RESOLVE) { uint32_t answer; struct in_addr in; /* Reply to resolves immediately if we can. */ @@ -1141,7 +1141,7 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn, return 0; } rep_hist_note_used_resolve(time(NULL)); /* help predict this next time */ - } else { /* socks->command == SOCKS_COMMAND_CONNECT */ + } else if (socks->command == SOCKS_COMMAND_CONNECT) { if (socks->port == 0) { log_notice(LD_APP,"Application asked to connect to port 0. Refusing."); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); @@ -1166,6 +1166,12 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn, /* help predict this next time */ rep_hist_note_used_port(socks->port, time(NULL)); + } else if (socks->command == SOCKS_COMMAND_RESOLVE_PTR) { + // XXXX NM Do anything here? + + rep_hist_note_used_resolve(time(NULL)); /* help predict this next time */ + } else { + tor_fragile_assert(); } conn->_base.state = AP_CONN_STATE_CIRCUIT_WAIT; if ((circ && @@ -1701,10 +1707,10 @@ connection_ap_handshake_socks_resolved(edge_connection_t *conn, buf[1] = SOCKS5_SUCCEEDED; buf[2] = 0; /* reserved */ buf[3] = 0x03; /* Domainname address type */ - memcpy(buf+4, answer, answer_len); /* address */ - buf[4+answer_len] = '\0'; - set_uint16(buf+4+answer_len+1, 0); /* port == 0. */ - replylen = 4+answer_len+1+2; + buf[4] = (char)answer_len; + memcpy(buf+5, answer, answer_len); /* address */ + set_uint16(buf+5+answer_len, 0); /* port == 0. */ + replylen = 5+answer_len+2; } else { buf[1] = SOCKS5_HOST_UNREACHABLE; memset(buf+2, 0, 8); diff --git a/src/or/control.c b/src/or/control.c index 58eb9b0f41..e260f15347 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1435,7 +1435,8 @@ handle_getinfo_helper(const char *question, char **answer) case AP_CONN_STATE_CONTROLLER_WAIT: case AP_CONN_STATE_CIRCUIT_WAIT: if (conn->socks_request && - conn->socks_request->command == SOCKS_COMMAND_RESOLVE) + (conn->socks_request->command == SOCKS_COMMAND_RESOLVE || + conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR)) state = "NEWRESOLVE"; else state = "NEW"; diff --git a/src/or/relay.c b/src/or/relay.c index 3e9690fbc9..8d9ce04fb1 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -865,7 +865,8 @@ connection_edge_process_relay_cell_not_open( "Dropping."); return 0; } - tor_assert(conn->socks_request->command == SOCKS_COMMAND_RESOLVE); + tor_assert(conn->socks_request->command == SOCKS_COMMAND_RESOLVE || + conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR); answer_len = cell->payload[RELAY_HEADER_SIZE+1]; if (rh->length < 2 || answer_len+2>rh->length) { log_warn(LD_PROTOCOL, "Dropping malformed 'resolved' cell"); |