2022-09-19 12:17:20

by Veerendranath Jakkam

[permalink] [raw]
Subject: [PATCH v2 4/4] wifi: cfg80211: Add support to trigger external authentication for MLO connection

Currently, there is no support for drivers to indicate external
authentication request is for MLO or non-MLO connection. This
information needed for userspace to consider MLO specific changes
during authentication like adding Multi-Link IE with MLD address in
authentication frames. Also, the transmit address of the authentication
frames can be different from the interface address for MLO connection.

Add transmit address parameter in external authentication request to
indicate userspace to enable MLO and use the transmit address as TA in
the authentication frames. If transmit address not indicated by driver
userspace must do legacy authentication.

Also, If the driver is using transmit address different from interface
address it should advertise
NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA flag. This is needed since
the external authentication request may get triggered before association
and cfg80211 won't have link address information by that time.

Signed-off-by: Veerendranath Jakkam <[email protected]>
---
include/net/cfg80211.h | 9 +++++++++
net/wireless/core.h | 1 +
net/wireless/mlme.c | 2 +-
net/wireless/nl80211.c | 10 ++++++++++
4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e09ff87146c1..4d490d507333 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3604,6 +3604,14 @@ struct cfg80211_pmk_conf {
* the real status code for failures. Used only for the authentication
* response command interface (user space to driver).
* @pmkid: The identifier to refer a PMKSA.
+ * @tx_addr: Driver shall fill this parameter to indicate userpsace to enable
+ * MLO and use tx_addr as TA of the authentication frames. Also, Drivers
+ * which may use transmit address different from interface address must
+ * indicate %NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA since the
+ * external authentication request may get triggered before association and
+ * cfg80211 won't have link address information by that time. If transmit
+ * address not indicated by driver userspace must do legacy authentication.
+ * This parameter valid only for the authentication request event.
*/
struct cfg80211_external_auth_params {
enum nl80211_external_auth_action action;
@@ -3612,6 +3620,7 @@ struct cfg80211_external_auth_params {
unsigned int key_mgmt_suite;
u16 status;
const u8 *pmkid;
+ u8 tx_addr[ETH_ALEN] __aligned(2);
};

/**
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 775e16cb99ed..288cb91c24f3 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -566,5 +566,6 @@ void cfg80211_remove_link(struct wireless_dev *wdev, unsigned int link_id);
void cfg80211_remove_links(struct wireless_dev *wdev);
int cfg80211_remove_virtual_intf(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev);
+bool cfg80211_allowed_address(struct wireless_dev *wdev, const u8 *addr);

#endif /* __NET_WIRELESS_CORE_H */
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 43d1b815aaba..17ce998cdc42 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -657,7 +657,7 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
cfg80211_mgmt_registrations_update(wdev);
}

-static bool cfg80211_allowed_address(struct wireless_dev *wdev, const u8 *addr)
+bool cfg80211_allowed_address(struct wireless_dev *wdev, const u8 *addr)
{
int i;

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8ff8b1c040f0..fdeda730ebdb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -19703,6 +19703,16 @@ int cfg80211_external_auth_request(struct net_device *dev,
params->ssid.ssid))
goto nla_put_failure;

+ if (!is_zero_ether_addr(params->tx_addr)) {
+ if (!cfg80211_allowed_address(wdev, params->tx_addr) &&
+ !wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA))
+ return -EINVAL;
+
+ if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, params->tx_addr))
+ goto nla_put_failure;
+ }
+
genlmsg_end(msg, hdr);
genlmsg_unicast(wiphy_net(&rdev->wiphy), msg,
wdev->conn_owner_nlportid);
--
2.25.1