Skip to content

Commit

Permalink
dns_server: no retry when upstream server return no results with RCOD…
Browse files Browse the repository at this point in the history
…E=NOERROR
  • Loading branch information
pymumu committed Jan 14, 2024
1 parent c3a4720 commit d00f012
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/dns_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -3746,9 +3746,13 @@ static int _dns_server_process_answer(struct dns_request *request, const char *d
}

if (has_result == 0 && request->rcode == DNS_RC_NOERROR) {
tlog(TLOG_DEBUG, "no result, %s qtype: %d, rcode: %d, id: %d, retry", domain, request->qtype,
/* When queries A and AAAA from CloudFlare DNS at the same time and there is a retry,
* CloudFlare DNS may return the sent request packet. I don’t know the reason.
* Maybe retry should be considered?
*/
tlog(TLOG_DEBUG, "no result, %s qtype: %d, rcode: %d, id: %d", domain, request->qtype,
packet->head.rcode, packet->head.id);
return -1;
return 0;
}

return 0;
Expand Down
3 changes: 1 addition & 2 deletions src/tlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ int tlog_stdout_with_color(tlog_level level, const char *buff, int bufflen)
}

if (color != NULL) {
fprintf(stdout, "%s%.*s\033[0m\n", color, bufflen - 2, buff);
fprintf(stdout, "%s%.*s\033[0m\n", color, bufflen - 1, buff);
} else {
fprintf(stdout, "%s", buff);
}
Expand Down Expand Up @@ -1227,7 +1227,6 @@ static int _tlog_write_screen(struct tlog_log *log, struct tlog_loginfo *info, c
}

if (info == NULL) {

return write(STDOUT_FILENO, buff, bufflen);;
}

Expand Down

0 comments on commit d00f012

Please sign in to comment.