[Bug 213207] ath: Unable to set device MAC in FreeBSD 11

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Oct 12 20:32:17 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213207

Adrian Chadd <adrian at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adrian at freebsd.org

--- Comment #11 from Adrian Chadd <adrian at freebsd.org> ---
So, the challenge is thus.

The device has a MAC address. There's a BSSID and a macaddress field. then,
when creating say, cloned AP vaps, the isn't a list of MACs that the NIC has -
the reason they're typically only a small difference is there's a BSSID /mask/
field for matching against. look at if_ath.c:assign_address() - and that only
happens for hostap and mbss modes.

Now, before glebius removed the device entries from ifconfig, changing the
parent device MAC would change what's effectively now ic->ic_macaddr.  When you
create a new VAP, it clones ic->ic_macaddr unless you provide
IEEE80211_CLONE_MACADDR as an argument and a separate MAC address. In that
instance, the VAP is created with a completely different MAC address. Now that
there's no parent ifnet, there's no easy (ie, same for all devices) way of
modifying ic_macaddr and having that programmed into the hardware for
subsequent device updates.

So here's what's going on:

* the device will read its MAC from EEPROM, etc, and feed it into ic_macaddr
* when creating VAPs, net80211 will use ic_macaddr unless given
IEEE80211_CLONE_MACADDR as an argument - at which point it'll use a completely
separate MAC address for that argument.
* trouble is, that won't really help with STA mode (at least on ath(4)) as
there is only one MAC address, and that is what's prgorammed in via
ath_hal_setmac()
* when cloning AP VAPs, if_ath.c:assign_address() will update the chipset BSSID
mask, so multiple sequential MACs are accepted as "local"
* .. but that doesn't do anything useful for STA mode, so setting the VAP MAC
address to anything that isn't ic_macaddr won't affect anything useful.

Ok, so what we really need is:

* fix up the hint.ath.X.macaddr thing to work right if it doesn't
* figure out a generic way to fetch a wifi device mac address, now that
'ifconfig' can't do it;
* figure out a generic way to re-program the device MAC address when the first
VAP is created if it has changed, so the first VAP creation can be given an
ethernet address and it will actually program the device; or
* .. document one way (eg andriy's way, where setting the wlanaddr on the first
VAP will program the NIC MAC, and any subsequent creations can only vary
depending upon what the hardware will provide) - and then audit /all/ drivers
to make sure that method works.

I think andriy's way is fine, and we just need to document it in the
manpage/docbook and then audit every wifi driver. But I'd still like some
generic way to fetch ic_macaddr from a device - eg by sysctl, or if we can do
it via an existing device ioctl, that.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-wireless mailing list