resolved: let's generate enum fields properly too
AFAICS none of the enums here uses dashes, hence this should not actually have any effect except for being more correct.
This commit is contained in:
@@ -1544,10 +1544,10 @@ int link_build_json(Link *link, sd_json_variant **ret) {
|
||||
SD_JSON_BUILD_PAIR_STRING("AdministrativeState", link_state_to_string(link->state)),
|
||||
SD_JSON_BUILD_PAIR_STRING("OperationalState", link_operstate_to_string(link->operstate)),
|
||||
SD_JSON_BUILD_PAIR_STRING("CarrierState", link_carrier_state_to_string(link->carrier_state)),
|
||||
SD_JSON_BUILD_PAIR_STRING("AddressState", link_address_state_to_string(link->address_state)),
|
||||
SD_JSON_BUILD_PAIR_STRING("IPv4AddressState", link_address_state_to_string(link->ipv4_address_state)),
|
||||
SD_JSON_BUILD_PAIR_STRING("IPv6AddressState", link_address_state_to_string(link->ipv6_address_state)),
|
||||
SD_JSON_BUILD_PAIR_STRING("OnlineState", link_online_state_to_string(link->online_state)));
|
||||
JSON_BUILD_PAIR_ENUM("AddressState", link_address_state_to_string(link->address_state)),
|
||||
JSON_BUILD_PAIR_ENUM("IPv4AddressState", link_address_state_to_string(link->ipv4_address_state)),
|
||||
JSON_BUILD_PAIR_ENUM("IPv6AddressState", link_address_state_to_string(link->ipv6_address_state)),
|
||||
JSON_BUILD_PAIR_ENUM("OnlineState", link_online_state_to_string(link->online_state)));
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "hostname-util.h"
|
||||
#include "json-util.h"
|
||||
#include "log.h"
|
||||
#include "random-util.h"
|
||||
#include "resolved-dns-browse-services.h"
|
||||
@@ -1814,7 +1815,7 @@ int dns_scope_to_json(DnsScope *scope, bool with_cache, sd_json_variant **ret) {
|
||||
|
||||
return sd_json_buildo(
|
||||
ret,
|
||||
SD_JSON_BUILD_PAIR_STRING("protocol", dns_protocol_to_string(scope->protocol)),
|
||||
JSON_BUILD_PAIR_ENUM("protocol", dns_protocol_to_string(scope->protocol)),
|
||||
SD_JSON_BUILD_PAIR_CONDITION(scope->family != AF_UNSPEC, "family", SD_JSON_BUILD_INTEGER(scope->family)),
|
||||
SD_JSON_BUILD_PAIR_CONDITION(!!scope->link, "ifindex", SD_JSON_BUILD_INTEGER(dns_scope_ifindex(scope))),
|
||||
SD_JSON_BUILD_PAIR_CONDITION(!!scope->link, "ifname", SD_JSON_BUILD_STRING(dns_scope_ifname(scope))),
|
||||
|
||||
@@ -2156,9 +2156,9 @@ static int dns_configuration_json_append(
|
||||
JSON_BUILD_PAIR_CONDITION_BOOLEAN(dnssec_mode >= 0, "dnssecSupported", dnssec_supported),
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY("dnssec", dnssec_mode_to_string(dnssec_mode)),
|
||||
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_STRING_NON_EMPTY_UNDERSCORIFY("llmnr", resolve_support_to_string(llmnr_support)),
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY_UNDERSCORIFY("mDNS", resolve_support_to_string(mdns_support)),
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY_UNDERSCORIFY("resolvConfMode", resolv_conf_mode_to_string(resolv_conf_mode)),
|
||||
JSON_BUILD_PAIR_VARIANT_NON_NULL("scopes", scopes_json));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user