-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
resolved: beef up domain routing #11050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
382cb6b to
be7221d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Looks good to solve issues.
As I understand it, the Default [DNS] Route being 'yes' looks like an explicit '~.' and a setting to treat DNS Domains as route prefixes only, and not search domains. Was the new setting to preserve the existing behaviour in some way? Is there another function it serves?
Are there test cases for this complex interaction?
Much appreciate the fix.
man/systemd-resolved.service.xml
Outdated
| <itemizedlist> | ||
| <listitem><para>If a name to look up matches any of the configured search or route-only domains of any link (or | ||
| the globally configured DNS settings), the "best matching" search/route-only domain is determined: the matching | ||
| one with the most labels. The query is then sent to all DNS servers of any links or the globally configured DNS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If no answer, the query is then sent.."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, this is actually not what is meant here. We first determine the "best matching" domain, and then look for all links that have this "best matching" domain among their configured search domains. The query is then sent to all of them in parallel. This might be a single link or multiple, if the admin specified the same domains on two interfaces.
I will reword this in the man page
|
networkd-test.py fails... |
Not sure I grok fully what you are trying to day. But there are three levels now:
As tests there's test/networkd-test.py, but the routing tests are minimal, and don't cover the three levels of "default route" currently. |
be7221d to
770e546
Compare
|
I force pushed a new version, rebase on current git, with the CI tests (hopefully) fixed. Also fixed the typos and stuff @grooverdan's discovered. PTAL |
770e546 to
0264ce6
Compare
|
I've been running this branch of systemd resolved on my laptop for the last 8 days with the correct domain routing behaviour observed switching between wired and wireless networks, with and without vpn, every few days. Except for occasionally needing to 'resolvectl revert {previous link}' its been working well. |
0264ce6 to
fb0ff59
Compare
|
Travis CI failed due to #11170. |
b690b08 to
bb1ede3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments and questions... But some rework is needed.
This was forgotten when DoT was added.
The _INVALID and _MAX enum fields should always use the full name of thenum.
Previously, we'd return DNS_SCOPE_MAYBE for all domain lookups matching LLMNR or mDNS. Let's upgrade this to DNS_SCOPE_YES, to make the binding stronger. The effect of this is that even if "local" is defined as routing domain on some iface, we'll still lookup domains in local via mDNS — if mDNS is turned on. This should not be limiting, as people who don't want such lookups should turn off mDNS altogether, as it is useless if nothing is routed to it. This also has the nice benefit that mDNS/LLMR continue to work if people use "~." as routing domain on some interface. Similar for LLMNR and single label names. Similar also for the link local IPv4 and IPv6 reverse lookups. Fixes: systemd#10125
…as_route_only_domains() The function dns_server_limited_domains() was very strange as it enumerate the domains associated with a DnsScope object to determine whether any "route-only" domains, but did so as a function associated with a DnsServer object. Let's clear this up, and replace it by a function associated with a DnsScope instead. This makes more sense philosphically and allows us to reduce the loops through which we need to jump to determine whether a scope is suitable for default routing a bit.
…s default route Previously, we'd use a link as "default" route depending on whether there are route-only domains defined on it or not. (If there are, it would not be used as default route, if there aren't it would.) Let's make this explicit and add a link variable controlling this. The variable is not changeable from the outside yet, but subsequent commits are supposed to add that. Note that making this configurable adds a certain amount of redundancy, as there are now two ways to ensure a link does not receive "default" lookup (i.e. DNS queries matching no configured route): 1. By ensuring that at least one other link configures a route on it (for example by add "." to its search list) 2. By setting this new boolean to false. But this is exactly what is intended with this patch: that there is an explicit way to configure on the link itself whether it receives 'default' traffic, rather than require this to be configured on other links. The variable added is a tri-state: if true, the link is suitable for recieving "default" traffic. If false, the link is not suitable for it. If unset (i.e. negative) the original logic of "has this route-only routes" is used, to ensure compatibility with the status quo ante.
This simply reads from networkd's state files whether a link shall be used as DNS default route.
Also, do some minor updating.
bb1ede3 to
2e88625
Compare
|
I force pushed a new version now. Only changes are the ones @keszybz pointed out above, modulo the ones I commented out above. I also rebased, in the hope the CI goes all green. PTAL! |
|
OK, let's merge this. The changes I made were mostly in docs after all, and @keszybz liked it pretty much, the CI is all green, @grooverdan tested it successfully. |
|
There's a special case that's been biting me: I have an interface that looks like this: Everything works fine when /etc/resolv.conf is symlinked to /run/systemd/resolve/stub-resolv.conf. But in /run/systemd/resolve/resolv.conf, the nameservers that I don't want to use, still appear, in an order that seems nondeterministic: It would be best if it could either ensure that 172.31.0.2 is always listed first in such a special case, or, better yet to avoid DNS leaks over a VPN, ensure that it's the only server listed. Is that case dealt with by this PR? |
|
I have the same issue as @nathan-wmrln using systemd 240. With works for |
Fixes for #10125 #10830 #9825 #9472