This set enables userspace to change the devices MAC address via RTNL
or CMD_CONNECT/CMD_AUTHENTICATE without bringing the device down then
back up. This has several benefits:
- Simplifies user space logic. No longer requires tracking multiple
RTNL/netlink message transactions (down, change mac, up, connect).
- Drastically speeds up connection times when changing MAC on a
per-connect basis.
- Eliminates potential race conditions in userspace. At any time
during the down/change/up sequence the device could be hot
unplugged or something could go wrong in the kernel leaving
userspace in an unknown state.
A new extended feature was added,
NL80211_EXT_FEATURE_LIVE_ADDRESS_CHANGE which is set if the device
supports this feature. This feature is enabled by default for mac80211
based drivers.
A new NL80211 attribute was added, NL80211_ATTR_MAC_TO_CHANGE. This
attribute can be used with CMD_CONNECT/CMD_AUTHENTICATE to change the
MAC address automatically without having to go through RTNL.
I have taken some timings for all 3 ways of changing the MAC. Powered
change via RTNL, non powered via RTNL, and changing through
CMD_CONNECT. All times were taken in microseconds and tested on an
Intel 7260 PCI wireless adapter:
Powered via RTNL:
Average: 294508.9
Min: 284523
Max: 300345
==================================
Non-Powered via RTNL:
Average: 14824.7
Min: 11037
Max: 17812
Speedup from powered change: 19.87x (average)
==================================
via CMD_CONNECT:
Average: 11848.7
Min: 9748
Max: 17152
Speedup from powered change: 24.86x (average)
==================================
The speed increases between powered and non-powered are quite
impressive. Besides the obvious speedup, the amount of code requred
for userspace to take advantage of this feature is extremely small
(via CMD_CONNECT, essentially a feature check and an extra attribute).
In addition, the changes/complexity to the kernel is minimal.
James Prestwood (4):
nl80211: Add LIVE_ADDR_CHANGE feature
{nl|cfg}80211: Support mac change as part of SME Connect
mac80211: Support LIVE_ADDRESS_CHANGE feature
{nl,cfg}nl80211: Support mac change for mlme_authenticate
include/net/cfg80211.h | 1 +
include/uapi/linux/nl80211.h | 10 +++++++
net/mac80211/iface.c | 51 ++++++++++++++++++++++++++++++++++--
net/mac80211/main.c | 1 +
net/wireless/core.h | 4 ++-
net/wireless/mlme.c | 9 ++++++-
net/wireless/nl80211.c | 18 ++++++++++++-
net/wireless/sme.c | 9 ++++++-
net/wireless/util.c | 11 ++++++++
9 files changed, 108 insertions(+), 6 deletions(-)
--
2.17.1