resolve: add resolv.conf mode to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.
This commit is contained in:
Nick Rosbrook
2025-10-10 15:56:34 -04:00
parent ed4d43f88f
commit 9f9264e3f6
2 changed files with 7 additions and 0 deletions

View File

@@ -2054,6 +2054,7 @@ static int dns_configuration_json_append(
DnsOverTlsMode dns_over_tls_mode,
ResolveSupport llmnr_support,
ResolveSupport mdns_support,
ResolvConfMode resolv_conf_mode,
sd_json_variant **configuration) {
_cleanup_(sd_json_variant_unrefp) sd_json_variant *dns_servers_json = NULL,
@@ -2146,6 +2147,7 @@ static int dns_configuration_json_append(
JSON_BUILD_PAIR_STRING_NON_EMPTY("dnsOverTLS", dns_over_tls_mode_to_string(dns_over_tls_mode)),
JSON_BUILD_PAIR_STRING_NON_EMPTY("llmnr", resolve_support_to_string(llmnr_support)),
JSON_BUILD_PAIR_STRING_NON_EMPTY("mDNS", resolve_support_to_string(mdns_support)),
JSON_BUILD_PAIR_STRING_NON_EMPTY("resolvConfMode", resolv_conf_mode_to_string(resolv_conf_mode)),
JSON_BUILD_PAIR_VARIANT_NON_NULL("scopes", scopes_json));
}
@@ -2174,6 +2176,7 @@ static int global_dns_configuration_json_append(Manager *m, sd_json_variant **co
manager_get_dns_over_tls_mode(m),
m->llmnr_support,
m->mdns_support,
resolv_conf_mode(),
configuration);
}
@@ -2228,6 +2231,7 @@ static int link_dns_configuration_json_append(Link *l, sd_json_variant **configu
link_get_dns_over_tls_mode(l),
link_get_llmnr_support(l),
link_get_mdns_support(l),
/* resolv_conf_mode = */ _RESOLV_CONF_MODE_INVALID,
configuration);
}
@@ -2256,6 +2260,7 @@ static int delegate_dns_configuration_json_append(DnsDelegate *d, sd_json_varian
/* dns_over_tls_mode = */ _DNS_OVER_TLS_MODE_INVALID,
/* llmnr_support = */ _RESOLVE_SUPPORT_INVALID,
/* mdns_support = */ _RESOLVE_SUPPORT_INVALID,
/* resolv_conf_mode = */ _RESOLV_CONF_MODE_INVALID,
configuration);
}

View File

@@ -179,6 +179,8 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
SD_VARLINK_DEFINE_FIELD(llmnr, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("mDNS support."),
SD_VARLINK_DEFINE_FIELD(mDNS, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("resolv.conf mode, set for global configuration only."),
SD_VARLINK_DEFINE_FIELD(resolvConfMode, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("Array of current DNS scopes."),
SD_VARLINK_DEFINE_FIELD_BY_TYPE(scopes, DNSScope, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE));