aboutsummaryrefslogtreecommitdiff
path: root/src/or/dnsserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-31 23:40:35 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-31 23:40:35 +0000
commit3b4fa59b60fdb3efd98d860ba0304fda8888b379 (patch)
tree5f33ba4a2f24b60987b6fb5d2b1f882805bd37a6 /src/or/dnsserv.c
parentb1cd5892cb438754a878e473bf63bc3a40f8f171 (diff)
downloadtor-3b4fa59b60fdb3efd98d860ba0304fda8888b379.tar.gz
tor-3b4fa59b60fdb3efd98d860ba0304fda8888b379.zip
r13117@catbus: nickm | 2007-05-31 19:40:32 -0400
Patch from Tup: treat RESOLVED_TYPE_ERROR_TRANSIENT as a SERVERFAILED, and RESOLVED_TYPE_ERROR as NOTEXIST. Generate transient/nontransient errors more sensibly. Set flags better on DNS replies. svn:r10427
Diffstat (limited to 'src/or/dnsserv.c')
-rw-r--r--src/or/dnsserv.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index bda4be56c2..4b61f362f1 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -32,6 +32,8 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
tor_assert(_data == NULL);
log_info(LD_APP, "Got a new DNS request!");
+ req->flags |= 0x80; /* set RA */
+
/* First, check whether the requesting address matches our SOCKSPolicy. */
if ((addrlen = evdns_server_request_get_requesting_addr(req,
(struct sockaddr*)&addr, sizeof(addr))) < 0) {
@@ -81,8 +83,8 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
}
if (!q) {
log_info(LD_APP, "None of the questions we got were ones we're willing "
- "to support. Sending error.");
- evdns_server_request_respond(req, DNS_ERR_NOTIMPL);
+ "to support. Sending NODATA.");
+ evdns_server_request_respond(req, DNS_ERR_NONE);
return;
}
if (q->type == EVDNS_TYPE_A) {
@@ -183,8 +185,10 @@ dnsserv_resolved(edge_connection_t *conn,
conn->socks_request->address,
(char*)answer, ttl);
tor_free(ans);
- } else {
- err = DNS_ERR_SERVERFAILED; /* Really? Not noent? */
+ } else if (answer_type == RESOLVED_TYPE_ERROR) {
+ err = DNS_ERR_NOTEXIST;
+ } else { /* answer_type == RESOLVED_TYPE_ERROR_TRANSIENT */
+ err = DNS_ERR_SERVERFAILED;
}
evdns_server_request_respond(req, err);