From: James Prestwood <prestwoj@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [RFC 4/4] {nl,cfg}nl80211: Support mac change for mlme_authenticate
Date: Wed, 4 Sep 2019 12:11:55 -0700 [thread overview]
Message-ID: <20190904191155.28056-5-prestwoj@gmail.com> (raw)
In-Reply-To: <20190904191155.28056-1-prestwoj@gmail.com>
---
net/wireless/core.h | 3 ++-
net/wireless/mlme.c | 9 ++++++++-
net/wireless/nl80211.c | 7 ++++++-
net/wireless/sme.c | 2 +-
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 29e6ab2cf343..869ab983692d 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -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,
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index f9462010575f..adf411905e64 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -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);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0202a762b5c8..db32eaaaa50e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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;
}
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index f164af33655f..f66ea48b73df 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -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;
--
2.17.1
next prev parent reply other threads:[~2019-09-04 19:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 19:11 [RFC 0/4] Allow live MAC address change James Prestwood
2019-09-04 19:11 ` [RFC 1/4] nl80211: Add LIVE_ADDR_CHANGE feature James Prestwood
2019-09-04 19:11 ` [RFC 2/4] {nl|cfg}80211: Support mac change as part of SME Connect James Prestwood
2019-09-04 19:11 ` [RFC 3/4] mac80211: Support LIVE_ADDRESS_CHANGE feature James Prestwood
2019-09-04 19:11 ` James Prestwood [this message]
2019-09-11 9:09 ` [RFC 0/4] Allow live MAC address change Johannes Berg
2019-09-11 15:54 ` James Prestwood
2019-09-11 18:25 ` Johannes Berg
2019-09-11 19:20 ` James Prestwood
2019-09-13 10:24 ` Kalle Valo
2019-09-13 16:17 ` James Prestwood
2019-09-17 7:46 ` Kalle Valo
2019-09-17 15:40 ` Denis Kenzior
2019-09-17 18:44 ` Bob Marcan
2019-09-17 18:47 ` Ben Greear
2019-09-17 19:05 ` Marcel Holtmann
2019-09-17 19:11 ` Steve deRosier
2019-09-17 16:11 ` James Prestwood
2019-09-13 18:49 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190904191155.28056-5-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.