[PATCH 1/4] eap_peer: Add method to return current method name

Paul Stewart pstew at google.com
Thu Mar 10 13:59:57 EST 2011


If there is an active EAP method, return its name

Signed-off-by: Paul Stewart <pstew at google.com>
---
 src/eap_peer/eap.c |    7 +++++++
 src/eap_peer/eap.h |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index 330164a..8a9826f 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -1554,6 +1554,13 @@ static void eap_sm_request(struct eap_sm *sm, eap_ctrl_req_type type,
 #define eap_sm_request(sm, type, msg, msglen) do { } while (0)
 #endif /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */
 
+const char * eap_sm_get_method_name(struct eap_sm *sm)
+{
+	if (sm->m == NULL)
+		return "UNKNOWN";
+	return sm->m->name;
+}
+
 
 /**
  * eap_sm_request_identity - Request identity from user (ctrl_iface)
diff --git a/src/eap_peer/eap.h b/src/eap_peer/eap.h
index 40d0b69..3550909 100644
--- a/src/eap_peer/eap.h
+++ b/src/eap_peer/eap.h
@@ -261,6 +261,7 @@ int eap_peer_sm_step(struct eap_sm *sm);
 void eap_sm_abort(struct eap_sm *sm);
 int eap_sm_get_status(struct eap_sm *sm, char *buf, size_t buflen,
 		      int verbose);
+const char * eap_sm_get_method_name(struct eap_sm *sm);
 struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted);
 void eap_sm_request_identity(struct eap_sm *sm);
 void eap_sm_request_password(struct eap_sm *sm);
-- 
1.7.3.1



More information about the HostAP mailing list