From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 18 19:15:00 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 777C73FE for ; Mon, 18 Aug 2014 19:15:00 +0000 (UTC) Received: from mx1.scaleengine.net (beauharnois2.bhs1.scaleengine.net [142.4.218.15]) by mx1.freebsd.org (Postfix) with ESMTP id 377E93A99 for ; Mon, 18 Aug 2014 19:14:59 +0000 (UTC) Received: from [192.168.1.2] (senat1-01.HML3.ScaleEngine.net [209.51.186.5]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id A4C1539FA1 for ; Mon, 18 Aug 2014 19:14:52 +0000 (UTC) Message-ID: <53F250BA.9010008@freebsd.org> Date: Mon, 18 Aug 2014 15:15:06 -0400 From: Allan Jude User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: Re: Common storage of original MAC address References: <20140818081223.GA6099@spindle.one-eyed-alien.net> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WF2ebs9G0fDNBqqKgR5eXaR6HfKTOQIAM" 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: Mon, 18 Aug 2014 19:15:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WF2ebs9G0fDNBqqKgR5eXaR6HfKTOQIAM Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2014-08-18 14:14, Ryan Stone wrote: > On Mon, Aug 18, 2014 at 11:59 AM, Pokala, Ravi wr= ote: >=20 >> Thanks you Brooks. >> >> I'm not very familiar w/ the network stack, so I could use a little mo= re >> guidance. The naive part of me says to just add >> >> char orig_mac_addr[18]; >> >> to arpcom, and do something like >> >> snprintf(IFP2AC(ifp)->orig_mac_addr, >> sizeof(IFP2AC(ifp)->orig_mac_addr), "%6D", lla, ":"); >> >> to populate it in ether_ifattach(). >> >> The slightly more knowledgeable part of me is aware that there are thi= ngs >> other than ethernet out there, we might want to save the original addr= ess >> for those too at some point, and so a perfectly-sized char-array might= not >> be the right thing here. >> >> With regards to using "dev.." - that's actually what we'= ve >> been doing: >> >> SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev), >> SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, >> "orig_mac_addr", CTLFLAG_RD, sc->orig_mac_addr, 0, >> "Original MAC address"); >> >> >> The wrinkle is that we need the device_t to put stuff under the "dev" >> portion of the sysctl namespace, and we don't pass that into >> ether_ifattach() (nor should we). So, we'd have to do that in every NI= C >> driver, which gets us back to having to modify the world. >> >> Thoughts? >> >> Thanks again, >> >> Ravi >=20 > Personally I think that it would be better to save it in binary format > and convert it to a string as needed. 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. >=20 +1 for restoring the MAC after removing a device from a lagg(4) or bridge= (4) --=20 Allan Jude --WF2ebs9G0fDNBqqKgR5eXaR6HfKTOQIAM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJT8lDAAAoJEJrBFpNRJZKfss4P/2c+z+VQbOSGCv5vTnbJ+MvM ScJBYFnE9JbeGHnt9zRwOAVrKc4LEltxLlfPXf7nYpCDT1VY3C3cURgxqPmGHFWX UH7qnTkdRF97NfXItfCiXOL+OvSDnm/xHEfuD1XlZQXkQ3WIKNwpmrtsIeZq64nu b4WWlYXNu4Zf5ZSbXRw2Nrjk5VnScodzp8XZrHrbrEOQp3jOh2Q2PWM5OWkUC3r4 WWT5nqVIF14y8TdqqxOquaGg2dW19Sz4BAZuYIcAX0iEhttvy/W2lOxJJ0Q6xp1P RdxwRFpAIoGMB8ZUABPCTSdPQa+EHpI+rxFYdTe0LUCDgRhWSnYFShAuMa+8Rhl9 4+XA1AKNVMEfxDP2AufEWMG/cPCHOGd3KV76wCq72dyB8UGv6HWj9MVX5JyuqXRb Z3NcmaY714/cUjtth+LDVfDmeUGtWhKUX2JBC+xLCFXTZbA9cBHTdCh+9VXK0R3Q 5d8n7nuU5S3J9m7oDWgfJXGWNozAWkkQvcP9wtrRJsPPak3Y4a13vsBvyhUUtzLu p0A0DqqMdVelWtl3D6f/3LGo6UCAtqYFZ6z2fGZfIrVi8IQ38EX/kN90b2BCsH4P QGkjha31jS6vFh2UH/ofgScl1skRorDdkzoSl0efx/YkIIsIBOGStYMqkcqV+POc tNOdUrH9etP3x8G6ZEaH =liAp -----END PGP SIGNATURE----- --WF2ebs9G0fDNBqqKgR5eXaR6HfKTOQIAM--