-
Notifications
You must be signed in to change notification settings - Fork 3k
DNS: Fix return value for successful name resolutions #2963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was an unrelated change to this function that slightly changed the logic. Are you sure the |
Yeah you're probably right, we should still return error when the count is 0. |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 1078 All builds and test passed! |
@@ -243,8 +243,11 @@ static int nsapi_dns_query_multiple(NetworkStack *stack, const char *host, | |||
} | |||
|
|||
const uint8_t *response = packet; | |||
dns_scan_response(&response, addr, addr_count); | |||
break; | |||
if (!dns_scan_response(&response, addr, addr_count)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't like using "!" for non-boolean values. "== 0" would have been clearer.
Also, you end up querying every DNS server when the destination doesn't exist (like 5.1 did). The point of extra DNS servers is to provide a backup if one goes down, not to get second opinions.
And you return "OK" if no servers respond.
Better fix is:
if (dns_scan_response(&response, addr, addr_count) > 0) {
result = NSAPI_ERROR_OK;
}
break;
Description
DNS name resolution was returning error even for successful cases
Status
READY
CC: @geky @0xc0170