Common storage of original MAC address

Pokala, Ravi rpokala at panasas.com
Tue Aug 19 05:19:13 UTC 2014


-----Original Message-----
From: Ryan Stone <rysto32 at gmail.com>
Date: Monday, August 18, 2014 at 11:14 AM
To: Ravi Pokala <rpokala at panasas.com>
Cc: Brooks Davis <brooks at freebsd.org>, "freebsd-hackers at freebsd.org"
<freebsd-hackers at freebsd.org>
Subject: Re: Common storage of original MAC address

>On Mon, Aug 18, 2014 at 11:59 AM, Pokala, Ravi <rpokala at panasas.com>
>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



More information about the freebsd-hackers mailing list