struct eap_tnc_data {
- enum { WAIT_START, MSG, WAIT_FRAG_ACK, DONE, FAIL } state;
+ enum { WAIT_START, PROC_MSG, WAIT_FRAG_ACK, DONE, FAIL } state;
struct tncc_data *tncc;
struct wpabuf *in_buf;
struct wpabuf *out_buf;
{
struct wpabuf *msg;
- msg = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_TNC, 0, code, id);
+ msg = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_TNC, 1, code, id);
if (msg == NULL) {
wpa_printf(MSG_ERROR, "EAP-TNC: Failed to allocate memory "
"for fragment ack");
return NULL;
}
+ wpabuf_put_u8(msg, EAP_TNC_VERSION); /* Flags */
wpa_printf(MSG_DEBUG, "EAP-TNC: Send fragment ack");
"Message Length %u", flags, message_length);
if (data->state == WAIT_FRAG_ACK) {
- if (len != 0) {
+ if (len > 1) {
wpa_printf(MSG_DEBUG, "EAP-TNC: Unexpected payload in "
"WAIT_FRAG_ACK state");
ret->ignore = TRUE;
return NULL;
}
wpa_printf(MSG_DEBUG, "EAP-TNC: Fragment acknowledged");
- data->state = MSG;
+ data->state = PROC_MSG;
return eap_tnc_build_msg(data, ret, id);
}
wpa_printf(MSG_DEBUG, "EAP-TNC: Server did not use "
"start flag in the first message");
ret->ignore = TRUE;
- return NULL;
+ goto fail;
}
tncc_init_connection(data->tncc);
- data->state = MSG;
+ data->state = PROC_MSG;
} else {
enum tncc_process_res res;
wpa_printf(MSG_DEBUG, "EAP-TNC: Server used start "
"flag again");
ret->ignore = TRUE;
- return NULL;
+ goto fail;
}
res = tncc_process_if_tnccs(data->tncc,
switch (res) {
case TNCCS_PROCESS_ERROR:
ret->ignore = TRUE;
- return NULL;
+ goto fail;
case TNCCS_PROCESS_OK_NO_RECOMMENDATION:
case TNCCS_RECOMMENDATION_ERROR:
wpa_printf(MSG_DEBUG, "EAP-TNC: No "
ret->allowNotifications = TRUE;
if (data->out_buf) {
- data->state = MSG;
+ data->state = PROC_MSG;
return eap_tnc_build_msg(data, ret, id);
}
wpabuf_head(resp), wpabuf_len(resp));
data->out_buf = resp;
- data->state = MSG;
+ data->state = PROC_MSG;
return eap_tnc_build_msg(data, ret, id);
+
+fail:
+ if (data->in_buf == &tmpbuf)
+ data->in_buf = NULL;
+ return NULL;
}