diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-12-12 20:40:12 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-12-15 12:06:44 +0100 |
commit | 6839aa567ca023cda5fe80179938b3ef6f8df3f5 (patch) | |
tree | b41f57f7f3af93c3e8c58793707fadb8527c0cbe /src/hostname | |
parent | 670814387ba8973245c08123e7240669f51a55a8 (diff) | |
download | systemd-6839aa567ca023cda5fe80179938b3ef6f8df3f5.tar.gz |
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.
Diffstat (limited to 'src/hostname')
-rw-r--r-- | src/hostname/hostnamed.c | 8 |
1 files changed, 6 insertions, 2 deletions
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; } |