Unique machine identifier for nfsv4 client

Gordon Tetlow gordon at tetlows.org
Mon Mar 30 08:47:29 PDT 2009


On Mon, Mar 30, 2009 at 8:09 AM, Rick Macklem <rmacklem at 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


More information about the freebsd-arch mailing list