Skip to content

Commit 35dbb3f

Browse files
authored
Merge pull request #3166 from kjbracey-arm/ipv6_dns_server
nsapi_dns: Provide 2 IPv6-hosted default servers
2 parents 53b3131 + aa583bd commit 35dbb3f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

features/netsocket/nsapi_dns.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
#define DNS_SERVERS_SIZE 5
3232

3333
nsapi_addr_t dns_servers[DNS_SERVERS_SIZE] = {
34-
{NSAPI_IPv4, {8, 8, 8, 8}},
35-
{NSAPI_IPv4, {209, 244, 0, 3}},
36-
{NSAPI_IPv4, {84, 200, 69, 80}},
37-
{NSAPI_IPv4, {8, 26, 56, 26}},
38-
{NSAPI_IPv4, {208, 67, 222, 222}},
34+
{NSAPI_IPv4, {8, 8, 8, 8}}, // Google
35+
{NSAPI_IPv4, {209, 244, 0, 3}}, // Level 3
36+
{NSAPI_IPv4, {84, 200, 69, 80}}, // DNS.WATCH
37+
{NSAPI_IPv6, {0x20,0x01, 0x48,0x60, 0x48,0x60, 0,0, // Google
38+
0,0, 0,0, 0,0, 0x88,0x88}},
39+
{NSAPI_IPv6, {0x20,0x01, 0x16,0x08, 0,0x10, 0,0x25, // DNS.WATCH
40+
0,0, 0,0, 0x1c,0x04, 0xb1,0x2f}},
3941
};
4042

4143
// DNS server configuration
@@ -226,11 +228,9 @@ static int nsapi_dns_query_multiple(NetworkStack *stack, const char *host,
226228
dns_append_question(&question, host, version);
227229

228230
err = socket.sendto(SocketAddress(dns_servers[i], 53), packet, DNS_BUFFER_SIZE);
229-
if (err == NSAPI_ERROR_WOULD_BLOCK) {
231+
// send may fail for various reasons, including wrong address type - move on
232+
if (err < 0) {
230233
continue;
231-
} else if (err < 0) {
232-
result = err;
233-
break;
234234
}
235235

236236
// recv the response

0 commit comments

Comments
 (0)