Repository navigation
Read NetBSD system, firmware and baseboard values from machdep.dmi - #3816
Conversation
NetBSD shared BsdComputerSystem with OpenBSD, which reads OpenBSD's hw.vendor, hw.product, hw.version, hw.serialno and hw.uuid sysctls. NetBSD has none of them, so every ComputerSystem and Baseboard value was unknown, and the firmware parser looked for OpenBSD's bios0 dmesg lines, which NetBSD does not print. With the model unknown, virtual machines were identified from the network card's MAC address prefix instead. The base's four hw.* lookups are now protected methods. NetBSD overrides them to read one `sysctl machdep.dmi` listing, and builds the baseboard from the board-* values, falling back to the system values where the firmware has no baseboard table, as FreeBSD does. NetBsdFirmware reads bios-vendor, bios-version and bios-date, the last converted from the kernel's YYYYMMDD by a new ParseUtil.parseYyyyMmDdToIso. The serial numbers and UUID are CTLFLAG_PRIVATE in the kernel, so they are reported only to root. Verified on a NetBSD 10.1 aarch64 KVM guest (JNA with and without the native library, and FFM) and on the x86 NetBSD CI VM, as root and as an unprivileged user.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3816 +/- ##
============================================
+ Coverage 80.85% 80.87% +0.01%
Complexity 648 648
============================================
Files 725 725
Lines 26020 26044 +24
Branches 4419 4422 +3
============================================
+ Hits 21038 21062 +24
- Misses 2764 2767 +3
+ Partials 2218 2215 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
NetBSD shares
BsdComputerSystemwith OpenBSD, and that class reads OpenBSD'shw.vendor,hw.product,hw.version,hw.serialnoandhw.uuidsysctls. NetBSD has none of them, so everyComputerSystemandBaseboardvalue wasunknown.Firmwarewas unknown too: it parsed OpenBSD'sbios0:dmesg lines, which NetBSD does not print. With the model unknown,VirtualizationDetectorfell back to the network card's MAC address prefix. That is how a QEMU/KVM guest on cfarm428 was reported as Microsoft Hyper-V.NetBSD publishes the SMBIOS strings under
machdep.dmi(sys/dev/smbios_platform.c).Changes
BsdComputerSystem's fourhw.*lookups are now protected methods. OpenBSD's behaviour is unchanged, and NetBSD stays on the shared base, whichBsdComputerSystemTestrequires.NetBsdComputerSystemoverrides those lookups and reads a singlesysctl machdep.dmilisting. The baseboard uses theboard-*values and falls back to the system values when the firmware has no baseboard table, as FreeBSD does.NetBsdFirmwarereadsbios-vendor,bios-versionandbios-date. The date is converted from the kernel'sYYYYMMDDby a newParseUtil.parseYyyyMmDdToIso.system-serial,system-uuid,board-serialandchassis-serialCTLFLAG_PRIVATE, so those values are reported only to root.Testing
QEMU,KVM Virtual Machine.QEMU, where it was Microsoft Hyper-V before.QEMU,Standard PC (i440FX + PIIX, 1996).SeaBIOS1.17.0-debian-1.17.0-1ubuntu1, release date2014-04-01.QEMU.unknown, matchingsysctlitself.machdep.dmiparsing and the date conversion. The full gate passes, including-Perror-prone.board-*path is covered only by the fixture test.Summary by CodeRabbit
YYYY-MM-DD; unavailable dates remain empty.