Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Mar 2009 08:25:47 -0700
From:      Gordon Tetlow <gordon@tetlows.org>
To:        Rick Macklem <rmacklem@uoguelph.ca>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Unique machine identifier for nfsv4 client
Message-ID:  <4e571dd70903300825q63b4344bhdee6ba7c54c2deab@mail.gmail.com>
In-Reply-To: <Pine.GSO.4.63.0903301057020.13442@muncher.cs.uoguelph.ca>
References:  <Pine.GSO.4.63.0903301057020.13442@muncher.cs.uoguelph.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 30, 2009 at 8:09 AM, Rick Macklem <rmacklem@uoguelph.ca> wrote:

> An nfsv4 client needs a unique identifier that is persistent across
> reboots. My code currently uses the MAC address of the first net
> interface that it can find that has an Ethernet style MAC.
>
> There are two problems with this:
> 1 - If it can't find a net interface with a MAC, it falls back on a
>    randomly generated identifier, which changes when it is rebooted.
> 2 - The code that finds the MAC breaks layering (ie knows stuff about
>    the network code like struct ifnet) and only builds if
>    "options VIMAGE_GLOBALS" is set.
>
> Can anyone suggest a better way to do this?
>
> If not, would it be reasonable to put a function in sys/net that returns
> a MAC address if it can find one? (At least this gets around the
> "options VIMAGE_GLOBALS" issue.)
>

There is a uuid that is generated at first boot and persistent. Check
/etc/rc.d/hostid. It sets kern.hostuuid and kern.hostid.

Gordon



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