diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-12 19:32:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-12 19:32:55 +0200 |
commit | 3e684349c2cead2e6fd2f816c34eb17daba23a49 (patch) | |
tree | d03a3d7a3491d1462e4693f60d1d8e041806f03d /src/resolve/resolved-manager.c | |
parent | 96c76ac49c28ba397fc8db3a40505b875c65ef16 (diff) |
resolved: unify logic how we flush out DNS servers we learnt
Diffstat (limited to 'src/resolve/resolved-manager.c')
-rw-r--r-- | src/resolve/resolved-manager.c | 18 |
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", |