From 4551a31c2a0f489598d808d60580a8535fc9c798 Mon Sep 17 00:00:00 2001 From: Chung-Hsien Hsu Date: Thu, 14 Feb 2019 16:33:53 +0800 Subject: [PATCH 017/296] nl80211: add authorized flag back to ROAM event Commit 503c1fb98ba3 ("cfg80211/nl80211: add a port authorized event") added the NL80211_CMD_PORT_AUTHORIZED event to indicate that a connection is authorized. It replaced the PORT_AUTHORIZED attribute and the authorized flag added in commit f45cbe6e691f ("nl80211: add authorized flag to ROAM event"). However, for offload FT, using PORT_AUTHORIZED event mechanism induces wpa_supplicant to start a full EAP exchange after a successful roaming. This patch adds the flag mechanism back to the ROAM event for drivers to fix the offload FT roaming issue. Signed-off-by: Chung-Hsien Hsu Signed-off-by: Chi-hsien Lin --- include/net/cfg80211.h | 5 ++++- include/uapi/linux/nl80211.h | 5 ++++- net/wireless/nl80211.c | 4 +++- net/wireless/sme.c | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 153a8c3e7213..3a4a140bc95a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7947,6 +7947,9 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid, * @links.bss: For MLO roaming, entry of new bss to which STA link got * roamed. For non-MLO roaming, links[0].bss points to entry of bss to * which STA got roamed (may be %NULL if %links.bssid is set) + * @authorized: true if the 802.1X authentication was done by the driver or is + * not needed (e.g., when Fast Transition protocol was used), false + * otherwise. Ignored for networks that don't use 802.1X authentication. */ struct cfg80211_roam_info { const u8 *req_ie; @@ -7954,7 +7957,6 @@ struct cfg80211_roam_info { const u8 *resp_ie; size_t resp_ie_len; struct cfg80211_fils_resp_params fils; - const u8 *ap_mld_addr; u16 valid_links; struct { @@ -7963,6 +7965,7 @@ struct cfg80211_roam_info { struct ieee80211_channel *channel; struct cfg80211_bss *bss; } links[IEEE80211_MLD_MAX_NUM_LINKS]; + bool authorized; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 88eb85c63029..32e850a116a1 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2557,7 +2557,10 @@ enum nl80211_commands { * in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it * wants to use the supported offload of the 4-way handshake. * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT. - * @NL80211_ATTR_PORT_AUTHORIZED: (reserved) + * @NL80211_ATTR_PORT_AUTHORIZED: flag attribute used in %NL80211_CMD_ROAMED + * notification indicating that that 802.1X authentication was done by + * the driver or is not needed (because roaming used the Fast Transition + * protocol). * * @NL80211_ATTR_EXTERNAL_AUTH_ACTION: Identify the requested external * authentication operation (u32 attribute with an diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0b0dfecedc50..66eff379b5f3 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -18215,7 +18215,9 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, (info->fils.pmk && nla_put(msg, NL80211_ATTR_PMK, info->fils.pmk_len, info->fils.pmk)) || (info->fils.pmkid && - nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, info->fils.pmkid))) + nla_put(msg, NL80211_ATTR_PMKID, WLAN_PMKID_LEN, info->fils.pmkid)) || + (info->authorized && + nla_put_flag(msg, NL80211_ATTR_PORT_AUTHORIZED))) goto nla_put_failure; if (info->valid_links) { diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 9bba233b5a6e..7e8a56d49717 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -1280,6 +1280,7 @@ void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info, next += ETH_ALEN; } } + ev->rm.authorized = info->authorized; spin_lock_irqsave(&wdev->event_lock, flags); list_add_tail(&ev->list, &wdev->event_list); -- 2.25.1