Tor
0.4.7.0-alpha-dev
|
Implements client-side DNS proxy server code. More...
#include "core/or/or.h"
#include "feature/client/dnsserv.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "core/or/connection_edge.h"
#include "feature/control/control_events.h"
#include "core/mainloop/mainloop.h"
#include "core/mainloop/netstatus.h"
#include "core/or/policies.h"
#include "feature/control/control_connection_st.h"
#include "core/or/entry_connection_st.h"
#include "core/or/listener_connection_st.h"
#include "core/or/socks_request_st.h"
#include "lib/evloop/compat_libevent.h"
#include <event2/dns.h>
#include <event2/dns_compat.h>
#include <event2/dns_struct.h>
Go to the source code of this file.
Functions | |
static void | evdns_server_callback (struct evdns_server_request *req, void *data_) |
int | dnsserv_launch_request (const char *name, int reverse, control_connection_t *control_conn) |
void | dnsserv_reject_request (entry_connection_t *conn) |
static const char * | evdns_get_orig_address (const struct evdns_server_request *req, int rtype, const char *addr) |
void | dnsserv_resolved (entry_connection_t *conn, int answer_type, size_t answer_len, const char *answer, int ttl) |
void | dnsserv_configure_listener (connection_t *conn) |
void | dnsserv_close_listener (connection_t *conn) |
Implements client-side DNS proxy server code.
When a user enables the DNSPort configuration option to have their local Tor client handle DNS requests, this module handles it. It functions as a "DNS Server" on the client side, which client applications use.
Inbound DNS requests are represented as entry_connection_t here (since that's how Tor represents client-side streams), which are kept associated with an evdns_server_request structure as exposed by Libevent's evdns code.
Upon receiving a DNS request, libevent calls our evdns_server_callback() function here, which causes this module to create an entry_connection_t request as appropriate. Later, when that request is answered, connection_edge.c calls dnsserv_resolved() so we can finish up and tell the DNS client.
Definition in file dnsserv.c.
void dnsserv_close_listener | ( | connection_t * | conn | ) |
void dnsserv_configure_listener | ( | connection_t * | conn | ) |
int dnsserv_launch_request | ( | const char * | name, |
int | reverse, | ||
control_connection_t * | control_conn | ||
) |
void dnsserv_reject_request | ( | entry_connection_t * | conn | ) |
void dnsserv_resolved | ( | entry_connection_t * | conn, |
int | answer_type, | ||
size_t | answer_len, | ||
const char * | answer, | ||
int | ttl | ||
) |
|
static |
Look up the original name that corresponds to 'addr' in req. We use this to preserve case in order to facilitate clients using 0x20-hacks to avoid DNS poisoning.
Definition at line 302 of file dnsserv.c.
Referenced by dnsserv_resolved().