Skip to content

[resolved] change the behavior of routing/search domains to "query the most specifc one(s)" only #9825

Closed

Description

@msoltyspl

Is your feature request related to a problem? Please describe.

The context is related to two bug reports I did earlier - namely:

#9472
#9475

While I started fixing the man pages, I thought that maybe changing the current behavior - from - query any matching [sub]domains even if longer (more precise) are available - to - query the server(s) with the longest available route / search domain names only - would be better after all.

TBH I'm not sure if the current behavior is intended or actually subtly bugged - the comment in 9472 suggests the former, so I wrote this as a RFE.

A clear and concise description of what you want to happen.

Make the route and search domains work on basis of the longest search/route domain available (as e.g. unbound behaves). Consider following example:

global settings:

  • routing domain: ~.
  • dns server: 1.1.1.1

link1:

  • routing/search domain: example.com
  • dns server: 10.0.0.1

link2:

  • routing/search domain: bar.example.com
  • dns server: 192.168.0.1

Currently - if any of the more precise links are online and provide dns for the same name returning different addresses (e.g. company's internal addresses), then .~ will potentially cause issues - as any and all queries will also go to 1.1.1.1. The same applies to any other link if we add .~ there as well

Similarly, if say link1 and link2 are active, the query for foo.bar.example.com will go to dns servers of both connections (as both example.com and bar.example.com formally match foo.bar.example.com). If addresses replied by respective nameservers are different, then this will also not work correctly (on top of the query being sent to 1.1.1.1 as well, if ~. was still present in the configuration).

Normally, the users will always be interested in the queries being sent to the most specific name server(s) (longest route/domain search name that can match the query). And at the same time - they will not want them to go to more generic dns servers (the worst case scenario being ~. present on any of the links or globally), as in most cases it won't even make any sense.

From other resolvers supporting similar functionality - aforementioned unbound behaves this way.

Even if for some reason someone would want more generic servers answering queries when more precise servers are available - current behavior could be retained by simply specifying those search/route domains explicitly.

Describe alternatives you've considered

An alternative could be adding separate class of search/routing domains (e.g. with additional prefix: ~!. ~!example.com !example.com) that would behave in a way described above - but that feels like an overkill and the current behavior doesn't really offer any particular benefits.

Activity

  1. added
    bug 🐛
    on Aug 8, 2018
  2. poettering commented on Dec 4, 2018

    @poettering
    Member

    Fix waiting in #11050

  3. msoltyspl commented on Jan 10, 2019

    @msoltyspl
    ContributorAuthor

    I think there is still issue with this (as tested with systemd v240). I tested 4 (1 link + 3 macvlans) links with 4 search domains:

    touk.pl
    a.touk.pl
    b.a.touk.pl
    c.b.a.touk.pl

    Then did simple:

    for a in {0..99}; do resolvectl flush-caches; ping -c1 -w1 xx; done

    The effect was essentially random. First reply to get back to resolver won "the competition":

    PING xx.a.touk.pl (192.168.44.111) 56(84) bytes of data.
    PING xx.touk.pl (192.168.44.10) 56(84) bytes of data.
    PING xx.a.touk.pl (192.168.44.111) 56(84) bytes of data.
    PING xx.c.b.a.touk.pl (192.168.44.131) 56(84) bytes of data.
    PING xx.b.a.touk.pl (192.168.44.121) 56(84) bytes of data.
    

    With typical log entry:

    Jan 10 16:21:22 hakai systemd-resolved[31550]: Cache miss for xx.c.b.a.touk.pl IN A
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Transaction 13517 for <xx.c.b.a.touk.pl IN A> scope dns on mac2/*.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using feature level UDP+EDNS0 for transaction 13517.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using DNS server 10.13.36.11 for transaction 13517.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Sending query packet with id 13517.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Cache miss for xx.b.a.touk.pl IN A
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Transaction 55365 for <xx.b.a.touk.pl IN A> scope dns on mac1/*.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using feature level UDP+EDNS0 for transaction 55365.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using DNS server 10.13.36.10 for transaction 55365.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Sending query packet with id 55365.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Cache miss for xx.a.touk.pl IN A
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Transaction 31246 for <xx.a.touk.pl IN A> scope dns on mac0/*.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using feature level UDP+EDNS0 for transaction 31246.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using DNS server 192.168.0.30 for transaction 31246.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Sending query packet with id 31246.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Cache miss for xx.touk.pl IN A
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Transaction 60176 for <xx.touk.pl IN A> scope dns on eno1/*.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using feature level UDP+EDNS0 for transaction 60176.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Using DNS server 192.168.0.40 for transaction 60176.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Sending query packet with id 60176.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.2863 path=n/a interface=n/a member=n/a cookie=72 reply_cookie=167 signature=n/a error-name=n/a error-message=n/a
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Match type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.2929' successfully installed.
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Processing incoming packet on transaction 31246 (rcode=SUCCESS).
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Added positive unauthenticated cache entry for xx.a.touk.pl IN A 300s on mac0/INET/192.168.0.30
    Jan 10 16:21:22 hakai systemd-resolved[31550]: Transaction 31246 for <xx.a.touk.pl IN A> on scope dns on mac0/* now complete with <success> from network (unsigned).
    

    Adding ~. causes the same behavior as explained earlier - it routes the query to dnses on links where it's defined and nowhere else. If those links have search domains defined, then they will be appended and tried. In the example above, if we had:

    a.touk.pl ~.
    b.a.touk.pl ~.

    Then the answers for xx would randomly become an address assigned to xx.a.touk.pl or xx.b.a.touk.pl. (even if those two links had DNSDefaultRoute=no, as ~. takes precedence over it).

    (for the record - querying for fqdn names that don't involve domain appending behaves correctly now, the above is only in context of names that must be appended first - the case above is kind of a corner one; none the less ~. probably shouldn't be interested in names without dots at least).

  4. msoltyspl commented on Jun 18, 2019

    @msoltyspl
    ContributorAuthor

    Been going over my older still open issues.

    I redid the tests related to the last reply with stable-v242 and I can't reproduce the ~. issues anymore. In context of single-name's completions the search domains are tested correctly against the names on links where they appear regardless if/where ~. is or isn't.

    The random "win first" - not sure if it's worth pursuing - and there's also no clean solution if the domains are not related either way.

    So I'll close this issue - should I find at some point something related/similar, I'll create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛resolve

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions