From 6839aa567ca023cda5fe80179938b3ef6f8df3f5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 12 Dec 2018 20:40:12 +0100 Subject: hostnamed: filter out all-zero and all-0xFF DMI ProductUUIDs These UUIDs are considered as wildcard value for "unset" UUIDs typically, and this even makes sense. Let's suppress them hence. --- src/hostname/hostnamed.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/hostname') diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index c1f9e27523..e778132506 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -113,8 +113,12 @@ static int context_read_data(Context *c) { r = id128_read("/sys/class/dmi/id/product_uuid", ID128_UUID, &c->uuid); if (r < 0) - log_info_errno(r, "Failed to read product UUID, ignoring: %m"); - c->has_uuid = (r >= 0); + log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r, + "Failed to read product UUID, ignoring: %m"); + else if (sd_id128_is_null(c->uuid) || sd_id128_is_allf(c->uuid)) + log_debug("DMI product UUID " SD_ID128_FORMAT_STR " is all 0x00 or all 0xFF, ignoring.", SD_ID128_FORMAT_VAL(c->uuid)); + else + c->has_uuid = true; return 0; } -- cgit v1.2.1