This function is for reconfiguring the EAPOL state machine when the EAP<br><div class="gmail_quote">
configuration is changed, either by reconfiguring smartcard modules over<br>
DBus or a reload of the config file.<br>
<br>
Also, modify ctrl_iface_dbus_handlers.c and wpa_supplicant.c to use new<br>
interface.<br>
---<br>
src/eapol_supp/eapol_supp_sm.c | 30 +++++++++++++++++++++++++++-<br>
src/eapol_supp/eapol_supp_sm.h | 8 +++++++<br>
wpa_supplicant/ctrl_iface_dbus_handlers.c | 11 +++++++--<br>
wpa_supplicant/wpa_supplicant.c | 14 +++++++++---<br>
4 files changed, 54 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c<br>
index f382ee6..d7b7876 100644<br>
--- a/src/eapol_supp/eapol_supp_sm.c<br>
+++ b/src/eapol_supp/eapol_supp_sm.c<br>
@@ -1772,6 +1772,32 @@ static struct eapol_callbacks eapol_cb =<br>
<br>
<br>
/**<br>
+ * eapol_sm_notify_eap_config - Notification of EAP config change<br>
+ * @sm: Pointer to EAPOL state machine allocated with eapol_sm_init()<br>
+ * @eap_config: Pointer to EAP configuration data<br>
+ * Returns: TRUE if successful, FALSE if not.<br>
+ *<br>
+ * Notify EAPOL state machine that EAP configuration has changed.<br>
+ */<br>
+Boolean eapol_sm_notify_eap_config(struct eapol_sm *sm,<br>
+ struct eap_config *config)<br>
+{<br>
+ if (sm == NULL || config == NULL)<br>
+ return FALSE;<br>
+<br>
+ eapol_sm_invalidate_cached_session(sm);<br>
+ if (sm->eap)<br>
+ eap_peer_sm_deinit(sm->eap);<br>
+ sm->eap = eap_peer_sm_init(sm, &eapol_cb, sm->ctx->msg_ctx,<br>
+ config);<br>
+<br>
+ if (sm->eap == NULL)<br>
+ return FALSE;<br>
+ else<br>
+ return TRUE;<br>
+}<br>
+<br>
+/**<br>
* eapol_sm_init - Initialize EAPOL state machine<br>
* @ctx: Pointer to EAPOL context data; this needs to be an allocated buffer<br>
* and EAPOL state machine will free it in eapol_sm_deinit()<br>
@@ -1806,8 +1832,8 @@ struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)<br>
#endif /* EAP_TLS_OPENSSL */<br>
conf.wps = ctx->wps;<br>
<br>
- sm->eap = eap_peer_sm_init(sm, &eapol_cb, sm->ctx->msg_ctx, &conf);<br>
- if (sm->eap == NULL) {<br>
+ if (! eapol_sm_notify_eap_config(sm, &conf))<br>
+ {<br>
os_free(sm);<br>
return NULL;<br>
}<br>
diff --git a/src/eapol_supp/eapol_supp_sm.h b/src/eapol_supp/eapol_supp_sm.h<br>
index 57d7bc1..ba97dcd 100644<br>
--- a/src/eapol_supp/eapol_supp_sm.h<br>
+++ b/src/eapol_supp/eapol_supp_sm.h<br>
@@ -16,6 +16,7 @@<br>
#define EAPOL_SUPP_SM_H<br>
<br>
#include "defs.h"<br>
+#include "eap_peer/eap.h"<br>
<br>
typedef enum { Unauthorized, Authorized } PortStatus;<br>
typedef enum { Auto, ForceUnauthorized, ForceAuthorized } PortControl;<br>
@@ -250,6 +251,9 @@ void eapol_sm_notify_ctrl_response(struct eapol_sm *sm);<br>
void eapol_sm_request_reauth(struct eapol_sm *sm);<br>
void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm, int in_eapol_sm);<br>
void eapol_sm_invalidate_cached_session(struct eapol_sm *sm);<br>
+Boolean eapol_sm_notify_eap_config(struct eapol_sm *sm,<br>
+ struct eap_config *config);<br>
+<br>
#else /* IEEE8021X_EAPOL */<br>
static inline struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)<br>
{<br>
@@ -337,6 +341,10 @@ static inline void<br>
eapol_sm_notify_lower_layer_success(struct eapol_sm *sm,<br>
static inline void eapol_sm_invalidate_cached_session(struct eapol_sm *sm)<br>
{<br>
}<br>
+static inline Boolean eapol_sm_notify_eap_config(struct eapol_sm *sm,<br>
+ struct eap_config *config)<br>
+{<br>
+}<br>
#endif /* IEEE8021X_EAPOL */<br>
<br>
#endif /* EAPOL_SUPP_SM_H */<br>
diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.c<br>
b/wpa_supplicant/ctrl_iface_dbus_handlers.c<br>
index 3c29804..a19e291 100644<br>
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.c<br>
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.c<br>
@@ -1205,6 +1205,7 @@ DBusMessage * wpas_dbus_iface_set_smartcard_modules(<br>
char *pkcs11_engine_path = NULL;<br>
char *pkcs11_module_path = NULL;<br>
struct wpa_dbus_dict_entry entry;<br>
+ struct eap_config conf;<br>
<br>
if (!dbus_message_iter_init(message, &iter))<br>
goto error;<br>
@@ -1244,13 +1245,17 @@ DBusMessage * wpas_dbus_iface_set_smartcard_modules(<br>
wpa_s->conf->pkcs11_engine_path = pkcs11_engine_path;<br>
os_free(wpa_s->conf->pkcs11_module_path);<br>
wpa_s->conf->pkcs11_module_path = pkcs11_module_path;<br>
-#endif /* EAP_TLS_OPENSSL */<br>
<br>
- eapol_sm_deinit(wpa_s->eapol);<br>
- wpa_supplicant_init_eapol(wpa_s);<br>
+ os_memset(&conf, 0, sizeof(conf));<br>
+ conf.opensc_engine_path = wpa_s->conf->opensc_engine_path;<br>
+ conf.pkcs11_engine_path = wpa_s->conf->pkcs11_engine_path;<br>
+ conf.pkcs11_module_path = wpa_s->conf->pkcs11_module_path;<br>
+ eapol_sm_notify_eap_config(wpa_s->eapol, &conf);<br>
+#endif /* EAP_TLS_OPENSSL */<br>
<br>
return wpas_dbus_new_success_reply(message);<br>
<br>
+<br>
error:<br>
os_free(opensc_engine_path);<br>
os_free(pkcs11_engine_path);<br>
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c<br>
index d23220d..b8aa289 100644<br>
--- a/wpa_supplicant/wpa_supplicant.c<br>
+++ b/wpa_supplicant/wpa_supplicant.c<br>
@@ -537,6 +537,7 @@ static void wpa_supplicant_clear_status(struct<br>
wpa_supplicant *wpa_s)<br>
int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)<br>
{<br>
struct wpa_config *conf;<br>
+ struct eap_config eap_conf;<br>
int reconf_ctrl;<br>
if (wpa_s->confname == NULL)<br>
return -1;<br>
@@ -559,10 +560,15 @@ int wpa_supplicant_reload_configuration(struct<br>
wpa_supplicant *wpa_s)<br>
<br>
eapol_sm_invalidate_cached_session(wpa_s->eapol);<br>
wpa_s->current_ssid = NULL;<br>
- /*<br>
- * TODO: should notify EAPOL SM about changes in opensc_engine_path,<br>
- * pkcs11_engine_path, pkcs11_module_path.<br>
- */<br>
+<br>
+ os_memset(&eap_conf, 0, sizeof(conf));<br>
+#ifdef EAP_TLS_OPENSSL<br>
+ eap_conf.opensc_engine_path = conf->opensc_engine_path;<br>
+ eap_conf.pkcs11_engine_path = conf->pkcs11_engine_path;<br>
+ eap_conf.pkcs11_module_path = conf->pkcs11_module_path;<br>
+#endif /* EAP_TLS_OPENSSL */<br>
+ eapol_sm_notify_eap_config(wpa_s->eapol, &eap_conf);<br>
+<br>
if (wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {<br>
/*<br>
* Clear forced success to clear EAP state for next<br>
<font color="#888888">--<br>
1.5.6.3<br>
<br>
</font></div>-- <br>- dds<br><br>