@@ -366,7 +366,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
const u8 *ssid, int ssid_len,
const u8 *ie, int ie_len,
const u8 *key, int key_len, int key_idx,
- const u8 *auth_data, int auth_data_len);
+ const u8 *auth_data, int auth_data_len,
+ const u8 *mac_to_use);
int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct ieee80211_channel *chan,
@@ -226,7 +226,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
const u8 *ssid, int ssid_len,
const u8 *ie, int ie_len,
const u8 *key, int key_len, int key_idx,
- const u8 *auth_data, int auth_data_len)
+ const u8 *auth_data, int auth_data_len,
+ const u8 *mac_to_use)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_auth_request req = {
@@ -257,6 +258,12 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
if (!req.bss)
return -ENOENT;
+ if (mac_to_use) {
+ err = cfg80211_set_mac_to_use(dev, mac_to_use);
+ if (err)
+ return err;
+ }
+
err = rdev_auth(rdev, dev, &req);
cfg80211_put_bss(&rdev->wiphy, req.bss);
@@ -8898,6 +8898,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
enum nl80211_auth_type auth_type;
struct key_parse key;
bool local_state_change;
+ const u8 *mac_to_change = NULL;
if (!info->attrs[NL80211_ATTR_MAC])
return -EINVAL;
@@ -8993,6 +8994,10 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE];
+ if (info->attrs[NL80211_ATTR_MAC_TO_USE])
+ mac_to_change = nla_data(
+ info->attrs[NL80211_ATTR_MAC_TO_USE]);
+
/*
* Since we no longer track auth state, ignore
* requests to only change local state.
@@ -9004,7 +9009,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
err = cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
ssid, ssid_len, ie, ie_len,
key.p.key, key.p.key_len, key.idx,
- auth_data, auth_data_len);
+ auth_data, auth_data_len, mac_to_change);
wdev_unlock(dev->ieee80211_ptr);
return err;
}
@@ -174,7 +174,7 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev,
params->ssid, params->ssid_len,
NULL, 0,
params->key, params->key_len,
- params->key_idx, NULL, 0);
+ params->key_idx, NULL, 0, NULL);
case CFG80211_CONN_AUTH_FAILED_TIMEOUT:
*treason = NL80211_TIMEOUT_AUTH;
return -ENOTCONN;