From: Lennart Poettering Date: Wed, 12 Dec 2018 19:40:12 +0000 (+0100) Subject: hostnamed: filter out all-zero and all-0xFF DMI ProductUUIDs X-Git-Tag: v240~54^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11137%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index c1f9e27523f..e7781325067 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; }