From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 20 16:00:46 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE787789; Wed, 20 Aug 2014 16:00:46 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A63C93084; Wed, 20 Aug 2014 16:00:46 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8951AB9D0; Wed, 20 Aug 2014 12:00:45 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Subject: Re: Common storage of original MAC address Date: Wed, 20 Aug 2014 11:41:47 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <20140818081223.GA6099@spindle.one-eyed-alien.net> In-Reply-To: <20140818081223.GA6099@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201408201141.47933.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Aug 2014 12:00:45 -0400 (EDT) Cc: Brooks Davis , "Pokala, Ravi" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 16:00:46 -0000 On Monday, August 18, 2014 4:12:23 am Brooks Davis wrote: > On Sun, Aug 17, 2014 at 11:31:19PM +0000, Pokala, Ravi wrote: > > Hi folks, > > > > At attach-time, the NIC drivers call ether_ifattach(), which stores the > > MAC address in the sockaddr_dl. If the MAC is subsequently changed (like > > by adding the interface to a lagg), if_setlladdr() changes the value in > > the sockaddr_dl. At least, that's the way I'm reading things - is that > > correct? > > > > If so, then we do not keep a copy of the original MAC address. For a > > couple of reasons (diagnostics, asset tracking and reporting), it would be > > very nice if the original MAC were kept somewhere, even after the working > > MAC was changed by if_setlladdr(). > > > > Up till now, Panasas has been saving the original MAC in the softc of > > specific network drivers that we use, and making it accessible via a > > sysctl. That's something we have to do on a per-driver basis, and > > something we have to keep track of on our own. We'd like to put that > > information in a structure all the NIC drivers already use, and get that > > code upstream. Storing it would require a simple change to > > ether_ifattach() to stash it in the new location in addition to in the > > sockaddr_dl, and adding some standard way (a new ioctl or sysctl?) to > > access it. Notably, it would not require changing all the individual > > drivers. > > > > Are there any objections to this idea? Any suggestions as to where we > > might stash the original MAC? > > I think I'd store the original address in struct arpcom at attach time > and publish it in the dev.. sysctl namespace. ifnets and device_t's aren't necessarily 1:1 (some multiport NIC drivers might only create a device_t for the adapter). -- John Baldwin