commit 0f6d1ece78f0f8c35044ce3cabe50eb724c145a6
parent 483194ee91b1ac5e368b251156994a4c0e4901dd
Author: Denis Kenzior <denkenz@gmail.com>
Date: Mon, 15 Jul 2019 21:45:58 -0500
eapol: Remove eapol_sm_set_protocol_version
Handshake state will now pick reasonable defaults
Diffstat:
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/adhoc.c b/src/adhoc.c
@@ -252,7 +252,6 @@ static struct eapol_sm *adhoc_new_sm(struct sta_state *sta, bool authenticator,
}
eapol_sm_set_listen_interval(sm, 100);
- eapol_sm_set_protocol_version(sm, EAPOL_PROTOCOL_VERSION_2004);
if (authenticator)
sta->hs_auth = hs;
diff --git a/src/ap.c b/src/ap.c
@@ -444,7 +444,6 @@ static void ap_start_rsna(struct sta_state *sta, const uint8_t *gtk_rsc)
}
eapol_sm_set_listen_interval(sta->sm, sta->listen_interval);
- eapol_sm_set_protocol_version(sta->sm, EAPOL_PROTOCOL_VERSION_2004);
eapol_register(sta->sm);
diff --git a/src/eapol.c b/src/eapol.c
@@ -890,12 +890,6 @@ void eapol_sm_free(struct eapol_sm *sm)
eapol_sm_destroy(sm);
}
-void eapol_sm_set_protocol_version(struct eapol_sm *sm,
- enum eapol_protocol_version protocol_version)
-{
- sm->protocol_version = protocol_version;
-}
-
void eapol_sm_set_listen_interval(struct eapol_sm *sm, uint16_t interval)
{
sm->listen_interval = interval;
@@ -981,10 +975,7 @@ static void send_eapol_start(struct l_timeout *timeout, void *user_data)
l_timeout_remove(sm->eapol_start_timeout);
sm->eapol_start_timeout = NULL;
- if (!sm->protocol_version)
- sm->protocol_version = EAPOL_PROTOCOL_VERSION_2001;
-
- frame->header.protocol_version = sm->protocol_version;
+ frame->header.protocol_version = EAPOL_PROTOCOL_VERSION_2001;
frame->header.packet_type = 1;
l_put_be16(0, &frame->header.packet_len);
@@ -2339,15 +2330,22 @@ void eapol_register(struct eapol_sm *sm)
sm->watch_id = eapol_frame_watch_add(sm->handshake->ifindex,
eapol_rx_auth_packet, sm);
+ if (!sm->handshake->proto_version)
+ sm->protocol_version = EAPOL_PROTOCOL_VERSION_2004;
+ else
+ sm->protocol_version = sm->handshake->proto_version;
+
sm->started = true;
/* Since AP/AdHoc only support AKM PSK we can hard code this */
sm->mic_len = 16;
/* kick off handshake */
eapol_ptk_1_of_4_retry(NULL, sm);
- } else
+ } else {
sm->watch_id = eapol_frame_watch_add(sm->handshake->ifindex,
eapol_rx_packet, sm);
+ sm->protocol_version = sm->handshake->proto_version;
+ }
}
bool eapol_start(struct eapol_sm *sm)