Add eap_session_id to wpa_supplicant STATUS output

This makes the current EAP Session-Id available for external programs.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-01-27 16:14:40 +02:00 committed by Jouni Malinen
parent f19c907822
commit 993a865407
2 changed files with 25 additions and 0 deletions

View file

@ -380,6 +380,11 @@ static inline int eapol_sm_get_key(struct eapol_sm *sm, u8 *key, size_t len)
{
return -1;
}
static inline const u8 *
eapol_sm_get_session_id(struct eapol_sm *sm, size_t *len)
{
return NULL;
}
static inline void eapol_sm_notify_logoff(struct eapol_sm *sm, Boolean logoff)
{
}

View file

@ -1701,6 +1701,8 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_HS20
const u8 *hs20;
#endif /* CONFIG_HS20 */
const u8 *sess_id;
size_t sess_id_len;
if (os_strcmp(params, "-DRIVER") == 0)
return wpa_drv_status(wpa_s, buf, buflen);
@ -1933,6 +1935,24 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
pos += res;
}
sess_id = eapol_sm_get_session_id(wpa_s->eapol, &sess_id_len);
if (sess_id) {
char *start = pos;
ret = os_snprintf(pos, end - pos, "eap_session_id=");
if (os_snprintf_error(end - pos, ret))
return start - buf;
pos += ret;
ret = wpa_snprintf_hex(pos, end - pos, sess_id, sess_id_len);
if (ret <= 0)
return start - buf;
pos += ret;
ret = os_snprintf(pos, end - pos, "\n");
if (os_snprintf_error(end - pos, ret))
return start - buf;
pos += ret;
}
res = rsn_preauth_get_status(wpa_s->wpa, pos, end - pos, verbose);
if (res >= 0)
pos += res;