Update code

This commit is contained in:
Nick Peng
2018-06-08 21:57:33 +08:00
parent 4ee70e3eac
commit 4a6b0baddd
5 changed files with 595 additions and 537 deletions

View File

@@ -211,7 +211,7 @@ static int _dns_reply(struct dns_request *request)
head.id = request->id;
head.qr = DNS_QR_ANSWER;
head.opcode = DNS_OP_QUERY;
head.rd = 0;
head.rd = 1;
head.ra = 0;
head.aa = 0;
head.tc = 0;
@@ -411,13 +411,14 @@ static int _dns_server_process_answer(struct dns_request *request, char *domain,
struct dns_rrs *rrs = NULL;
if (packet->head.rcode != DNS_RC_NOERROR) {
if (request->rcode == (unsigned short)-1) {
if (request->rcode == DNS_RC_SERVFAIL) {
request->rcode = packet->head.rcode;
}
tlog(TLOG_ERROR, "inquery failed, %s, rcode = %d, id = %d\n", domain, packet->head.rcode, packet->head.id);
return -1;
}
request->rcode = packet->head.rcode;
for (j = 1; j < DNS_RRS_END; j++) {