networkd: gnerate proper underscored enums in varlink interface

AFAICS none of the states actually user dashes/underscores, but let's
prepare for the future and be fully correct here.
This commit is contained in:
Lennart Poettering
2026-04-20 09:36:09 +02:00
parent f5575d9eb5
commit 40ab0df557
+4 -4
View File
@@ -54,11 +54,11 @@ static int vl_method_get_states(sd_varlink *link, sd_json_variant *parameters, s
return sd_varlink_replybo(
link,
SD_JSON_BUILD_PAIR_STRING("AddressState", link_address_state_to_string(m->address_state)),
SD_JSON_BUILD_PAIR_STRING("IPv4AddressState", link_address_state_to_string(m->ipv4_address_state)),
SD_JSON_BUILD_PAIR_STRING("IPv6AddressState", link_address_state_to_string(m->ipv6_address_state)),
JSON_BUILD_PAIR_ENUM("AddressState", link_address_state_to_string(m->address_state)),
JSON_BUILD_PAIR_ENUM("IPv4AddressState", link_address_state_to_string(m->ipv4_address_state)),
JSON_BUILD_PAIR_ENUM("IPv6AddressState", link_address_state_to_string(m->ipv6_address_state)),
SD_JSON_BUILD_PAIR_STRING("CarrierState", link_carrier_state_to_string(m->carrier_state)),
SD_JSON_BUILD_PAIR_CONDITION(m->online_state >= 0, "OnlineState", SD_JSON_BUILD_STRING(link_online_state_to_string(m->online_state))),
SD_JSON_BUILD_PAIR_CONDITION(m->online_state >= 0, "OnlineState", JSON_BUILD_STRING_UNDERSCORIFY(link_online_state_to_string(m->online_state))),
SD_JSON_BUILD_PAIR_STRING("OperationalState", link_operstate_to_string(m->operational_state)));
}