From: Nick Rosbrook Date: Fri, 10 Oct 2025 19:56:34 +0000 (-0400) Subject: resolve: add resolv.conf mode to DNSConfiguration X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f9264e3f6db22c6951828bb3571f42aeb97aa8b;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index b3af9ce4e32..259886ff046 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -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); } diff --git a/src/shared/varlink-io.systemd.Resolve.Monitor.c b/src/shared/varlink-io.systemd.Resolve.Monitor.c index 622975e5de7..389da45a5e8 100644 --- a/src/shared/varlink-io.systemd.Resolve.Monitor.c +++ b/src/shared/varlink-io.systemd.Resolve.Monitor.c @@ -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));