mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
eapol: removed authenticator bit and auth register
This removes the authenticator bit in eapol_sm as well as unifies eapol_register_authenticator and eapol_register. Taking advantage of the handshake state authenticator bit we no longer have a need for 2 separate register functions. ap, and adhoc were also updated to set the authenticator bit in the handshake and only use eapol_register to register their sm's. netdev was updated to use the authenticator bit when choosing the correct key address for adhoc.
This commit is contained in:
parent
2036d36313
commit
986f66a3c6
@ -224,6 +224,7 @@ static struct eapol_sm *adhoc_new_sm(struct sta_state *sta, bool authenticator)
|
|||||||
if (authenticator) {
|
if (authenticator) {
|
||||||
handshake_state_set_authenticator_address(hs, own_addr);
|
handshake_state_set_authenticator_address(hs, own_addr);
|
||||||
handshake_state_set_supplicant_address(hs, sta->addr);
|
handshake_state_set_supplicant_address(hs, sta->addr);
|
||||||
|
handshake_state_set_authenticator(hs, true);
|
||||||
} else {
|
} else {
|
||||||
handshake_state_set_authenticator_address(hs, sta->addr);
|
handshake_state_set_authenticator_address(hs, sta->addr);
|
||||||
handshake_state_set_supplicant_address(hs, own_addr);
|
handshake_state_set_supplicant_address(hs, own_addr);
|
||||||
@ -299,7 +300,7 @@ static void adhoc_new_station(struct adhoc_state *adhoc, const uint8_t *mac)
|
|||||||
}
|
}
|
||||||
|
|
||||||
eapol_register(sta->sm);
|
eapol_register(sta->sm);
|
||||||
eapol_register_authenticator(sta->sm_a);
|
eapol_register(sta->sm_a);
|
||||||
|
|
||||||
eapol_start(sta->sm);
|
eapol_start(sta->sm);
|
||||||
|
|
||||||
|
3
src/ap.c
3
src/ap.c
@ -424,6 +424,7 @@ static void ap_associate_sta_cb(struct l_genl_msg *msg, void *user_data)
|
|||||||
handshake_state_set_pmk(sta->hs, ap->pmk, 32);
|
handshake_state_set_pmk(sta->hs, ap->pmk, 32);
|
||||||
handshake_state_set_authenticator_address(sta->hs, own_addr);
|
handshake_state_set_authenticator_address(sta->hs, own_addr);
|
||||||
handshake_state_set_supplicant_address(sta->hs, sta->addr);
|
handshake_state_set_supplicant_address(sta->hs, sta->addr);
|
||||||
|
handshake_state_set_authenticator(sta->hs, true);
|
||||||
|
|
||||||
sta->sm = eapol_sm_new(sta->hs);
|
sta->sm = eapol_sm_new(sta->hs);
|
||||||
if (!sta->sm) {
|
if (!sta->sm) {
|
||||||
@ -435,7 +436,7 @@ static void ap_associate_sta_cb(struct l_genl_msg *msg, void *user_data)
|
|||||||
eapol_sm_set_listen_interval(sta->sm, sta->listen_interval);
|
eapol_sm_set_listen_interval(sta->sm, sta->listen_interval);
|
||||||
eapol_sm_set_protocol_version(sta->sm, EAPOL_PROTOCOL_VERSION_2004);
|
eapol_sm_set_protocol_version(sta->sm, EAPOL_PROTOCOL_VERSION_2004);
|
||||||
|
|
||||||
eapol_register_authenticator(sta->sm);
|
eapol_register(sta->sm);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
14
src/eapol.c
14
src/eapol.c
@ -687,7 +687,6 @@ struct eapol_sm {
|
|||||||
bool use_eapol_start:1;
|
bool use_eapol_start:1;
|
||||||
bool require_handshake:1;
|
bool require_handshake:1;
|
||||||
bool eap_exchanged:1;
|
bool eap_exchanged:1;
|
||||||
bool authenticator:1;
|
|
||||||
struct eap_state *eap;
|
struct eap_state *eap;
|
||||||
struct eapol_frame *early_frame;
|
struct eapol_frame *early_frame;
|
||||||
uint32_t watch_id;
|
uint32_t watch_id;
|
||||||
@ -2040,22 +2039,17 @@ void eapol_register(struct eapol_sm *sm)
|
|||||||
{
|
{
|
||||||
l_queue_push_head(state_machines, sm);
|
l_queue_push_head(state_machines, sm);
|
||||||
|
|
||||||
sm->watch_id = eapol_frame_watch_add(sm->handshake->ifindex,
|
if (sm->handshake->authenticator) {
|
||||||
eapol_rx_packet, sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
void eapol_register_authenticator(struct eapol_sm *sm)
|
|
||||||
{
|
|
||||||
l_queue_push_head(state_machines, sm);
|
|
||||||
|
|
||||||
sm->watch_id = eapol_frame_watch_add(sm->handshake->ifindex,
|
sm->watch_id = eapol_frame_watch_add(sm->handshake->ifindex,
|
||||||
eapol_rx_auth_packet, sm);
|
eapol_rx_auth_packet, sm);
|
||||||
|
|
||||||
sm->started = true;
|
sm->started = true;
|
||||||
sm->authenticator = true;
|
|
||||||
|
|
||||||
/* kick off handshake */
|
/* kick off handshake */
|
||||||
eapol_ptk_1_of_4_retry(NULL, sm);
|
eapol_ptk_1_of_4_retry(NULL, sm);
|
||||||
|
} else
|
||||||
|
sm->watch_id = eapol_frame_watch_add(sm->handshake->ifindex,
|
||||||
|
eapol_rx_packet, sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool eapol_start(struct eapol_sm *sm)
|
bool eapol_start(struct eapol_sm *sm)
|
||||||
|
@ -200,7 +200,6 @@ void eapol_sm_set_user_data(struct eapol_sm *sm, void *user_data);
|
|||||||
void eapol_sm_set_event_func(struct eapol_sm *sm, eapol_sm_event_func_t func);
|
void eapol_sm_set_event_func(struct eapol_sm *sm, eapol_sm_event_func_t func);
|
||||||
|
|
||||||
void eapol_register(struct eapol_sm *sm);
|
void eapol_register(struct eapol_sm *sm);
|
||||||
void eapol_register_authenticator(struct eapol_sm *sm);
|
|
||||||
bool eapol_start(struct eapol_sm *sm);
|
bool eapol_start(struct eapol_sm *sm);
|
||||||
|
|
||||||
uint32_t eapol_frame_watch_add(uint32_t ifindex,
|
uint32_t eapol_frame_watch_add(uint32_t ifindex,
|
||||||
|
@ -1279,7 +1279,7 @@ static const uint8_t *netdev_choose_key_address(
|
|||||||
case NL80211_IFTYPE_AP:
|
case NL80211_IFTYPE_AP:
|
||||||
return nhs->super.spa;
|
return nhs->super.spa;
|
||||||
case NL80211_IFTYPE_ADHOC:
|
case NL80211_IFTYPE_ADHOC:
|
||||||
if (!memcmp(nhs->netdev->addr, nhs->super.aa, 6))
|
if (nhs->super.authenticator)
|
||||||
return nhs->super.spa;
|
return nhs->super.spa;
|
||||||
else
|
else
|
||||||
return nhs->super.aa;
|
return nhs->super.aa;
|
||||||
|
Loading…
Reference in New Issue
Block a user