eap-wsc: Rework state logic a bit
Mostly so repetitive code is not required
This commit is contained in:
parent
a4bf3f3280
commit
7810a45a9c
|
@ -355,12 +355,12 @@ static void eap_wsc_handle_request(struct eap_state *eap,
|
||||||
if (flags != 0)
|
if (flags != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (wsc->state) {
|
switch (op) {
|
||||||
case STATE_EXPECT_START:
|
case WSC_OP_START:
|
||||||
if (op != WSC_OP_START)
|
if (len != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (len != 2)
|
if (wsc->state != STATE_EXPECT_START)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pdu = wsc_build_m1(wsc->m1, &pdu_len);
|
pdu = wsc_build_m1(wsc->m1, &pdu_len);
|
||||||
|
@ -369,14 +369,28 @@ static void eap_wsc_handle_request(struct eap_state *eap,
|
||||||
|
|
||||||
eap_wsc_send_response(eap, pdu, pdu_len);
|
eap_wsc_send_response(eap, pdu, pdu_len);
|
||||||
wsc->state = STATE_EXPECT_M2;
|
wsc->state = STATE_EXPECT_M2;
|
||||||
break;
|
|
||||||
case STATE_EXPECT_M2:
|
|
||||||
if (op != WSC_OP_MSG)
|
|
||||||
return;
|
return;
|
||||||
|
case WSC_OP_NACK:
|
||||||
|
/* TODO: Process NACK and respond with NACK */
|
||||||
|
return;
|
||||||
|
case WSC_OP_ACK:
|
||||||
|
case WSC_OP_DONE:
|
||||||
|
/* Should never receive these as Enrollee */
|
||||||
|
return;
|
||||||
|
case WSC_OP_FRAG_ACK:
|
||||||
|
/* TODO: Handle fragmentation */
|
||||||
|
return;
|
||||||
|
case WSC_OP_MSG:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (len <= 2)
|
if (len <= 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
switch (wsc->state) {
|
||||||
|
case STATE_EXPECT_START:
|
||||||
|
return;
|
||||||
|
case STATE_EXPECT_M2:
|
||||||
eap_wsc_handle_m2(eap, pkt + 2, len - 2);
|
eap_wsc_handle_m2(eap, pkt + 2, len - 2);
|
||||||
break;
|
break;
|
||||||
case STATE_EXPECT_M4:
|
case STATE_EXPECT_M4:
|
||||||
|
|
Loading…
Reference in New Issue