return 0;
}
+METHOD(eap_payload_t, is_expanded, bool,
+ private_eap_payload_t *this)
+{
+ return this->data.len > 4 ? this->data.ptr[4] == EAP_EXPANDED : FALSE;
+}
+
METHOD2(payload_t, eap_payload_t, destroy, void,
private_eap_payload_t *this)
{
.get_code = _get_code,
.get_identifier = _get_identifier,
.get_type = _get_type,
+ .is_expanded = _is_expanded,
.destroy = _destroy,
},
.next_payload = NO_PAYLOAD,
eap_type_t (*get_type) (eap_payload_t *this, u_int32_t *vendor);
/**
+ * Check if the EAP method type is encoded in the Expanded Type format.
+ *
+ * @return TRUE if in Expanded Type format
+ */
+ bool (*is_expanded) (eap_payload_t *this);
+
+ /**
* Destroys an eap_payload_t object.
*/
void (*destroy) (eap_payload_t *this);
* @param identifier EAP identifier to use in payload
* @param type preferred auth type, 0 to send all supported types
* @param vendor vendor identifier for auth type, 0 for default
- * @param expanded TRUE to send an expanded Nak (as response to an expanded
- * request, i.e. one with vendor specific type)
+ * @param expanded TRUE to send an expanded Nak
* @return eap_payload_t object
*/
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
{
DBG1(DBG_IKE, "EAP method not supported");
this->out = eap_payload_create_nak(in->get_identifier(in), 0, 0,
- received_vendor != 0);
+ in->is_expanded(in));
in->destroy(in);
return NEED_MORE;
}
{
DBG1(DBG_IKE, "EAP method not supported");
this->out = eap_payload_create_nak(in->get_identifier(in), 0, 0,
- received_vendor != 0);
+ in->is_expanded(in));
in->destroy(in);
return NEED_MORE;
}
eap_type_names, conf_type);
}
return eap_payload_create_nak(in->get_identifier(in), conf_type,
- conf_vendor, vendor != 0);
+ conf_vendor, in->is_expanded(in));
}
this->method = load_method(this, type, vendor, EAP_PEER);
if (!this->method)
{
DBG1(DBG_IKE, "EAP method not supported, sending EAP_NAK");
return eap_payload_create_nak(in->get_identifier(in), 0, 0,
- vendor != 0);
+ in->is_expanded(in));
}
}