mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Merge remote-tracking branch 'origin/maint-0.2.4'
This commit is contained in:
commit
41cff47c6a
4
changes/bug8203
Normal file
4
changes/bug8203
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Make the format and order of STREAM events for DNS lookups consistent
|
||||||
|
among the various ways to launch DNS lookups. Fix for bug 8203;
|
||||||
|
bugfix on 0.2.0.24-rc. Patch by "Desoxy."
|
@ -1945,13 +1945,14 @@ connection_ap_handshake_send_resolve(entry_connection_t *ap_conn)
|
|||||||
string_addr, payload_len) < 0)
|
string_addr, payload_len) < 0)
|
||||||
return -1; /* circuit is closed, don't continue */
|
return -1; /* circuit is closed, don't continue */
|
||||||
|
|
||||||
tor_free(base_conn->address); /* Maybe already set by dnsserv. */
|
if (!base_conn->address) {
|
||||||
base_conn->address = tor_strdup("(Tor_internal)");
|
/* This might be unnecessary. XXXX */
|
||||||
|
base_conn->address = tor_dup_addr(&base_conn->addr);
|
||||||
|
}
|
||||||
base_conn->state = AP_CONN_STATE_RESOLVE_WAIT;
|
base_conn->state = AP_CONN_STATE_RESOLVE_WAIT;
|
||||||
log_info(LD_APP,"Address sent for resolve, ap socket "TOR_SOCKET_T_FORMAT
|
log_info(LD_APP,"Address sent for resolve, ap socket "TOR_SOCKET_T_FORMAT
|
||||||
", n_circ_id %u",
|
", n_circ_id %u",
|
||||||
base_conn->s, (unsigned)circ->base_.n_circ_id);
|
base_conn->s, (unsigned)circ->base_.n_circ_id);
|
||||||
control_event_stream_status(ap_conn, STREAM_EVENT_NEW, 0);
|
|
||||||
control_event_stream_status(ap_conn, STREAM_EVENT_SENT_RESOLVE, 0);
|
control_event_stream_status(ap_conn, STREAM_EVENT_SENT_RESOLVE, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2201,9 +2202,11 @@ connection_ap_handshake_socks_reply(entry_connection_t *conn, char *reply,
|
|||||||
|
|
||||||
tor_assert(conn->socks_request); /* make sure it's an AP stream */
|
tor_assert(conn->socks_request); /* make sure it's an AP stream */
|
||||||
|
|
||||||
control_event_stream_status(conn,
|
if (!SOCKS_COMMAND_IS_RESOLVE(conn->socks_request->command)) {
|
||||||
status==SOCKS5_SUCCEEDED ? STREAM_EVENT_SUCCEEDED : STREAM_EVENT_FAILED,
|
control_event_stream_status(conn, status==SOCKS5_SUCCEEDED ?
|
||||||
endreason);
|
STREAM_EVENT_SUCCEEDED : STREAM_EVENT_FAILED,
|
||||||
|
endreason);
|
||||||
|
}
|
||||||
|
|
||||||
/* Flag this stream's circuit as having completed a stream successfully
|
/* Flag this stream's circuit as having completed a stream successfully
|
||||||
* (for path bias) */
|
* (for path bias) */
|
||||||
|
@ -2939,7 +2939,7 @@ handle_control_resolve(control_connection_t *conn, uint32_t len,
|
|||||||
failed = smartlist_new();
|
failed = smartlist_new();
|
||||||
SMARTLIST_FOREACH(args, const char *, arg, {
|
SMARTLIST_FOREACH(args, const char *, arg, {
|
||||||
if (!is_keyval_pair(arg)) {
|
if (!is_keyval_pair(arg)) {
|
||||||
if (dnsserv_launch_request(arg, is_reverse)<0)
|
if (dnsserv_launch_request(arg, is_reverse, conn)<0)
|
||||||
smartlist_add(failed, (char*)arg);
|
smartlist_add(failed, (char*)arg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -3742,7 +3742,7 @@ control_event_stream_status(entry_connection_t *conn, stream_status_event_t tp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tp == STREAM_EVENT_NEW) {
|
if (tp == STREAM_EVENT_NEW || tp == STREAM_EVENT_NEW_RESOLVE) {
|
||||||
tor_snprintf(addrport_buf,sizeof(addrport_buf), " SOURCE_ADDR=%s:%d",
|
tor_snprintf(addrport_buf,sizeof(addrport_buf), " SOURCE_ADDR=%s:%d",
|
||||||
ENTRY_TO_CONN(conn)->address, ENTRY_TO_CONN(conn)->port);
|
ENTRY_TO_CONN(conn)->address, ENTRY_TO_CONN(conn)->port);
|
||||||
} else {
|
} else {
|
||||||
@ -3752,11 +3752,7 @@ control_event_stream_status(entry_connection_t *conn, stream_status_event_t tp,
|
|||||||
if (tp == STREAM_EVENT_NEW_RESOLVE) {
|
if (tp == STREAM_EVENT_NEW_RESOLVE) {
|
||||||
purpose = " PURPOSE=DNS_REQUEST";
|
purpose = " PURPOSE=DNS_REQUEST";
|
||||||
} else if (tp == STREAM_EVENT_NEW) {
|
} else if (tp == STREAM_EVENT_NEW) {
|
||||||
if (ENTRY_TO_EDGE_CONN(conn)->is_dns_request ||
|
if (conn->use_begindir) {
|
||||||
(conn->socks_request &&
|
|
||||||
SOCKS_COMMAND_IS_RESOLVE(conn->socks_request->command)))
|
|
||||||
purpose = " PURPOSE=DNS_REQUEST";
|
|
||||||
else if (conn->use_begindir) {
|
|
||||||
connection_t *linked = ENTRY_TO_CONN(conn)->linked_conn;
|
connection_t *linked = ENTRY_TO_CONN(conn)->linked_conn;
|
||||||
int linked_dir_purpose = -1;
|
int linked_dir_purpose = -1;
|
||||||
if (linked && linked->type == CONN_TYPE_DIR)
|
if (linked && linked->type == CONN_TYPE_DIR)
|
||||||
|
@ -147,7 +147,7 @@ evdns_server_callback(struct evdns_server_request *req, void *data_)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
control_event_stream_status(entry_conn, STREAM_EVENT_NEW, 0);
|
control_event_stream_status(entry_conn, STREAM_EVENT_NEW_RESOLVE, 0);
|
||||||
|
|
||||||
/* Now, unless a controller asked us to leave streams unattached,
|
/* Now, unless a controller asked us to leave streams unattached,
|
||||||
* throw the connection over to get rewritten (which will
|
* throw the connection over to get rewritten (which will
|
||||||
@ -170,7 +170,7 @@ evdns_server_callback(struct evdns_server_request *req, void *data_)
|
|||||||
* response; -1 if we couldn't launch the request.
|
* response; -1 if we couldn't launch the request.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dnsserv_launch_request(const char *name, int reverse)
|
dnsserv_launch_request(const char *name, int reverse, control_connection_t *control_conn)
|
||||||
{
|
{
|
||||||
entry_connection_t *entry_conn;
|
entry_connection_t *entry_conn;
|
||||||
edge_connection_t *conn;
|
edge_connection_t *conn;
|
||||||
@ -181,6 +181,10 @@ dnsserv_launch_request(const char *name, int reverse)
|
|||||||
conn = ENTRY_TO_EDGE_CONN(entry_conn);
|
conn = ENTRY_TO_EDGE_CONN(entry_conn);
|
||||||
conn->base_.state = AP_CONN_STATE_RESOLVE_WAIT;
|
conn->base_.state = AP_CONN_STATE_RESOLVE_WAIT;
|
||||||
|
|
||||||
|
tor_addr_copy(&TO_CONN(conn)->addr, &control_conn->base_.addr);
|
||||||
|
TO_CONN(conn)->port = control_conn->base_.port;
|
||||||
|
TO_CONN(conn)->address = tor_dup_addr(&control_conn->base_.addr);
|
||||||
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
entry_conn->socks_request->command = SOCKS_COMMAND_RESOLVE_PTR;
|
entry_conn->socks_request->command = SOCKS_COMMAND_RESOLVE_PTR;
|
||||||
else
|
else
|
||||||
@ -203,6 +207,8 @@ dnsserv_launch_request(const char *name, int reverse)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
control_event_stream_status(entry_conn, STREAM_EVENT_NEW_RESOLVE, 0);
|
||||||
|
|
||||||
/* Now, unless a controller asked us to leave streams unattached,
|
/* Now, unless a controller asked us to leave streams unattached,
|
||||||
* throw the connection over to get rewritten (which will
|
* throw the connection over to get rewritten (which will
|
||||||
* answer it immediately if it's in the cache, or completely bogus, or
|
* answer it immediately if it's in the cache, or completely bogus, or
|
||||||
|
@ -20,7 +20,7 @@ void dnsserv_resolved(entry_connection_t *conn,
|
|||||||
const char *answer,
|
const char *answer,
|
||||||
int ttl);
|
int ttl);
|
||||||
void dnsserv_reject_request(entry_connection_t *conn);
|
void dnsserv_reject_request(entry_connection_t *conn);
|
||||||
int dnsserv_launch_request(const char *name, int is_reverse);
|
int dnsserv_launch_request(const char *name, int is_reverse, control_connection_t *control_conn);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user