diff options
author | Tom Gundersen <teg@jklm.no> | 2015-08-26 10:02:37 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-08-26 10:02:37 +0200 |
commit | aa036f1a236dc1b76879cc3870c77c4062adf948 (patch) | |
tree | 5ec1c6c9cc50311afe08844eccb6a1069a71ab1b /src/resolve/resolved-dns-zone.c | |
parent | da1d9fc2cc3bf6f89c037e11a584d444d0c3a2a8 (diff) | |
parent | d9fcf2ba1abe81ed3a7a151d6db09139b4dc7a09 (diff) |
Merge pull request #1046 from poettering/resolved-dump
dump resolved cache/zone info on SIGSUR1, plus one fix
Diffstat (limited to 'src/resolve/resolved-dns-zone.c')
-rw-r--r-- | src/resolve/resolved-dns-zone.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c index fc212f48f4..674bb6af28 100644 --- a/src/resolve/resolved-dns-zone.c +++ b/src/resolve/resolved-dns-zone.c @@ -636,3 +636,40 @@ void dns_zone_verify_all(DnsZone *zone) { dns_zone_item_verify(j); } } + +void dns_zone_dump(DnsZone *zone, FILE *f) { + Iterator iterator; + DnsZoneItem *i; + int r; + + if (!zone) + return; + + if (!f) + f = stdout; + + HASHMAP_FOREACH(i, zone->by_key, iterator) { + DnsZoneItem *j; + + LIST_FOREACH(by_key, j, i) { + _cleanup_free_ char *t = NULL; + + r = dns_resource_record_to_string(j->rr, &t); + if (r < 0) { + log_oom(); + continue; + } + + fputc('\t', f); + fputs(t, f); + fputc('\n', f); + } + } +} + +bool dns_zone_is_empty(DnsZone *zone) { + if (!zone) + return true; + + return hashmap_isempty(zone->by_key); +} |