summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve/resolved-manager.c')
-rw-r--r--src/resolve/resolved-manager.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 6bb089451f..a2de2edb48 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -536,10 +536,8 @@ Manager *manager_free(Manager *m) {
dns_scope_free(m->unicast_scope);
- while (m->dns_servers)
- dns_server_free(m->dns_servers);
- while (m->fallback_dns_servers)
- dns_server_free(m->fallback_dns_servers);
+ manager_flush_dns_servers(m, DNS_SERVER_SYSTEM);
+ manager_flush_dns_servers(m, DNS_SERVER_FALLBACK);
hashmap_free(m->links);
hashmap_free(m->dns_transactions);
@@ -1771,6 +1769,18 @@ void manager_verify_all(Manager *m) {
dns_zone_verify_all(&s->zone);
}
+void manager_flush_dns_servers(Manager *m, DnsServerType t) {
+ assert(m);
+
+ if (t == DNS_SERVER_SYSTEM)
+ while (m->dns_servers)
+ dns_server_free(m->dns_servers);
+
+ if (t == DNS_SERVER_FALLBACK)
+ while (m->fallback_dns_servers)
+ dns_server_free(m->fallback_dns_servers);
+}
+
static const char* const support_table[_SUPPORT_MAX] = {
[SUPPORT_NO] = "no",
[SUPPORT_YES] = "yes",