]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_supplicant: Add wpa_supplicant_get_eap_mode method
authorPaul Stewart <pstew@google.com>
Tue, 15 Mar 2011 11:53:08 +0000 (13:53 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 15 Mar 2011 11:53:08 +0000 (13:53 +0200)
Signed-off-by: Paul Stewart <pstew@google.com>
src/eapol_supp/eapol_supp_sm.h
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 22897de5dba0aa19582aff9cf863e58af98f0591..1bdf8cdd4f1199ee670730b6029e551365008024 100644 (file)
@@ -343,6 +343,10 @@ static inline void eapol_sm_notify_lower_layer_success(struct eapol_sm *sm,
 static inline void eapol_sm_invalidate_cached_session(struct eapol_sm *sm)
 {
 }
+static inline const char * eapol_sm_get_method_name(struct eapol_sm *sm)
+{
+       return NULL;
+}
 #endif /* IEEE8021X_EAPOL */
 
 #endif /* EAPOL_SUPP_SM_H */
index 60cda697f703ac20580d62aadb0d5a9380ec861b..d3342276b899d1b2291a3fc6481a2b4a4fe738bd 100644 (file)
@@ -2330,6 +2330,28 @@ int wpa_supplicant_remove_iface(struct wpa_global *global,
 }
 
 
+/**
+ * wpa_supplicant_get_eap_mode - Get the current EAP mode
+ * @wpa_s: Pointer to the network interface
+ * Returns: Pointer to the eap mode or the string "UNKNOWN" if not found
+ */
+const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s)
+{
+       const char *eapol_method;
+
+        if (wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt) == 0 &&
+            wpa_s->key_mgmt != WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
+               return "NO-EAP";
+       }
+
+       eapol_method = eapol_sm_get_method_name(wpa_s->eapol);
+       if (eapol_method == NULL)
+               return "UNKNOWN-EAP";
+
+       return eapol_method;
+}
+
+
 /**
  * wpa_supplicant_get_iface - Get a new network interface
  * @global: Pointer to global data from wpa_supplicant_init()
index 42020cd011cb90b61a28ed4b0a6e8061f1db2147..056ffa01601a923abcbbb6852cf47e43c1c1d89f 100644 (file)
@@ -575,6 +575,7 @@ void wpa_supplicant_req_auth_timeout(struct wpa_supplicant *wpa_s,
 void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
                              enum wpa_states state);
 struct wpa_ssid * wpa_supplicant_get_ssid(struct wpa_supplicant *wpa_s);
+const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
                                   int reason_code);