Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2007 21:01:55 +1200
From:      Andrew Thompson <thompsa@freebsd.org>
To:        "Ralf S. Engelschall" <rse@FreeBSD.org>
Cc:        freebsd-rc@freebsd.org
Subject:   Re: cvs commit: src/etc/rc.d hostid
Message-ID:  <20070521090155.GA1063@heff.fud.org.nz>
In-Reply-To: <200704110005.l3B05QcV079261@repoman.freebsd.org>
References:  <200704110005.l3B05QcV079261@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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}"
 		;;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070521090155.GA1063>