From 0ee6885dae0481e3b111b74a3285bbddb7067c0d Mon Sep 17 00:00:00 2001 From: leiwei Date: Fri, 24 May 2019 16:53:32 +0800 Subject: [PATCH] macsec: Store EAP-Key-Name as eapSessionId Signed-off-by: leiwei --- src/ap/ieee802_1x.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index 7854f6fc3..3bab8d0ca 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -1407,6 +1407,8 @@ static void ieee802_1x_get_keys(struct hostapd_data *hapd, size_t shared_secret_len) { struct radius_ms_mppe_keys *keys; + u8 *buf; + size_t len; struct eapol_state_machine *sm = sta->eapol_sm; if (sm == NULL) return; @@ -1443,6 +1445,20 @@ static void ieee802_1x_get_keys(struct hostapd_data *hapd, os_free(keys->recv); os_free(keys); } + + if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_EAP_KEY_NAME, &buf, &len, + NULL) == 0) { + os_free(sm->eap_if->eapSessionId); + sm->eap_if->eapSessionId = os_memdup(buf, len); + if (sm->eap_if->eapSessionId) { + sm->eap_if->eapSessionIdLen = len; + wpa_hexdump(MSG_DEBUG, "EAP-Key Name", + sm->eap_if->eapSessionId, + sm->eap_if->eapSessionIdLen); + } + } else { + sm->eap_if->eapSessionIdLen = 0; + } }