dns_client: fix bootstrap DNS soa host issue.
This commit is contained in:
@@ -3625,6 +3625,7 @@ static int _dns_client_pending_server_resolve(const char *domain, dns_rtcode_t r
|
|||||||
if (rtcode == DNS_RC_NOERROR) {
|
if (rtcode == DNS_RC_NOERROR) {
|
||||||
pending->has_v4 = 1;
|
pending->has_v4 = 1;
|
||||||
pending->ping_time_v4 = ping_time;
|
pending->ping_time_v4 = ping_time;
|
||||||
|
pending->has_soa = 0;
|
||||||
safe_strncpy(pending->ipv4, ip, DNS_HOSTNAME_LEN);
|
safe_strncpy(pending->ipv4, ip, DNS_HOSTNAME_LEN);
|
||||||
}
|
}
|
||||||
} else if (addr_type == DNS_T_AAAA) {
|
} else if (addr_type == DNS_T_AAAA) {
|
||||||
@@ -3632,6 +3633,7 @@ static int _dns_client_pending_server_resolve(const char *domain, dns_rtcode_t r
|
|||||||
if (rtcode == DNS_RC_NOERROR) {
|
if (rtcode == DNS_RC_NOERROR) {
|
||||||
pending->has_v6 = 1;
|
pending->has_v6 = 1;
|
||||||
pending->ping_time_v6 = ping_time;
|
pending->ping_time_v6 = ping_time;
|
||||||
|
pending->has_soa = 0;
|
||||||
safe_strncpy(pending->ipv6, ip, DNS_HOSTNAME_LEN);
|
safe_strncpy(pending->ipv6, ip, DNS_HOSTNAME_LEN);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -3754,12 +3756,6 @@ static void _dns_client_add_pending_servers(void)
|
|||||||
dnsserver_ip = pending->ipv6;
|
dnsserver_ip = pending->ipv6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pending->has_soa) {
|
|
||||||
tlog(TLOG_WARN, "add pending DNS server %s failed, no such host.", pending->host);
|
|
||||||
_dns_client_server_pending_remove(pending);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dnsserver_ip && dnsserver_ip[0]) {
|
if (dnsserver_ip && dnsserver_ip[0]) {
|
||||||
if (_dns_client_add_pendings(pending, dnsserver_ip) == 0) {
|
if (_dns_client_add_pendings(pending, dnsserver_ip) == 0) {
|
||||||
add_success = 1;
|
add_success = 1;
|
||||||
@@ -3771,6 +3767,12 @@ static void _dns_client_add_pending_servers(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pending->has_soa && dnsserver_ip == NULL) {
|
||||||
|
tlog(TLOG_WARN, "add pending DNS server %s failed, no such host.", pending->host);
|
||||||
|
_dns_client_server_pending_remove(pending);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (pending->retry_cnt - 1 > DNS_PENDING_SERVER_RETRY || add_success) {
|
if (pending->retry_cnt - 1 > DNS_PENDING_SERVER_RETRY || add_success) {
|
||||||
if (add_success == 0) {
|
if (add_success == 0) {
|
||||||
tlog(TLOG_WARN, "add pending DNS server %s failed.", pending->host);
|
tlog(TLOG_WARN, "add pending DNS server %s failed.", pending->host);
|
||||||
|
|||||||
@@ -1305,7 +1305,7 @@ static int _dns_result_callback_nxdomain(struct dns_request *request)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return request->result_callback(request->domain, DNS_RC_NXDOMAIN, request->qtype, ip, ping_time, request->user_ptr);
|
return request->result_callback(request->domain, request->rcode, request->qtype, ip, ping_time, request->user_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _dns_result_callback(struct dns_server_post_context *context)
|
static int _dns_result_callback(struct dns_server_post_context *context)
|
||||||
|
|||||||
Reference in New Issue
Block a user