summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/resolve/resolved-dns-server.c4
-rw-r--r--src/resolve/resolved-dns-server.h4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c
index 70894977eb..cfdcc6d9bc 100644
--- a/src/resolve/resolved-dns-server.c
+++ b/src/resolve/resolved-dns-server.c
@@ -100,9 +100,7 @@ int dns_server_new(
/* A new DNS server that isn't fallback is added and the one
* we used so far was a fallback one? Then let's try to pick
* the new one */
- if (type != DNS_SERVER_FALLBACK &&
- m->current_dns_server &&
- m->current_dns_server->type == DNS_SERVER_FALLBACK)
+ if (type != DNS_SERVER_FALLBACK && dns_server_is_fallback(m->current_dns_server))
manager_set_dns_server(m, NULL);
if (ret)
diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h
index 5e1d5698f6..7d7d294c82 100644
--- a/src/resolve/resolved-dns-server.h
+++ b/src/resolve/resolved-dns-server.h
@@ -182,4 +182,8 @@ void dns_server_unref_stream(DnsServer *s);
DnsScope *dns_server_scope(DnsServer *s);
+static inline bool dns_server_is_fallback(DnsServer *s) {
+ return s && s->type == DNS_SERVER_FALLBACK;
+}
+
int dns_server_dump_state_to_json(DnsServer *server, sd_json_variant **ret);