mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
networkd: fia xRequiredOperationalStateForOnline serializtion
In integration tests (for example TEST-85-NETWORK-NetworkctlTests) LINK_OPERSTATE_RANGE_INVALID and required_for_online == -1 are serialized as ``` "RequiredForOnline": "true", "RequiredOperationalStateForOnline": [null, null] ``` Such link should be reported as required_for_online=False and not serialize nulls.
This commit is contained in:
committed by
Yu Watanabe
parent
9893859beb
commit
59d946ee6b
@@ -444,14 +444,15 @@ static int network_append_json(Network *network, sd_json_variant **v) {
|
||||
v,
|
||||
SD_JSON_BUILD_PAIR_STRING("NetworkFile", network->filename),
|
||||
SD_JSON_BUILD_PAIR_STRV("NetworkFileDropins", network->dropins),
|
||||
SD_JSON_BUILD_PAIR_BOOLEAN("RequiredForOnline", network->required_for_online),
|
||||
SD_JSON_BUILD_PAIR("RequiredOperationalStateForOnline",
|
||||
SD_JSON_BUILD_ARRAY(SD_JSON_BUILD_STRING(link_operstate_to_string(network->required_operstate_for_online.min)),
|
||||
SD_JSON_BUILD_STRING(link_operstate_to_string(network->required_operstate_for_online.max)))),
|
||||
SD_JSON_BUILD_PAIR_STRING("RequiredFamilyForOnline",
|
||||
link_required_address_family_to_string(network->required_family_for_online)),
|
||||
SD_JSON_BUILD_PAIR_STRING("ActivationPolicy",
|
||||
activation_policy_to_string(network->activation_policy)));
|
||||
SD_JSON_BUILD_PAIR_BOOLEAN("RequiredForOnline", network->required_for_online > 0),
|
||||
SD_JSON_BUILD_PAIR_CONDITION(
|
||||
operational_state_range_is_valid(&network->required_operstate_for_online),
|
||||
"RequiredOperationalStateForOnline",
|
||||
SD_JSON_BUILD_ARRAY(
|
||||
SD_JSON_BUILD_STRING(link_operstate_to_string(network->required_operstate_for_online.min)),
|
||||
SD_JSON_BUILD_STRING(link_operstate_to_string(network->required_operstate_for_online.max)))),
|
||||
SD_JSON_BUILD_PAIR_STRING("RequiredFamilyForOnline", link_required_address_family_to_string(network->required_family_for_online)),
|
||||
SD_JSON_BUILD_PAIR_STRING("ActivationPolicy", activation_policy_to_string(network->activation_policy)));
|
||||
}
|
||||
|
||||
static int netdev_append_json(NetDev *netdev, sd_json_variant **v) {
|
||||
|
||||
Reference in New Issue
Block a user