mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] lookup_name issue with search domains
@ 2022-12-04  4:02 Kenny MacDermid
  2022-12-04  5:45 ` Markus Wichmann
  0 siblings, 1 reply; 9+ messages in thread
From: Kenny MacDermid @ 2022-12-04  4:02 UTC (permalink / raw)
  To: musl

Hello,

I'm seeing an issue in resolving hosts when any resolv.conf search
domain returns a no-data response. In debugging I believe it's caused by
the check in network/lookup_name.c, line 225:

if (cnt) return cnt;

The code is looping through the search domains trying each one.
This works fine for some of my search domains because the DNS response
will have reply code flags set to 3, which causes name_from_dns() to
return 0.

The issue arises when it queries my cloudflare hosted domain (which also
uses dnssec). That query does not have the reply code flags set to 3.
Instead it's set to 0. This results in name_from_dns() returning
EAI_NODATA.

Because of the above mentioned check, this value is directly returned
and subsequent domains (and most importantly the domain without anything
appended) are not tested.

When I replaced the condition with `(cnt > 0)` it worked for me. I'm not
sure that's the best solution, but I also can't see a reason to stop
attempting to lookup the host because an unrelated host caused some
error.

To add some context, this was seen in a golang program running on a
kind/Kubernetes cluster. In these clusters ndots is set to 5 so pretty
much every name is first checked against the search list. When using the
golang resolver with `GODEBUG=netdns=go` I do not see the same issue.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-12-06  9:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-04  4:02 [musl] lookup_name issue with search domains Kenny MacDermid
2022-12-04  5:45 ` Markus Wichmann
2022-12-04 15:31   ` Rich Felker
2022-12-04 23:04     ` Kenny MacDermid
2022-12-05 13:26       ` Rich Felker
2022-12-05 20:11         ` Kenny MacDermid
2022-12-05 22:25           ` Quentin Rameau
2022-12-06  5:19             ` Kenny MacDermid
2022-12-06  9:57               ` Quentin Rameau

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).