diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2020-04-16 00:54:06 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2020-04-16 00:54:06 +0000 |
commit | c318828929be47414e3ca5f53bfc42a0b99454c4 (patch) | |
tree | 098e210802a7af2e0258529e4cd6262eeef3ae40 /stand/defaults | |
parent | ab23c2784b1a73eb6fa39699013f9867bc333d76 (diff) | |
download | src-c318828929be47414e3ca5f53bfc42a0b99454c4.tar.gz src-c318828929be47414e3ca5f53bfc42a0b99454c4.zip |
Preload hostuuid for early-boot use
prison0's hostuuid will get set by the hostid rc script, either after
generating it and saving it to /etc/hostid or by simply reading /etc/hostid.
Some things (e.g. arbitrary MAC address generation) may use the hostuuid as
a factor in early boot, so providing a way to read /etc/hostid (if it's
available) and using it before userland starts up is desirable. The code is
written such that the preload doesn't *have* to be /etc/hostid, thus not
assuming that there will be newline at the end of the buffer or even the
exact shape of the newline. White trailing whitespace/non-printables
trimmed, the result will be validated as a valid uuid before it's used for
early boot purposes.
The preload can be turned off with hostuuid_load="NO" in /boot/loader.conf,
just as other preloads; it's worth noting that this is a 37-byte file, the
overhead is believed to be generally minimal.
It doesn't seem necessary at this time to be concerned with kern.hostid.
One does wonder if we should consider validating hostuuids coming in
via jail_set(2); some bits seem to care about uuid form and we bother
validating format of smbios-provided uuid and in-fact whatever uuid comes
from /etc/hostid.
Reviewed by: karels, delphij, jamie
MFC after: 1 week (don't preload by default, probably)
Differential Revision: https://reviews.freebsd.org/D24288
Notes
Notes:
svn path=/head/; revision=359999
Diffstat (limited to 'stand/defaults')
-rw-r--r-- | stand/defaults/loader.conf | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf index 4cc5a79e7e84..4f84281e9d2e 100644 --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -33,6 +33,11 @@ bitmap_type="splash_image_data" # and place it on the module_path screensave_load="NO" # Set to YES to load a screensaver module screensave_name="green_saver" # Set to the name of the screensaver module +### Early hostid configuration ############################ +hostuuid_load="YES" +hostuuid_name="/etc/hostid" +hostuuid_type="hostuuid" + ### Random number generator configuration ################## # See rc.conf(5). The entropy_boot_file config variable must agree with the # settings below. |