Skip to content

RFC Allow live MAC address change

James Prestwood linux-wireless 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4nl80211: Add LIVE_ADDR_CHANGE featureinclude/uapi/linux/nl80211.h+9 -00 replies
2/4{nl|cfg}80211: Support mac change as part of SME Connectinclude/net/cfg80211.h include/uapi/linux/nl80211.h net/wireless/core.h +3 more+32 -00 replies
3/4mac80211: Support LIVE_ADDRESS_CHANGE featurenet/mac80211/iface.c net/mac80211/main.c+50 -20 replies
4/4{nl,cfg}nl80211: Support mac change for mlme_authenticatenet/wireless/core.h net/wireless/mlme.c net/wireless/nl80211.c +1 more+17 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/4] Allow live MAC address change

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(-)
Signature · 1 line
2.17.1