From owner-freebsd-arch@FreeBSD.ORG Mon Mar 30 15:47:28 2009 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA2751065723 for ; Mon, 30 Mar 2009 15:47:28 +0000 (UTC) (envelope-from gordon.tetlow@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.180]) by mx1.freebsd.org (Postfix) with ESMTP id 7A2278FC12 for ; Mon, 30 Mar 2009 15:47:28 +0000 (UTC) (envelope-from gordon.tetlow@gmail.com) Received: by wa-out-1112.google.com with SMTP id m38so1477614waf.27 for ; Mon, 30 Mar 2009 08:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=CylDnbh4jQz/6szKAMqFKwwwS//FoVJz6GK3vCGZA+4=; b=l2Wzd2u6yPIjYejvxlmUPfjANDKD4aeIJXuYXEx9XBG/Y1VHXR0HIMZWtuHNuvvhzM aR93pv+oZGUOBYKkcsnehOXOkZ0LMLonux7inrsG8CZWXgaFuYghMwgkJG8YIoVUTBb/ uVkLL+PwB8j9chJqNQR3XyF51x6KaJWLqVIIg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=Pum84+9UMs5nZ8Ptb1Zc+fmGoPVC7kFy3KNW5z1H2x3Obc/4gkV38XJjXqzDCjSxiG itWjQn0JDtqGOp8zDsZylIh/Q7ATHE/ZYgt3TYhmFE5r/nIxooHtpGGqkWP/wjjiG91M cWOlZd7N+/dt49S9Pwr+MXdqHjtoAKbX+Hbsw= MIME-Version: 1.0 Sender: gordon.tetlow@gmail.com Received: by 10.114.149.8 with SMTP id w8mr3671205wad.39.1238426747215; Mon, 30 Mar 2009 08:25:47 -0700 (PDT) In-Reply-To: References: Date: Mon, 30 Mar 2009 08:25:47 -0700 X-Google-Sender-Auth: e5940ced94e78407 Message-ID: <4e571dd70903300825q63b4344bhdee6ba7c54c2deab@mail.gmail.com> From: Gordon Tetlow To: Rick Macklem Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-arch@freebsd.org Subject: Re: Unique machine identifier for nfsv4 client X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2009 15:47:29 -0000 On Mon, Mar 30, 2009 at 8:09 AM, Rick Macklem 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