summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonan Pigott <ronan@rjp.ie>2024-08-20 19:25:28 +0200
committerRonan Pigott <ronan@rjp.ie>2024-08-21 18:51:42 +0200
commit760fa203c2e335d437948355f1dc66b88b39b9f6 (patch)
treec07100791f58f3cb9e6e4dc88713a66958074058
parentresolved: introduce link_set_default_route (diff)
downloadsystemd-760fa203c2e335d437948355f1dc66b88b39b9f6.tar.xz
systemd-760fa203c2e335d437948355f1dc66b88b39b9f6.zip
resolved: use the fallback servers when no default dns is configured
This expands the role of fallback servers so they are applied not only when there are no dns servers configured, but when all the configured dns servers are configured only for non-default-route links.
-rw-r--r--src/resolve/resolved-dns-server.c2
-rw-r--r--src/resolve/resolved-link-bus.c3
-rw-r--r--src/resolve/resolved-link.c2
3 files changed, 3 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c
index cfdcc6d9bc..b48d8e1417 100644
--- a/src/resolve/resolved-dns-server.c
+++ b/src/resolve/resolved-dns-server.c
@@ -907,7 +907,7 @@ DnsServer *manager_get_dns_server(Manager *m) {
* servers */
HASHMAP_FOREACH(l, m->links)
- if (l->dns_servers) {
+ if (l->dns_servers && l->default_route) {
found = true;
break;
}
diff --git a/src/resolve/resolved-link-bus.c b/src/resolve/resolved-link-bus.c
index f5a3b0e36b..5e9e5bf17a 100644
--- a/src/resolve/resolved-link-bus.c
+++ b/src/resolve/resolved-link-bus.c
@@ -463,8 +463,7 @@ int bus_link_method_set_default_route(sd_bus_message *message, void *userdata, s
bus_client_log(message, "dns default route change");
if (l->default_route != b) {
- l->default_route = b;
-
+ link_set_default_route(l, b);
(void) link_save_user(l);
(void) manager_write_resolv_conf(l->manager);
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 01fa5878a6..928137b967 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -319,7 +319,7 @@ static int link_update_default_route(Link *l) {
if (r < 0)
goto clear;
- l->default_route = r > 0;
+ link_set_default_route(l, r > 0);
return 0;
clear: