From: Ilan Peer Date: Mon, 4 May 2026 07:20:44 +0000 (+0300) Subject: wifi: mac80211: Allow setting MAC address on interface creation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bcf276e4a508db76671451def7e723ccc9c689c;p=thirdparty%2Flinux.git wifi: mac80211: Allow setting MAC address on interface creation Allow setting the interface MAC address for NAN Device interfaces and P2P Device interfaces on interface creation. Signed-off-by: Ilan Peer Reviewed-by: Johannes Berg Signed-off-by: Miri Korenblit Link: https://patch.msgid.link/20260504101829.d268b245037b.I351e16270c34ee734fed98da25db848211ab7cc2@changeid Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 95b779c4d627..683d8db4da14 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -2280,7 +2280,12 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, sdata->dev = NULL; strscpy(sdata->name, name, IFNAMSIZ); - ieee80211_assign_perm_addr(local, wdev->address, type); + + if (is_valid_ether_addr(params->macaddr)) + memcpy(wdev->address, params->macaddr, ETH_ALEN); + else + ieee80211_assign_perm_addr(local, wdev->address, type); + memcpy(sdata->vif.addr, wdev->address, ETH_ALEN); ether_addr_copy(sdata->vif.bss_conf.addr, sdata->vif.addr);