3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 06:02:37 +01:00

eap-wsc: implement NACK sending

This commit is contained in:
Denis Kenzior 2016-09-09 12:44:23 -05:00
parent e48220c7a6
commit d2d9ce7be5

View File

@ -316,6 +316,12 @@ static void eap_wsc_send_response(struct eap_state *eap,
static void eap_wsc_send_nack(struct eap_state *eap,
enum wsc_configuration_error error)
{
struct eap_wsc_state *wsc = eap_get_data(eap);
struct wsc_nack nack;
uint8_t *pdu;
size_t pdu_len;
uint8_t buf[256];
/*
* WSC 2.0.5, Table 34, Configuration Error 0 states:
* "- not valid for WSC_NACK except when a station acts as an External
@ -337,6 +343,29 @@ static void eap_wsc_send_nack(struct eap_state *eap,
*/
if (error == WSC_CONFIGURATION_ERROR_NO_ERROR)
return;
nack.version2 = true;
memcpy(nack.enrollee_nonce, wsc->m1->enrollee_nonce,
sizeof(nack.enrollee_nonce));
if (wsc->m2)
memcpy(nack.registrar_nonce, wsc->m2->registrar_nonce,
sizeof(nack.registrar_nonce));
else
memset(nack.registrar_nonce, 0, sizeof(nack.registrar_nonce));
nack.configuration_error = error;
pdu = wsc_build_wsc_nack(&nack, &pdu_len);
if (!pdu)
return;
buf[12] = WSC_OP_NACK;
buf[13] = 0;
memcpy(buf + 14, pdu, pdu_len);
eap_send_response(eap, EAP_TYPE_EXPANDED, buf, pdu_len + 14);
l_free(pdu);
}
static void eap_wsc_send_done(struct eap_state *eap)