From a134b4dc5cdd25d2e79751812bfb22fa815799ec Mon Sep 17 00:00:00 2001 From: Ilan Peer Date: Wed, 30 Nov 2022 15:09:28 +0200 Subject: [PATCH] nl80211: Add support for MLD authentication Set MLO attributes for NL80211_CMD_AUTHENTICATE and make sure that MLD configuration is preserved between authentication retries. Signed-off-by: Johannes Berg Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- src/drivers/driver.h | 15 +++++++++++++++ src/drivers/driver_nl80211.c | 28 ++++++++++++++++++++++++++++ src/drivers/driver_nl80211.h | 3 +++ 3 files changed, 46 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 1e1e1708a..78d229c24 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -720,6 +720,21 @@ struct wpa_driver_auth_params { * auth_data_len - Length of auth_data buffer in octets */ size_t auth_data_len; + + /** + * mld - Establish an MLD connection + */ + bool mld; + + /** + * mld_link_id - The link ID of the MLD AP to which we are associating + */ + u8 mld_link_id; + + /** + * The MLD AP address + */ + const u8 *ap_mld_addr; }; /** diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 90b877099..4796ed227 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -278,6 +278,10 @@ void nl80211_mark_disconnected(struct wpa_driver_nl80211_data *drv) os_free(drv->pending_roam_data); drv->pending_roam_data = NULL; #endif /* CONFIG_DRIVER_NL80211_QCA */ + + drv->auth_mld = false; + drv->auth_mld_link_id = -1; + os_memset(drv->auth_ap_mld_addr, 0, ETH_ALEN); } @@ -3702,6 +3706,15 @@ static void nl80211_copy_auth_params(struct wpa_driver_nl80211_data *drv, } } + if (params->mld && params->ap_mld_addr) { + drv->auth_mld = params->mld; + drv->auth_mld_link_id = params->mld_link_id; + os_memcpy(drv->auth_ap_mld_addr, params->ap_mld_addr, ETH_ALEN); + } else { + drv->auth_mld = false; + drv->auth_mld_link_id = -1; + } + os_free(drv->auth_data); drv->auth_data = NULL; drv->auth_data_len = 0; @@ -3865,6 +3878,17 @@ retry: goto fail; } + if (params->mld && params->ap_mld_addr) { + wpa_printf(MSG_DEBUG, " * MLD: link_id=%u, MLD addr=" MACSTR, + params->mld_link_id, MAC2STR(params->ap_mld_addr)); + + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, + params->mld_link_id) || + nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, + params->ap_mld_addr)) + goto fail; + } + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); msg = NULL; if (ret) { @@ -3968,6 +3992,10 @@ int wpa_driver_nl80211_authenticate_retry(struct wpa_driver_nl80211_data *drv) params.ie_len = drv->auth_ie_len; params.auth_data = drv->auth_data; params.auth_data_len = drv->auth_data_len; + params.mld = drv->auth_mld; + params.mld_link_id = drv->auth_mld_link_id; + if (drv->auth_mld) + params.ap_mld_addr = drv->auth_ap_mld_addr; for (i = 0; i < 4; i++) { if (drv->auth_wep_key_len[i]) { diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 86649136c..a6cb14c5a 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -225,6 +225,9 @@ struct wpa_driver_nl80211_data { int auth_wep_tx_keyidx; int auth_local_state_change; int auth_p2p; + bool auth_mld; + u8 auth_mld_link_id; + u8 auth_ap_mld_addr[ETH_ALEN]; /* * Tells whether the last scan issued from wpa_supplicant was a normal