Skip to content

dns error messages, take2#18251

Closed
icing wants to merge 2 commits intocurl:masterfrom
icing:dns-error-msgs-2
Closed

dns error messages, take2#18251
icing wants to merge 2 commits intocurl:masterfrom
icing:dns-error-msgs-2

Conversation

@icing
Copy link
Copy Markdown
Contributor

@icing icing commented Aug 11, 2025

Use ares_strerror() to retrieve error message from c-ares.

Add optional detail to Curl_resolver_error() to add to failure message where available. This makes, for c-ares, the reason for a failed resource available to the user without extra trace config.

When "dns" tracing enabled, print the c-ares server config at the start of a resolve.

Use `ares_strerror()` to retrieve error message from c-ares.

Add optional detail to `Curl_resolver_error()` to add to failure
message where available. This makes, for c-ares, the reason for
a failed resource available to the user without extra trace config.

When "dns" tracing enabled, print the c-ares server config at the
start of a resolve.
@github-actions github-actions bot added the name lookup DNS and related tech label Aug 11, 2025
@icing icing mentioned this pull request Aug 11, 2025
Comment thread lib/asyn-ares.c Outdated
Comment thread lib/hostip.c
#endif

failf(data, "Could not resolve %s: %s", host_or_proxy, name);
failf(data, "Could not resolve %s: %s%s%s%s", host_or_proxy, name,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to affect the Could not resolve hostname message when it fails to resolve the DOH server, it'd be nice to change that one too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DoH problems are now in #18346

@bagder bagder closed this in 6b111f0 Aug 22, 2025
Comment thread lib/asyn-ares.c

#if ARES_VERSION >= 0x011800 /* >= v1.24.0 */
CURL_TRC_DNS(data, "asyn-ares: servers=%s",
ares_get_servers_csv(ares->channel));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the ares_get_servers_csv() man page:

ares_get_servers_csv(3) returns a string representing the servers configured which must be freed with ares_free_string(3).

So this should leak memory every time it's called.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icing @bagder , I see this got into curl-8_16_0.

bagder pushed a commit that referenced this pull request Sep 24, 2025
When DNS tracing is enabled, a string allocated by ares was not freed.

Reported-by: jmaggard10 on github
Bug: #18251 (review)
Closes #18691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

name lookup DNS and related tech

Development

Successfully merging this pull request may close these issues.

5 participants