aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2018-10-10 17:21:19 -0400
committerJohannes Berg <johannes.berg@intel.com>2018-10-11 10:01:05 -0400
commitfc107a93307165d5bf966767e4456832ef3940ef (patch)
treebe701ae7ec0fb7db32696607843bc81b12b8450b
parent506dbf90c1ba98d998b26e17a2e3e69bffef52f4 (diff)
mac80211: Helper function for marking STA authenticated
Authentication exchange can be completed in both TX and RX paths for SAE, so move this common functionality into a helper function to avoid having to implement practically the same operations in two places when extending SAE implementation in the following commits. Signed-off-by: Jouni Malinen <jouni@codeaurora.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/mlme.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 89dac799a85f..2d3ec0156780 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2761,13 +2761,33 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
2761 auth_data->key_idx, tx_flags); 2761 auth_data->key_idx, tx_flags);
2762} 2762}
2763 2763
2764static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata,
2765 const u8 *bssid)
2766{
2767 struct sta_info *sta;
2768
2769 /* move station state to auth */
2770 mutex_lock(&sdata->local->sta_mtx);
2771 sta = sta_info_get(sdata, bssid);
2772 if (!sta) {
2773 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);
2774 return false;
2775 }
2776 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
2777 sdata_info(sdata, "failed moving %pM to auth\n", bssid);
2778 return false;
2779 }
2780 mutex_unlock(&sdata->local->sta_mtx);
2781
2782 return true;
2783}
2784
2764static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, 2785static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
2765 struct ieee80211_mgmt *mgmt, size_t len) 2786 struct ieee80211_mgmt *mgmt, size_t len)
2766{ 2787{
2767 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2788 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2768 u8 bssid[ETH_ALEN]; 2789 u8 bssid[ETH_ALEN];
2769 u16 auth_alg, auth_transaction, status_code; 2790 u16 auth_alg, auth_transaction, status_code;
2770 struct sta_info *sta;
2771 struct ieee80211_event event = { 2791 struct ieee80211_event event = {
2772 .type = MLME_EVENT, 2792 .type = MLME_EVENT,
2773 .u.mlme.data = AUTH_EVENT, 2793 .u.mlme.data = AUTH_EVENT,
@@ -2850,18 +2870,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
2850 return; 2870 return;
2851 } 2871 }
2852 2872
2853 /* move station state to auth */ 2873 if (!ieee80211_mark_sta_auth(sdata, bssid))
2854 mutex_lock(&sdata->local->sta_mtx);
2855 sta = sta_info_get(sdata, bssid);
2856 if (!sta) {
2857 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);
2858 goto out_err; 2874 goto out_err;
2859 }
2860 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
2861 sdata_info(sdata, "failed moving %pM to auth\n", bssid);
2862 goto out_err;
2863 }
2864 mutex_unlock(&sdata->local->sta_mtx);
2865 2875
2866 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); 2876 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
2867 return; 2877 return;