From 77986df63c5221644d35f078eae8ed29f0ffd156 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 8 Jan 2024 16:45:07 +0100 Subject: [PATCH] hostnamed: always include VSockCID property in describe JSON that way clients can distinguish whether there is no cid or whether hostnamed doesn't support it nicely, by just looking if the prop exists (but is null) or not. This is similar how we already handle all other props in the JSON record. --- src/hostname/hostnamed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index f24c126d5d6..f01d771f9bc 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -1444,7 +1444,8 @@ static int build_describe_response(Context *c, bool privileged, JsonVariant **re JSON_BUILD_PAIR_ID128("BootID", boot_id), JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_ID128(product_uuid)), JSON_BUILD_PAIR_CONDITION(sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_NULL), - JSON_BUILD_PAIR_CONDITION(local_cid != VMADDR_CID_ANY, "VSockCID", JSON_BUILD_UNSIGNED(local_cid)))); + JSON_BUILD_PAIR_CONDITION(local_cid != VMADDR_CID_ANY, "VSockCID", JSON_BUILD_UNSIGNED(local_cid)), + JSON_BUILD_PAIR_CONDITION(local_cid == VMADDR_CID_ANY, "VSockCID", JSON_BUILD_NULL))); if (r < 0) return log_error_errno(r, "Failed to build JSON data: %m"); -- 2.47.3