Skip to content

Commit fc107a9

Browse files
Jouni Malinenjmberg-intel
authored andcommitted
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 <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 506dbf9 commit fc107a9

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

net/mac80211/mlme.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,13 +2761,33 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
27612761
auth_data->key_idx, tx_flags);
27622762
}
27632763

2764+
static 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+
27642785
static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
27652786
struct ieee80211_mgmt *mgmt, size_t len)
27662787
{
27672788
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
27682789
u8 bssid[ETH_ALEN];
27692790
u16 auth_alg, auth_transaction, status_code;
2770-
struct sta_info *sta;
27712791
struct ieee80211_event event = {
27722792
.type = MLME_EVENT,
27732793
.u.mlme.data = AUTH_EVENT,
@@ -2850,18 +2870,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
28502870
return;
28512871
}
28522872

2853-
/* move station state to auth */
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);
2873+
if (!ieee80211_mark_sta_auth(sdata, bssid))
28582874
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);
28652875

28662876
cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
28672877
return;

0 commit comments

Comments
 (0)