mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Rob de Wit <rob.dewit@coosto.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Clarification on the NOERROR resolving choices
Date: Tue, 27 Jun 2023 10:36:04 -0400	[thread overview]
Message-ID: <20230627143604.GT4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAPBMcbtvCz6OKR+iQi55-4_nLEzMBJLKTNf6PHME2xCvZ=v6zA@mail.gmail.com>

On Tue, Jun 27, 2023 at 07:12:51AM -0700, Rob de Wit wrote:
> Hi
> 
> I ran into some issues lately and found this in the mailing list archive
> https://www.openwall.com/lists/musl/2019/05/30/3
> 
> The problem I had was with Alpine containers that suddenly failed resolving
> any hostname. I ended up tracing it back to a change I made in a domain
> that was in the "search" fiels in /etc/resolv.conf. The change was a
> wildcard TXT field. So when the resolver was resolving
> <host>.<tld>.<searchdomain>.<tld> it received an NOERROR reply. This
> indicates there is a record but just not a "A" or "AAAA" one. Perfectly
> valid as far as I know, but the resolver then quits the search.

This is the intended behavior. When reaching a name that exists, the
search stops and uses that result. Otherwise the search outcome will
be unstable depending on factors like which address family was
queried. In theory, that particular case could be precluded by always
performing both A and AAAA queries, even when only one was requested
by the caller, but users would likely not be happy with this behavior,
especially if it meant waiting for an uncached AAAA result that's not
even desired or erroring out in sloppy IPv4-only environments where
something is setup to make the AAAA fail. But not even getting into
that specific case, it's just having consistent high level semantics.
Search continues if and only if the attempted name does not exist.

> Maybe someone here can clarify this behaviour, because from the referred
> thread in the mailing list I get that this is caused by malfunctioning DNS,
> but in my case I don't think it is.

It's not "malfunctioning", just returning something whose semantics
mismatch what you want.

> Right now our options are:
> 
>    - adjusting ndots in resolv.conf - but we actually use the search path

Setting ndots greater than 1 always gives undesirable behaviors like
adding potentially substantial delay when looking up a name that was
already fully qualified, independently of whether you're using musl or
something else. It really should be treated only as a way to support
legacy setups, not part of new designs.

>    - adding a dot at the end - this can only work if we know up front we
>    don't want the search path
>    - replacing Alpine with some libc-based image - this involves many
>    changes
>    - not to do it again (adding wildcard for something other than A or AAAA
>    records)

It's not a matter of whether it's something other than A or AAAA; just
that you have a wildcard in your search domain path. This will never
give acceptable results unless your goal is to intercept all lookups
and have them return the same thing (either NODATA or a fixed
address).

Rich

  reply	other threads:[~2023-06-27 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 14:12 Rob de Wit
2023-06-27 14:36 ` Rich Felker [this message]
2023-06-27 15:05   ` Rob de Wit
2023-06-27 15:22     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230627143604.GT4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=rob.dewit@coosto.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).