From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 19 05:19:13 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 4D76F39C; Tue, 19 Aug 2014 05:19:13 +0000 (UTC) Received: from natasha.panasas.com (natasha.panasas.com [209.166.131.148]) by mx1.freebsd.org (Postfix) with ESMTP id 0AA483F64; Tue, 19 Aug 2014 05:19:12 +0000 (UTC) Received: from seabiscuit.panasas.com (seabiscuit.panasas.com [172.17.132.204]) by natasha.panasas.com (8.13.1/8.13.1) with ESMTP id s7J5J4YM014661; Tue, 19 Aug 2014 01:19:04 -0400 Received: from SEABISCUIT.int.panasas.com ([172.17.132.204]) by seabiscuit ([172.17.132.204]) with mapi id 14.03.0181.006; Mon, 18 Aug 2014 22:19:03 -0700 From: "Pokala, Ravi" To: Ryan Stone Subject: Re: Common storage of original MAC address Thread-Topic: Common storage of original MAC address Thread-Index: AQHPunNYUBEgYXTq+ky03AEN5pUz3ZvWeLmAgAANIwCAAJs5AIAARC4A Date: Tue, 19 Aug 2014 05:19:02 +0000 Message-ID: References: <20140818081223.GA6099@spindle.one-eyed-alien.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.3.140616 x-originating-ip: [172.17.28.63] Content-Type: text/plain; charset="us-ascii" Content-ID: <198BD3F5B0958446932BD7D2913C3BD2@panasas.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "freebsd-hackers@freebsd.org" , Brooks Davis 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: Tue, 19 Aug 2014 05:19:13 -0000 -----Original Message----- From: Ryan Stone Date: Monday, August 18, 2014 at 11:14 AM To: Ravi Pokala Cc: Brooks Davis , "freebsd-hackers@freebsd.org" Subject: Re: Common storage of original MAC address >On Mon, Aug 18, 2014 at 11:59 AM, Pokala, Ravi >wrote: > >>... > >Personally I think that it would be better to save it in binary format >and convert it to a string as needed. I'm fine with that too; the reason I suggested a string is because that's what's already getting passed to ether_ifattach(). I suppose it's easy enough to run the string through ether_aton() to get the binary version. But again, not everything is Ethernet, so we might need to have different binary representations; if we're doing that, we might as well just use the string version, and let the caller decide how to parse the string. (I'm specifically thinking about IP-over-Infiniband - while I'm sure IB cards must have some type of hardware address, it's probably not the same format as an Ethernet MAC address.) >It would be useful to have the MAC address saved aside somewhere so that >a "Restore MAC to HW default" ioctl could be implemented; this would be >useful in the if_lagg driver to restore the MAC on a port after it has >been removed from a lagg. Or how about an ioctl to get the original MAC (rather than a sysctl). Then the "restore to default" code would be a two-step process - get the original MAC with the new ioctl (say "SIOCGHWLLADDR" for "Get Hardware LLADDR"?), and then set the working MAC to that value w/ the existing ioctl (SIOCSIFLLADDR). I actually like this idea more than the sysctl, because it could be done in one place (probably in net/if.c, next to if_setlladdr() (which is what implements the guts of SIOCSIFLLADDR)). Does that sound like a plan? Thanks, Ravi