mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-02 16:43:32 +01:00
Merge remote-tracking branch 'origin/maint-0.2.4'
This commit is contained in:
commit
6276cca8ce
3
changes/bug10465
Normal file
3
changes/bug10465
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Major bugfixes:
|
||||||
|
- Fix assertion failure when AutomapHostsOnResolve yields an IPv6
|
||||||
|
address. Fixes bug 10465; bugfix on 0.2.4.7-alpha.
|
@ -62,6 +62,11 @@ static int connection_ap_process_natd(entry_connection_t *conn);
|
|||||||
static int connection_exit_connect_dir(edge_connection_t *exitconn);
|
static int connection_exit_connect_dir(edge_connection_t *exitconn);
|
||||||
static int consider_plaintext_ports(entry_connection_t *conn, uint16_t port);
|
static int consider_plaintext_ports(entry_connection_t *conn, uint16_t port);
|
||||||
static int connection_ap_supports_optimistic_data(const entry_connection_t *);
|
static int connection_ap_supports_optimistic_data(const entry_connection_t *);
|
||||||
|
static void connection_ap_handshake_socks_resolved_addr(
|
||||||
|
entry_connection_t *conn,
|
||||||
|
const tor_addr_t *answer,
|
||||||
|
int ttl,
|
||||||
|
time_t expires);
|
||||||
|
|
||||||
/** An AP stream has failed/finished. If it hasn't already sent back
|
/** An AP stream has failed/finished. If it hasn't already sent back
|
||||||
* a socks reply, send one now (based on endreason). Also set
|
* a socks reply, send one now (based on endreason). Also set
|
||||||
@ -1157,17 +1162,13 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (socks->command == SOCKS_COMMAND_RESOLVE) {
|
if (socks->command == SOCKS_COMMAND_RESOLVE) {
|
||||||
uint32_t answer;
|
tor_addr_t answer;
|
||||||
struct in_addr in;
|
|
||||||
/* Reply to resolves immediately if we can. */
|
/* Reply to resolves immediately if we can. */
|
||||||
if (tor_inet_aton(socks->address, &in)) { /* see if it's an IP already */
|
if (tor_addr_parse(&answer, socks->address) >= 0) {/* is it an IP? */
|
||||||
/* leave it in network order */
|
|
||||||
answer = in.s_addr;
|
|
||||||
/* remember _what_ is supposed to have been resolved. */
|
/* remember _what_ is supposed to have been resolved. */
|
||||||
strlcpy(socks->address, orig_address, sizeof(socks->address));
|
strlcpy(socks->address, orig_address, sizeof(socks->address));
|
||||||
connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
|
connection_ap_handshake_socks_resolved_addr(conn, &answer, -1,
|
||||||
(uint8_t*)&answer,
|
map_expires);
|
||||||
-1,map_expires);
|
|
||||||
connection_mark_unattached_ap(conn,
|
connection_mark_unattached_ap(conn,
|
||||||
END_STREAM_REASON_DONE |
|
END_STREAM_REASON_DONE |
|
||||||
END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED);
|
END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED);
|
||||||
@ -2060,6 +2061,35 @@ tell_controller_about_resolved_result(entry_connection_t *conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As connection_ap_handshake_socks_resolved, but take a tor_addr_t to send
|
||||||
|
* as the answer.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
connection_ap_handshake_socks_resolved_addr(entry_connection_t *conn,
|
||||||
|
const tor_addr_t *answer,
|
||||||
|
int ttl,
|
||||||
|
time_t expires)
|
||||||
|
{
|
||||||
|
if (tor_addr_family(answer) == AF_INET) {
|
||||||
|
uint32_t a = tor_addr_to_ipv4n(answer); /* network order */
|
||||||
|
connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV4,4,
|
||||||
|
(uint8_t*)&a,
|
||||||
|
ttl, expires);
|
||||||
|
} else if (tor_addr_family(answer) == AF_INET6) {
|
||||||
|
const uint8_t *a = tor_addr_to_in6_addr8(answer);
|
||||||
|
connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_IPV6,16,
|
||||||
|
a,
|
||||||
|
ttl, expires);
|
||||||
|
} else {
|
||||||
|
log_warn(LD_BUG, "Got called with address of unexpected family %d",
|
||||||
|
tor_addr_family(answer));
|
||||||
|
connection_ap_handshake_socks_resolved(conn,
|
||||||
|
RESOLVED_TYPE_ERROR,0,NULL,-1,-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Send an answer to an AP connection that has requested a DNS lookup via
|
/** Send an answer to an AP connection that has requested a DNS lookup via
|
||||||
* SOCKS. The type should be one of RESOLVED_TYPE_(IPV4|IPV6|HOSTNAME) or -1
|
* SOCKS. The type should be one of RESOLVED_TYPE_(IPV4|IPV6|HOSTNAME) or -1
|
||||||
* for unreachable; the answer should be in the format specified in the socks
|
* for unreachable; the answer should be in the format specified in the socks
|
||||||
|
Loading…
Reference in New Issue
Block a user