mailing list of musl libc
 help / color / mirror / code / Atom feed
* Re: Re: Would love to see reconsideration for domain and search
@ 2015-10-23 15:30 Jan Broer
  2015-10-23 16:01 ` Tim Hockin
  0 siblings, 1 reply; 44+ messages in thread
From: Jan Broer @ 2015-10-23 15:30 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]

A very interesting discussion going on here.

> You can't query all nameservers and just take
> the first NXDOMAIN to respond.  You can only accept NXDOMAIN if all of
> the higher-priority (listed first in resolv.conf) nameservers have
> timed out or SERVFAIL'ed.  You can issue queries in parallel, but you
> must process responses in order, which is what you describe below.

GNU libc resolver gives priority to the primary nameserver because it
assumes that this is the one with the lowest RTT / highest availability.
This priorization was never understood as meaning that the primary's
servers records are more "authorative" than those of secondary nameservers.

> My view has always been that multiple
> nameservers in resolv.conf are for redundancy, not for serving
> conflicting records.

I agree.

>I have to disagree.  Some non-forwarding DNS servers use SERVFAIL to
>indicate "I am not serving for that domain" specifically to make the
>client move to their next nameserver.  if ns1 returns SERVFAIL, try
>ns2.  If ns1 times out, try ns2.  Otherwise what good is ns2?

This kind of result unioning you want from musl-libs isn't even supported
by GNU libc resolver. Yes it works for you - but this is because your DNS
server is breaking DNS RFC specs: SERVFAIL is not a technically legal
response for  "I am not serving for that domain". It's just WRONG. When an
authorative server (which the Kubernetes DNS server is) doesn't serve a
specific zone it has to respond with  NXDOMAIN. Of course if your server
would follow the rules than that type of result unioning doesn't work
because GNU libc resolver does not failover to secondary servers when the
response is NXDOMAIN.
It's just a weak argument to essentially say: "The GNU libc resolver does
exactly what i want when i point it to my broken DNS server, why can't
musl-libc?".

The bottom line:

Leave nameserver querying logic as it is: Check!
Implement search paths: Check!
Consider ndots option in resolv.conf: Check!

query name <= ndots: search first
query name > ndots : never search

LGTM!

Jan

[-- Attachment #2: Type: text/html, Size: 2621 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: Would love to see reconsideration for domain and search
@ 2015-10-22 21:24 Tim Hockin
  2015-10-22 21:56 ` Rich Felker
  2015-10-23  5:26 ` Kurt H Maier
  0 siblings, 2 replies; 44+ messages in thread
From: Tim Hockin @ 2015-10-22 21:24 UTC (permalink / raw)
  To: musl

Hi all,

I saw this thread on the web archive but am not sure how to respond to
the thread directly as a new joinee of the ML.  I hope this finds its
way...

I am one of the developers of Kubernetes and I own the DNS portion, in
particular.  I desperately want to use Alpine Linux (based on musl)
but for now I have to warn people NOT to use it because of this issue.

On Fri, Sep 04, 2015 at 02:04:29PM -0400, Rich Felker wrote:
> On Fri, Sep 04, 2015 at 12:11:36PM -0500, Andy Shinn wrote:
>> I'm writing the wonderful musl project today to open discussion
>> about the future possibility of DNS search and domain keyword
>> support. We've been using musl libc (by way of Alpine Linux) for
>> new development of applications as containers that discover each
>> other through DNS and other software defined networking.
>>
>> In particular, we are starting to use applications like SkyDNS,
>> Consul, and Kubernetes, all of which rely on local name
>> resolution in some way using search paths. Many users of the
>> Alpine Linux container image have also expressed their desire for
>> this feature at
>> https://github.com/gliderlabs/docker-alpine/issues/8.
>>
>> On the functional differences between glibc page, the domain and
>> search keyword "Support may be added in the future if there is
>> demand". So please consider this request an addition to whatever
>> demand for the feature already exists.
>>
>> Thank you for your time and great work on the musl libc project!
>
> I think this is a reasonable request. I'll look into it more.
>
> One property I do not want to break is deterministic results, so
> when a search is performed, if any step of the search ends with
> an error rather than a positive or negative result, the whole
> lookup needs to stop and report the error rather than falling
> back. Falling back is not safe and creates a situation where DoS
> can be used to control which results are returned.

I understand your point, though the world at large tends to disagree.
Everyone has a primary and secondary `nameserver` record (or should).
If the first one times out, try the second.  Most resolver libs seem
to accept a SERVFAIL response or a timeout as a signal to try the next
server, and I would encourage you to do the same.

Stopping on positive response or NXDOMAIN seems to be commonly
accepted with a caveat.  You can't query all nameservers and just take
the first NXDOMAIN to respond.  You can only accept NXDOMAIN if all of
the higher-priority (listed first in resolv.conf) nameservers have
timed out or SERVFAIL'ed.  You can issue queries in parallel, but you
must process responses in order, which is what you describe below.

> While it would be possible to parallelize the search while
> serializing the results (i.e. waiting to accept a result from the
> second query until the first query finished with a negative
> result), I think the consensus during the last round of
> discussion of this topic was that the complexity cost is too
> great and the benefit too small. Ideally, the first query should
> always succeed, anyway.

The real world is not ideal.  Not all nameservers are identically
scoped - you MUST respect the ordering in resolv.conf - to do
otherwise is semantically broken.  If implementation simplicity means
literally doing queries in serial, then that is what you should do.

Similarly, you can't just search all search domains in parallel and
take the first response.  The ordering is meaningful.

> I also have a few questions:
>
> 1. Do you need multiple search items, or just a single domain?
>    Any setup with multiple searches necessarily has suboptimal
>    performance because ndots is not sufficient to make the right
>    initial choice of query. If you do need this functionality, a
>    unioning proxy dns server may be a better option than resolv.conf
>    domain search; it would give much better performance.

We use multiple search paths and ndots > 1.  I'm not sure what you
mean by "unioning" here.  Search path ordering is as meaningful as
nameserver ordering.  You can't avoid making the query for each search
suffix in the worst case, and it has the same restriction as
nameserver - the search order must be respected.

There does seem to be some different implementations that search for
the "naked" query first vs last, though.  I think the semantically
correct (but pessimal performance) is to search for that last.

> 2. For your intended applications, is there a need to support
>    ndots>1?  Such configurations are generally not friendly to
>    applications that expect to be able to resolve normal internet
>    domain lookups, and performance for such lookups will be very bad
>    (because the search domains first have to fail).

DNS is a very lightweight protocol.  We have not measured any
practical detriment for having 6 search domains and ndots=5.  In the
normal case it fails very quickly.  That aside, it should be my
business if I want to (mis)configure my system that way :)

> 3. The glibc behavior is just to swap the order of search when
>    the query string has >=ndots dots in it, but would it be
>    acceptable never to try the search domains at all in this case?
>    That would yield much better performance for nxdomain results and
>    avoid unexpected positive results due to weird subdomains
>    existing in your search domain (e.g. a wildcard for
>    *.us.example.com would cause *.us to wrongly resolve for
>    non-existant .us domains).

I think that would be correct.  If I have 3 dots and ndots=2, search
paths should be ignored.

Tim


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

end of thread, other threads:[~2016-01-29  0:58 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23 15:30 Re: Would love to see reconsideration for domain and search Jan Broer
2015-10-23 16:01 ` Tim Hockin
2015-10-23 17:40   ` Jan Broer
2015-10-23 18:02     ` Tim Hockin
2015-10-23 18:03     ` Jan Broer
2015-10-23 18:29     ` Rich Felker
2015-10-23 21:27       ` Jan Broer
  -- strict thread matches above, loose matches on Subject: below --
2015-10-22 21:24 Tim Hockin
2015-10-22 21:56 ` Rich Felker
2015-10-22 22:36   ` Tim Hockin
2015-10-22 23:00     ` Josiah Worcester
2015-10-22 23:37       ` Tim Hockin
2015-10-23  4:27         ` Rich Felker
2015-10-23  5:13           ` Tim Hockin
2015-10-23  5:31             ` Rich Felker
2015-10-23  5:37               ` Tim Hockin
2015-10-23  6:00                 ` Rich Felker
2015-10-23  6:04                   ` Tim Hockin
2016-01-29  0:57                 ` Rich Felker
2015-10-27  0:30               ` Rich Felker
2015-10-27  0:37                 ` Tim Hockin
2015-10-27  0:45                   ` Rich Felker
2015-10-27  8:11                 ` u-uy74
2015-11-28 22:48                 ` Jan Broer
2015-11-28 23:20                   ` Rich Felker
2015-11-29  3:06                     ` Jan Broer
2016-01-29  0:58                   ` Rich Felker
2015-10-23  8:12       ` u-uy74
2015-10-23  9:35         ` Laurent Bercot
2015-10-23 12:23           ` Laurent Bercot
2015-10-23 15:57           ` Tim Hockin
2015-10-23  5:26 ` Kurt H Maier
2015-10-24 21:33   ` Tim Hockin
2015-10-24 21:57     ` Kurt H Maier
2015-10-24 23:31       ` Rich Felker
2015-10-24 22:02     ` Rich Felker
2015-10-24 22:32       ` Tim Hockin
2015-10-25  8:20       ` u-uy74
2015-10-25 13:06       ` Jan Broer
2015-10-25 13:19         ` u-uy74
2015-10-25 13:39           ` Jan Broer
2015-10-25 14:08             ` u-uy74
2015-10-25 19:08         ` Rich Felker
2015-10-26  1:26       ` Isaac Dunham
2015-10-26 15:35         ` Rich Felker

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