From: Lennart Poettering Date: Mon, 8 Jan 2024 15:45:07 +0000 (+0100) Subject: hostnamed: always include VSockCID property in describe JSON X-Git-Tag: v256-rc1~1226^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77986df63c5221644d35f078eae8ed29f0ffd156;p=thirdparty%2Fsystemd.git 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. --- 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");