Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Aug 2014 15:59:26 +0000
From:      "Pokala, Ravi" <rpokala@panasas.com>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Common storage of original MAC address
Message-ID:  <D0175C55.11C472%rpokala@panasas.com>
In-Reply-To: <20140818081223.GA6099@spindle.one-eyed-alien.net>
References:  <D0168955.11C3AD%rpokala@panasas.com> <20140818081223.GA6099@spindle.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help
-----Original Message-----
From: Brooks Davis <brooks@freebsd.org>
Date: Monday, August 18, 2014 at 1:12 AM
To: Ravi Pokala <rpokala@panasas.com>
Cc: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject: Re: Common storage of original MAC address

>On Sun, Aug 17, 2014 at 11:31:19PM +0000, Pokala, Ravi wrote:
>>...
>>=20
>> 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.<driver>.<unit> sysctl namespace.
>
>-- Brooks

Thanks you Brooks.

I'm not very familiar w/ the network stack, so I could use a little more
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 things
other than ethernet out there, we might want to save the original address
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 NIC
driver, which gets us back to having to modify the world.

Thoughts?

Thanks again,

Ravi




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D0175C55.11C472%rpokala>