diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-01-19 17:11:28 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-01-19 18:37:45 +0100 |
commit | 593f665cd5ffddbaa3ddbe9d963af923ed1cc5dc (patch) | |
tree | 8798ac9f873c2d95a8034f8b87026c2c2938b28b /src | |
parent | 786c8e9fbc95d1cb6365b3854f3090fb26bf46b2 (diff) |
resolve-host: show whether DNSSEC is supported or not in --statistics output
This should be generally useful information, hence show it.
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve-host/resolve-host.c | 18 | ||||
-rw-r--r-- | src/resolve/resolved-bus.c | 32 |
2 files changed, 49 insertions, 1 deletions
diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c index 512f976f67..2580897a79 100644 --- a/src/resolve-host/resolve-host.c +++ b/src/resolve-host/resolve-host.c @@ -771,10 +771,26 @@ static int show_statistics(sd_bus *bus) { uint64_t n_current_transactions, n_total_transactions, cache_size, n_cache_hit, n_cache_miss, n_dnssec_secure, n_dnssec_insecure, n_dnssec_bogus, n_dnssec_indeterminate; - int r; + int r, dnssec_supported; assert(bus); + r = sd_bus_get_property_trivial(bus, + "org.freedesktop.resolve1", + "/org/freedesktop/resolve1", + "org.freedesktop.resolve1.Manager", + "DNSSECSupported", + &error, + 'b', + &dnssec_supported); + if (r < 0) + return log_error_errno(r, "Failed to get DNSSEC supported state: %s", bus_error_message(&error, r)); + + printf("DNSSEC supported by current servers: %s%s%s\n\n", + ansi_highlight(), + yes_no(dnssec_supported), + ansi_normal()); + r = sd_bus_get_property(bus, "org.freedesktop.resolve1", "/org/freedesktop/resolve1", diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index 4593bab5e8..db7b88e5fb 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -1292,6 +1292,37 @@ static int bus_property_get_dnssec_statistics( (uint64_t) m->n_dnssec_indeterminate); } +static int bus_property_get_dnssec_supported( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + Manager *m = userdata; + DnsServer *server; + bool supported = true; + Iterator i; + Link *l; + + assert(reply); + assert(m); + + server = manager_get_dns_server(m); + if (server) + supported = supported && dns_server_dnssec_supported(server); + + HASHMAP_FOREACH(l, m->links, i) { + server = link_get_dns_server(l); + if (server) + supported = supported && dns_server_dnssec_supported(server); + } + + return sd_bus_message_append(reply, "b", supported); +} + static int bus_method_reset_statistics(sd_bus_message *message, void *userdata, sd_bus_error *error) { Manager *m = userdata; DnsScope *s; @@ -1316,6 +1347,7 @@ static const sd_bus_vtable resolve_vtable[] = { SD_BUS_PROPERTY("TransactionStatistics", "(tt)", bus_property_get_transaction_statistics, 0, 0), SD_BUS_PROPERTY("CacheStatistics", "(ttt)", bus_property_get_cache_statistics, 0, 0), SD_BUS_PROPERTY("DNSSECStatistics", "(tttt)", bus_property_get_dnssec_statistics, 0, 0), + SD_BUS_PROPERTY("DNSSECSupported", "b", bus_property_get_dnssec_supported, 0, 0), SD_BUS_METHOD("ResolveHostname", "isit", "a(iiay)st", bus_method_resolve_hostname, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("ResolveAddress", "iiayt", "a(is)t", bus_method_resolve_address, SD_BUS_VTABLE_UNPRIVILEGED), |