From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 4/8] ap: Stop ongoing handshake on reassociation
Date: Fri, 28 Aug 2020 14:46:45 +0200 [thread overview]
Message-ID: <20200828124649.78677-4-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20200828124649.78677-1-andrew.zaborowski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2967 bytes --]
On a new association or re-association, in addition to forgetting a
complete RSN Association, also stop the EAPoL SM to stop any ongoing
handshake.
Do this in a new function ap_stop_handshake that is now used in a few
places that had copies of the same few lines. I'll be adding some more
lines to this function for WSC support.
---
src/ap.c | 51 +++++++++++++++++++++++++--------------------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index bc8b11e8..fa7d030a 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -106,6 +106,19 @@ void ap_config_free(struct ap_config *config)
l_free(config);
}
+static void ap_stop_handshake(struct sta_state *sta)
+{
+ if (sta->sm) {
+ eapol_sm_free(sta->sm);
+ sta->sm = NULL;
+ }
+
+ if (sta->hs) {
+ handshake_state_free(sta->hs);
+ sta->hs = NULL;
+ }
+}
+
static void ap_sta_free(void *data)
{
struct sta_state *sta = data;
@@ -120,11 +133,7 @@ static void ap_sta_free(void *data)
if (sta->gtk_query_cmd_id)
l_genl_family_cancel(ap->nl80211, sta->gtk_query_cmd_id);
- if (sta->sm)
- eapol_sm_free(sta->sm);
-
- if (sta->hs)
- handshake_state_free(sta->hs);
+ ap_stop_handshake(sta);
l_free(sta);
}
@@ -180,14 +189,7 @@ static void ap_del_station(struct sta_state *sta, uint16_t reason,
sta->gtk_query_cmd_id = 0;
}
- if (sta->sm)
- eapol_sm_free(sta->sm);
-
- if (sta->hs)
- handshake_state_free(sta->hs);
-
- sta->hs = NULL;
- sta->sm = NULL;
+ ap_stop_handshake(sta);
if (send_event)
ap->event_func(AP_EVENT_STATION_REMOVED, &event_data,
@@ -268,14 +270,7 @@ static void ap_drop_rsna(struct sta_state *sta)
l_error("Issuing DEL_KEY failed");
}
- if (sta->sm)
- eapol_sm_free(sta->sm);
-
- if (sta->hs)
- handshake_state_free(sta->hs);
-
- sta->hs = NULL;
- sta->sm = NULL;
+ ap_stop_handshake(sta);
if (ap->event_func) {
struct ap_event_station_removed_data event_data = {};
@@ -938,6 +933,12 @@ static void ap_assoc_reassoc(struct sta_state *sta, bool reassoc,
goto unsupported;
}
+ /* 802.11-2016 11.3.5.3 j) */
+ if (sta->rsna)
+ ap_drop_rsna(sta);
+ else if (sta->associated)
+ ap_stop_handshake(sta);
+
if (!sta->associated) {
/*
* Everything fine so far, assign an AID, send response.
@@ -961,10 +962,6 @@ static void ap_assoc_reassoc(struct sta_state *sta, bool reassoc,
sta->assoc_rsne = l_memdup(rsn, rsn[1] + 2);
- /* 802.11-2016 11.3.5.3 j) */
- if (sta->rsna)
- ap_drop_rsna(sta);
-
sta->assoc_resp_cmd_id = ap_assoc_resp(ap, sta, sta->addr, sta->aid, 0,
reassoc,
ap_success_assoc_resp_cb);
@@ -987,8 +984,10 @@ bad_frame:
*
* For now, we need to drop the RSNA.
*/
- if (sta->associated && sta->rsna)
+ if (sta->rsna)
ap_drop_rsna(sta);
+ else if (sta->associated)
+ ap_stop_handshake(sta);
if (rates)
l_uintset_free(rates);
--
2.25.1
next prev parent reply other threads:[~2020-08-28 12:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 12:46 [PATCH 1/8] wscutil: Use a utility for building authorized_macs Andrew Zaborowski
2020-08-28 12:46 ` [PATCH 2/8] wscutil: Add wsc_build_beacon Andrew Zaborowski
2020-08-28 12:46 ` [PATCH 3/8] eapol: Handle the use_eapol_start flag on authenticator Andrew Zaborowski
2020-08-28 12:46 ` Andrew Zaborowski [this message]
2020-08-28 12:46 ` [PATCH 5/8] ap: Push Button mode API and beacon changes Andrew Zaborowski
2020-08-28 12:46 ` [PATCH 6/8] ap: WSC Probe Request processing logic Andrew Zaborowski
2020-08-28 12:46 ` [PATCH 7/8] ap: Parse WSC PBC association request and build response Andrew Zaborowski
2020-08-28 12:46 ` [PATCH 8/8] ap: Start EAP-WSC authentication with WSC enrollees Andrew Zaborowski
2020-08-28 15:55 ` [PATCH 1/8] wscutil: Use a utility for building authorized_macs Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200828124649.78677-4-andrew.zaborowski@intel.com \
--to=andrew.zaborowski@intel.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox