]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hostnamed: filter out all-zero and all-0xFF DMI ProductUUIDs 11137/head
authorLennart Poettering <lennart@poettering.net>
Wed, 12 Dec 2018 19:40:12 +0000 (20:40 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 15 Dec 2018 11:06:44 +0000 (12:06 +0100)
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

index c1f9e27523fa2c2e963a2218b4f278a66856a8c7..e778132506712dd56ebee37e090b3438b32873c7 100644 (file)
@@ -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;
 }