diff options
author | Ronan Pigott <ronan@rjp.ie> | 2024-08-21 18:36:13 +0200 |
---|---|---|
committer | Ronan Pigott <ronan@rjp.ie> | 2024-08-21 18:51:42 +0200 |
commit | c00157ddc2a72e23d60b61c39961fe4fbfd40ad0 (patch) | |
tree | 7c8b99137025385b9d5b93e0893fb6ceee93d215 | |
parent | Revert "resolved: demote the global unicast scope" (diff) | |
download | systemd-c00157ddc2a72e23d60b61c39961fe4fbfd40ad0.tar.xz systemd-c00157ddc2a72e23d60b61c39961fe4fbfd40ad0.zip |
resolved: introduce dns_server_is_fallback
-rw-r--r-- | src/resolve/resolved-dns-server.c | 4 | ||||
-rw-r--r-- | src/resolve/resolved-dns-server.h | 4 |
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); |