Apply ClientDNSRejectInternalAddresses to IPv6 in RESOLVED cells

Fixes bug 8475; bugfix on 0.2.0.7-alpha.
This commit is contained in:
Nick Mathewson 2013-03-14 11:19:08 -04:00
parent c6ca199888
commit 1b28f366b8
2 changed files with 12 additions and 5 deletions

4
changes/bug8475 Normal file
View File

@ -0,0 +1,4 @@
o Major bugfixes:
- If configured via ClientDNSRejectInternalAddresses not to report
DNS queries which have resolved to internal addresses, apply that
rule to IPv6 as well. Fixes bug 8475; bugfix on 0.2.0.7-alpha.

View File

@ -969,12 +969,15 @@ connection_edge_process_relay_cell_not_open(
2+answer_len)); 2+answer_len));
else else
ttl = -1; ttl = -1;
if (answer_type == RESOLVED_TYPE_IPV4 && answer_len == 4) { if (answer_type == RESOLVED_TYPE_IPV4 ||
uint32_t addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE+2)); answer_type == RESOLVED_TYPE_IPV6) {
if (get_options()->ClientDNSRejectInternalAddresses && tor_addr_t addr;
is_internal_IP(addr, 0)) { if (decode_address_from_payload(&addr, cell->payload+RELAY_HEADER_SIZE,
rh->length) &&
tor_addr_is_internal(&addr, 0) &&
get_options()->ClientDNSRejectInternalAddresses) {
log_info(LD_APP,"Got a resolve with answer %s. Rejecting.", log_info(LD_APP,"Got a resolve with answer %s. Rejecting.",
fmt_addr32(addr)); fmt_addr(&addr));
connection_ap_handshake_socks_resolved(entry_conn, connection_ap_handshake_socks_resolved(entry_conn,
RESOLVED_TYPE_ERROR_TRANSIENT, RESOLVED_TYPE_ERROR_TRANSIENT,
0, NULL, 0, TIME_MAX); 0, NULL, 0, TIME_MAX);