Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Aug 2014 15:15:06 -0400
From:      Allan Jude <allanjude@freebsd.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Common storage of original MAC address
Message-ID:  <53F250BA.9010008@freebsd.org>
In-Reply-To: <CAFMmRNwDrEY-Z5VP%2B_03-ZGf_6Ye89jCKO-HpfqYAoZjATFAdQ@mail.gmail.com>
References:  <D0168955.11C3AD%rpokala@panasas.com> <20140818081223.GA6099@spindle.one-eyed-alien.net> <D0175C55.11C472%rpokala@panasas.com> <CAFMmRNwDrEY-Z5VP%2B_03-ZGf_6Ye89jCKO-HpfqYAoZjATFAdQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <rpokala@panasas.com> 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.<driver>.<unit>" - 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53F250BA.9010008>