dns_server: fix SRV query discard issue.

This commit is contained in:
Nick Peng
2022-06-11 23:11:25 +08:00
parent 7e985e7d11
commit d185b78836

View File

@@ -2406,7 +2406,7 @@ static int _dns_server_passthrough_rule_check(struct dns_request *request, char
int j = 0; int j = 0;
struct dns_rrs *rrs = NULL; struct dns_rrs *rrs = NULL;
int ip_check_result = 0; int ip_check_result = 0;
int is_result_discard = 0; int is_result_discard = 1;
if (packet->head.rcode != DNS_RC_NOERROR && packet->head.rcode != DNS_RC_NXDOMAIN) { if (packet->head.rcode != DNS_RC_NOERROR && packet->head.rcode != DNS_RC_NXDOMAIN) {
if (request->rcode == DNS_RC_SERVFAIL) { if (request->rcode == DNS_RC_SERVFAIL) {
@@ -2422,9 +2422,8 @@ static int _dns_server_passthrough_rule_check(struct dns_request *request, char
for (j = 1; j < DNS_RRS_END; j++) { for (j = 1; j < DNS_RRS_END; j++) {
rrs = dns_get_rrs_start(packet, j, &rr_count); rrs = dns_get_rrs_start(packet, j, &rr_count);
for (i = 0; i < rr_count && rrs; i++, rrs = dns_get_rrs_next(packet, rrs)) { for (i = 0; i < rr_count && rrs; i++, rrs = dns_get_rrs_next(packet, rrs)) {
if ((rrs->type == DNS_T_A || rrs->type == DNS_T_AAAA) && if (rrs->type == request->qtype) {
(request->qtype != DNS_T_A && request->qtype != DNS_T_AAAA)) { is_result_discard = 0;
is_result_discard = 1;
} }
switch (rrs->type) { switch (rrs->type) {