aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer/eap_tlv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eap_peer/eap_tlv.c')
-rw-r--r--src/eap_peer/eap_tlv.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/eap_peer/eap_tlv.c b/src/eap_peer/eap_tlv.c
index 33f7b75..e2b9483 100644
--- a/src/eap_peer/eap_tlv.c
+++ b/src/eap_peer/eap_tlv.c
@@ -1,6 +1,6 @@
/*
* EAP peer method: EAP-TLV (draft-josefsson-pppext-eap-tls-eap-07.txt)
- * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -85,10 +85,12 @@ struct wpabuf * eap_tlv_build_result(int id, u16 status)
* field should be initialized to %NULL before the call. The value will be
* updated if a response message is generated. The caller is responsible for
* freeing the allocated message.
+ * @force_failure: Force negotiation to fail
* Returns: 0 on success, -1 on failure
*/
int eap_tlv_process(struct eap_sm *sm, struct eap_method_ret *ret,
- const struct wpabuf *req, struct wpabuf **resp)
+ const struct wpabuf *req, struct wpabuf **resp,
+ int force_failure)
{
size_t left, tlv_len;
const u8 *pos;
@@ -159,8 +161,15 @@ int eap_tlv_process(struct eap_sm *sm, struct eap_method_ret *ret,
if (status == EAP_TLV_RESULT_SUCCESS) {
wpa_printf(MSG_INFO, "EAP-TLV: TLV Result - Success "
"- EAP-TLV/Phase2 Completed");
- resp_status = EAP_TLV_RESULT_SUCCESS;
- ret->decision = DECISION_UNCOND_SUCC;
+ if (force_failure) {
+ wpa_printf(MSG_INFO, "EAP-TLV: Earlier failure"
+ " - force failed Phase 2");
+ resp_status = EAP_TLV_RESULT_FAILURE;
+ ret->decision = DECISION_FAIL;
+ } else {
+ resp_status = EAP_TLV_RESULT_SUCCESS;
+ ret->decision = DECISION_UNCOND_SUCC;
+ }
} else if (status == EAP_TLV_RESULT_FAILURE) {
wpa_printf(MSG_INFO, "EAP-TLV: TLV Result - Failure");
resp_status = EAP_TLV_RESULT_FAILURE;