Skip to content

Commit 922e952

Browse files
committed
DNS: Fix return value for successful name resolutions
1 parent 7e292fb commit 922e952

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

features/netsocket/nsapi_dns.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int nsapi_dns_query_multiple(NetworkStack *stack, const char *host,
217217
return NSAPI_ERROR_NO_MEMORY;
218218
}
219219

220-
int result = NSAPI_ERROR_DNS_FAILURE;
220+
int result = NSAPI_ERROR_OK;
221221

222222
// check against each dns server
223223
for (unsigned i = 0; i < DNS_SERVERS_SIZE; i++) {
@@ -243,8 +243,11 @@ static int nsapi_dns_query_multiple(NetworkStack *stack, const char *host,
243243
}
244244

245245
const uint8_t *response = packet;
246-
dns_scan_response(&response, addr, addr_count);
247-
break;
246+
if (!dns_scan_response(&response, addr, addr_count)) {
247+
result = NSAPI_ERROR_DNS_FAILURE;
248+
} else {
249+
break;
250+
}
248251
}
249252

250253
// clean up packet

0 commit comments

Comments
 (0)