mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Luca BRUNO <>
Subject: Re: [musl] musl resolver handling of "search ." in /etc/resolv.conf
Date: Thu, 1 Sep 2022 16:03:18 +0000	[thread overview]
Message-ID: <20220901160318.67d15b3f@ephyra> (raw)
In-Reply-To: <>

On Thu, 1 Sep 2022 08:45:12 -0400
Rich Felker <> wrote: 

> "search ." by itself is a semantically a no-op. It specifies a single
> search domain that's the DNS root, which is exactly what gets queried
> with no search at all. systemd is writing this into resolv.conf
> because of a glibc "misbehavior" (to put it lightly) where, in the
> absence of any search directive, it defaults to searching the domain
> of the system hostname (so would implicitly
> search, which is obviously wrong to do, and systemd is
> trying to suppress that). But it would also cause failing lookups to
> be performed in duplicate, unless there's logic to suppress the final
> non-search lookup when root was already searched explicitly.

While tracking down this musl bug, I empirically observed from
network traces that glibc does apply such de-duplication logic under the
same configuration.
That is, it performs the root-anchored query in the specified order, and
in case of a negative response it does *not* perform the query again as
it would otherwise do for the final fallback case.

> > > There are 3 options I see:
> > >
> > > - Actually support it as a search. This is *bad* behavior, but at
> > >   least unlike the version of this behavior musl explicitly does
> > > not implement, it was explicitly requested by the user. Except
> > > that it wasn't, because systemd is just putting it in everyone's
> > >   resolv.conf..
> > >
> > > - Skip it completely. Never search root; wait for the end of the
> > >   search list and query root as always.
> > >
> > > - End search on encountering it and go directly to the post-search
> > >   query at root.
> > >
> > > Anyone care strongly about this one way or another?  

From my observations, option 1 is consistent with other libc's behavior.
But it has the above caveat that it needs additional caching to
avoid duplicate root-queries on negative responses.
If it isn't too invasive to implement, that would be my preferred one.

Option 2 looks somehow reasonable too. The skewed order would be
a bit surprising, but it can be documented and it's unlikely to affect
many real-world usages.

Ciao, Luca

  reply	other threads:[~2022-09-01 16:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 17:33 Dalton Hubble
2022-08-31 23:59 ` Rich Felker
2022-09-01  1:32   ` Jeffrey Walton
2022-09-01 12:45     ` Rich Felker
2022-09-01 16:03       ` Luca BRUNO [this message]
2022-09-01 18:01         ` Rich Felker
2022-09-02  8:09           ` Luca BRUNO
2022-09-19 17:18           ` 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:

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

  git send-email \
    --in-reply-to=20220901160318.67d15b3f@ephyra \ \ \

* 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

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).