summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/resolve/resolved-conf.c25
-rw-r--r--src/resolve/resolved-manager.c5
-rw-r--r--src/resolve/resolved-manager.h3
-rw-r--r--src/resolve/resolved.c6
4 files changed, 27 insertions, 12 deletions
diff --git a/src/resolve/resolved-conf.c b/src/resolve/resolved-conf.c
index fe88006fb7..7e3b613816 100644
--- a/src/resolve/resolved-conf.c
+++ b/src/resolve/resolved-conf.c
@@ -116,6 +116,8 @@ int config_parse_dns_servers(
* /etc/resolv.conf */
if (ltype == DNS_SERVER_SYSTEM)
m->read_resolv_conf = false;
+ if (ltype == DNS_SERVER_FALLBACK)
+ m->need_builtin_fallbacks = false;
return 0;
}
@@ -155,11 +157,24 @@ int config_parse_support(
}
int manager_parse_config_file(Manager *m) {
+ int r;
+
assert(m);
- return config_parse_many(PKGSYSCONFDIR "/resolved.conf",
- CONF_PATHS_NULSTR("systemd/resolved.conf.d"),
- "Resolve\0",
- config_item_perf_lookup, resolved_gperf_lookup,
- false, m);
+ r = config_parse_many(PKGSYSCONFDIR "/resolved.conf",
+ CONF_PATHS_NULSTR("systemd/resolved.conf.d"),
+ "Resolve\0",
+ config_item_perf_lookup, resolved_gperf_lookup,
+ false, m);
+ if (r < 0)
+ return r;
+
+ if (m->need_builtin_fallbacks) {
+ r = manager_parse_dns_server_string_and_warn(m, DNS_SERVER_FALLBACK, DNS_SERVERS);
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+
}
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 5ebf1926be..c3c61a0893 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -476,10 +476,7 @@ int manager_new(Manager **ret) {
m->llmnr_support = SUPPORT_YES;
m->read_resolv_conf = true;
-
- r = manager_parse_dns_server_string_and_warn(m, DNS_SERVER_FALLBACK, DNS_SERVERS);
- if (r < 0)
- return r;
+ m->need_builtin_fallbacks = true;
r = sd_event_default(&m->event);
if (r < 0)
diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h
index 08dd61fb14..8a716b3ceb 100644
--- a/src/resolve/resolved-manager.h
+++ b/src/resolve/resolved-manager.h
@@ -70,7 +70,8 @@ struct Manager {
LIST_HEAD(DnsServer, fallback_dns_servers);
DnsServer *current_dns_server;
- bool read_resolv_conf;
+ bool need_builtin_fallbacks:1;
+ bool read_resolv_conf:1;
usec_t resolv_conf_mtime;
LIST_HEAD(DnsScope, dns_scopes);
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index e07f49ce17..be406b71fe 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -82,8 +82,10 @@ int main(int argc, char *argv[]) {
}
r = manager_parse_config_file(m);
- if (r < 0)
- log_warning_errno(r, "Failed to parse configuration file: %m");
+ if (r < 0) {
+ log_error_errno(r, "Failed to parse configuration file: %m");
+ goto finish;
+ }
r = manager_start(m);
if (r < 0) {