/*
- * Copyright (C) 2012-2018 Tobias Brunner
+ * Copyright (C) 2012-2019 Tobias Brunner
* Copyright (C) 2005-2009 Martin Willi
* Copyright (C) 2005 Jan Hutter
*
{
nonce_payload_t *nonce;
- /* get the nonce that was generated in ike_init */
+ /* get the nonce that was generated in ike_init and a copy of the complete
+ * packet */
nonce = (nonce_payload_t*)message->get_payload(message, PLV2_NONCE);
- if (!nonce)
+ if (!nonce || !message->is_encoded(message))
{
return FAILED;
}
this->my_nonce = nonce->get_nonce(nonce);
-
- /* pre-generate the message, keep a copy */
- if (this->ike_sa->generate_message(this->ike_sa, message,
- &this->my_packet) != SUCCESS)
- {
- return FAILED;
- }
+ this->my_packet = message->get_packet(message);
return NEED_MORE;
}
switch (message->get_exchange_type(message))
{
- case IKE_SA_INIT:
- return collect_my_init_data(this, message);
case IKE_AUTH:
if (!this->first_auth)
{ /* some special handling for the first IKE_AUTH message below */
return NEED_MORE;
}
+METHOD(task_t, post_build_i, status_t,
+ private_ike_auth_t *this, message_t *message)
+{
+ switch (message->get_exchange_type(message))
+ {
+ case IKE_SA_INIT:
+ return collect_my_init_data(this, message);
+ default:
+ return NEED_MORE;
+ }
+}
+
METHOD(task_t, process_r, status_t,
private_ike_auth_t *this, message_t *message)
{
message->add_notify(message, FALSE, MULTIPLE_AUTH_SUPPORTED,
chunk_empty);
}
- return collect_my_init_data(this, message);
+ return NEED_MORE;
case IKE_AUTH:
break;
default:
return FAILED;
}
+METHOD(task_t, post_build_r, status_t,
+ private_ike_auth_t *this, message_t *message)
+{
+ switch (message->get_exchange_type(message))
+ {
+ case IKE_SA_INIT:
+ return collect_my_init_data(this, message);
+ default:
+ return NEED_MORE;
+ }
+}
+
/**
* Send an INFORMATIONAL message with an AUTH_FAILED before closing IKE_SA
*/
.get_type = _get_type,
.migrate = _migrate,
.build = _build_r,
+ .post_build = _post_build_r,
.process = _process_r,
.destroy = _destroy,
},
if (initiator)
{
this->public.task.build = _build_i;
+ this->public.task.post_build = _post_build_i;
this->public.task.process = _process_i;
}
return &this->public;