3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:29:44 +01:00

eap-ttls: Rename eap to phase2_eap for clarity

This commit is contained in:
Denis Kenzior 2018-06-20 13:54:36 -05:00
parent a217b4f8b9
commit d76cf840ed

View File

@ -48,7 +48,7 @@ struct eap_ttls_state {
size_t avp_received, avp_capacity; size_t avp_received, avp_capacity;
bool phase1_completed; bool phase1_completed;
bool completed; bool completed;
struct eap_state *eap; struct eap_state *phase2_eap;
uint8_t negotiated_version; uint8_t negotiated_version;
}; };
@ -83,10 +83,10 @@ static bool eap_ttls_reset_state(struct eap_state *eap)
{ {
struct eap_ttls_state *ttls = eap_get_data(eap); struct eap_ttls_state *ttls = eap_get_data(eap);
if (!ttls->eap) if (!ttls->phase2_eap)
return false; return false;
if (!eap_reset(ttls->eap)) if (!eap_reset(ttls->phase2_eap))
return false; return false;
__eap_ttls_reset_state(ttls); __eap_ttls_reset_state(ttls);
@ -110,9 +110,9 @@ static void eap_ttls_free(struct eap_state *eap)
l_free(ttls->passphrase); l_free(ttls->passphrase);
} }
if (ttls->eap) { if (ttls->phase2_eap) {
eap_free(ttls->eap); eap_free(ttls->phase2_eap);
ttls->eap = NULL; ttls->phase2_eap = NULL;
} }
l_free(ttls); l_free(ttls);
@ -189,11 +189,11 @@ static bool eap_ttls_handle_avp(struct eap_state *eap, struct eap_ttls_avp *avp)
switch (code) { switch (code) {
/* EAP-Message attribute, actually defined in RFC2869 5.13 */ /* EAP-Message attribute, actually defined in RFC2869 5.13 */
case RADIUS_AVP_EAP_MESSAGE: case RADIUS_AVP_EAP_MESSAGE:
if (!ttls->eap) if (!ttls->phase2_eap)
goto avp_err; goto avp_err;
/* TODO: split if necessary */ /* TODO: split if necessary */
eap_rx_packet(ttls->eap, data, data_len); eap_rx_packet(ttls->phase2_eap, data, data_len);
break; break;
@ -370,14 +370,14 @@ static void eap_ttls_ready_cb(const char *peer_identity, void *user_data)
NULL, 0); NULL, 0);
/* Start the EAP negotiation */ /* Start the EAP negotiation */
if (!ttls->eap) if (!ttls->phase2_eap)
goto err; goto err;
/* /*
* Consume a fake Request/Identity packet so that the EAP instance * Consume a fake Request/Identity packet so that the EAP instance
* starts with its Response/Identity right away. * starts with its Response/Identity right away.
*/ */
eap_rx_packet(ttls->eap, packet, sizeof(packet)); eap_rx_packet(ttls->phase2_eap, packet, sizeof(packet));
return; return;
err: err:
@ -621,9 +621,9 @@ static void eap_ttls_handle_request(struct eap_state *eap,
l_tls_free(ttls->tls); l_tls_free(ttls->tls);
ttls->tls = NULL; ttls->tls = NULL;
if (ttls->eap) { if (ttls->phase2_eap) {
eap_free(ttls->eap); eap_free(ttls->phase2_eap);
ttls->eap = NULL; ttls->phase2_eap = NULL;
} }
} }
@ -775,17 +775,17 @@ static bool eap_ttls_load_settings(struct eap_state *eap,
prefix); prefix);
ttls->passphrase = l_settings_get_string(settings, "Security", setting); ttls->passphrase = l_settings_get_string(settings, "Security", setting);
ttls->eap = eap_new(eap_ttls_eap_tx_packet, ttls->phase2_eap = eap_new(eap_ttls_eap_tx_packet,
eap_ttls_eap_complete, eap); eap_ttls_eap_complete, eap);
if (!ttls->eap) { if (!ttls->phase2_eap) {
l_error("Could not create the TTLS inner EAP instance"); l_error("Could not create the TTLS inner EAP instance");
goto err; goto err;
} }
snprintf(setting, sizeof(setting), "%sTTLS-Phase2-", prefix); snprintf(setting, sizeof(setting), "%sTTLS-Phase2-", prefix);
if (!eap_load_settings(ttls->eap, settings, setting)) { if (!eap_load_settings(ttls->phase2_eap, settings, setting)) {
eap_free(ttls->eap); eap_free(ttls->phase2_eap);
goto err; goto err;
} }