cvs commit: src/etc/rc.d hostid

Andrew Thompson thompsa at freebsd.org
Mon May 21 09:15:03 UTC 2007


On Wed, Apr 11, 2007 at 12:05:26AM +0000, Pawel Jakub Dawidek wrote:
> pjd         2007-04-11 00:05:26 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     etc/rc.d             hostid 
>   Log:
>   If available, take UUID from smbios.system.uuid, if not fall back to
>   software-generated UUID. Store the result in /etc/hostid and use it in
>   the future. Perform simple UUID format check, as there is a lot of
>   hardware with broken UUIDs. The check should be improved to also eliminate
>   fake UUIDs like 00000000-0000-0000-0000-000000000000.
>   

Here is a simple patch to check for all zeros


Index: hostid
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/hostid,v
retrieving revision 1.3
diff -u -p -r1.3 hostid
--- hostid	21 May 2007 08:22:43 -0000	1.3
+++ hostid	21 May 2007 08:56:56 -0000
@@ -59,7 +59,11 @@ hostid_hardware()
 	uuid=`kenv smbios.system.uuid 2>/dev/null | tr '[:upper:]' '[:lower:]'`
 	x="[0-9a-f]"
 	y=$x$x$x$x
+	z="0000"
 	case "${uuid}" in
+	$z$z-$z-$z-$z-$z$z$z)
+		# the bios returned all zeros
+		;;
 	$y$y-$y-$y-$y-$y$y$y)
 		echo "${uuid}"
 		;;


More information about the freebsd-rc mailing list