ikev1: Don't queue more than one mode config or XAuth task

At the time we reset an IKE_SA (e.g. when re-authenticating a not yet
established SA due to a roaming event) such tasks might already be queued
by one of the phase 1 tasks.  If the SA is initiated again another task will
get queued by the phase 1 task.  This results in e.g. multiple mode config
requests, which most gateways will have problems with.
This commit is contained in:
Tobias Brunner 2014-10-02 12:28:37 +02:00
parent 89e953797d
commit d4828f51e0

View File

@ -1593,13 +1593,6 @@ METHOD(task_manager_t, process_message, status_t,
return SUCCESS;
}
METHOD(task_manager_t, queue_task, void,
private_task_manager_t *this, task_t *task)
{
DBG2(DBG_IKE, "queueing %N task", task_type_names, task->get_type(task));
this->queued_tasks->insert_last(this->queued_tasks, task);
}
/**
* Check if a given task has been queued already
*/
@ -1622,6 +1615,28 @@ static bool has_queued(private_task_manager_t *this, task_type_t type)
return found;
}
METHOD(task_manager_t, queue_task, void,
private_task_manager_t *this, task_t *task)
{
task_type_t type = task->get_type(task);
switch (type)
{
case TASK_MODE_CONFIG:
case TASK_XAUTH:
if (has_queued(this, type))
{
task->destroy(task);
return;
}
break;
default:
break;
}
DBG2(DBG_IKE, "queueing %N task", task_type_names, task->get_type(task));
this->queued_tasks->insert_last(this->queued_tasks, task);
}
METHOD(task_manager_t, queue_ike, void,
private_task_manager_t *this)
{