aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/sa/task_manager.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-03-15 15:20:09 +0100
committerMartin Willi <martin@revosec.ch>2011-03-15 15:20:09 +0100
commit3ced6b51e462201c32954ae9cb23449a377be3fa (patch)
tree82a50c1d93c4297cde095db4a7e8b14ed866ea5c /src/libcharon/sa/task_manager.c
parentf42156a8c8f4d24927f397951b121aea5ce027f4 (diff)
downloadstrongswan-3ced6b51e462201c32954ae9cb23449a377be3fa.tar.bz2
strongswan-3ced6b51e462201c32954ae9cb23449a377be3fa.tar.xz
Move establish/inherit of rekeyed IKE_SAs to delete messages
Having the inherit() function delayed to the IKE_SA establish procedure was problematic. The task destroy function was never a good place and results in locking/cleanup problems. After establishing the SA, it should be really checked in ASAP to avoid any triggered DPD checks to get lost.
Diffstat (limited to 'src/libcharon/sa/task_manager.c')
-rw-r--r--src/libcharon/sa/task_manager.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libcharon/sa/task_manager.c b/src/libcharon/sa/task_manager.c
index 7b1fef2b7..f07d2e384 100644
--- a/src/libcharon/sa/task_manager.c
+++ b/src/libcharon/sa/task_manager.c
@@ -545,7 +545,7 @@ static status_t process_response(private_task_manager_t *this,
/**
* handle exchange collisions
*/
-static void handle_collisions(private_task_manager_t *this, task_t *task)
+static bool handle_collisions(private_task_manager_t *this, task_t *task)
{
iterator_t *iterator;
task_t *active;
@@ -584,12 +584,11 @@ static void handle_collisions(private_task_manager_t *this, task_t *task)
continue;
}
iterator->destroy(iterator);
- return;
+ return TRUE;
}
iterator->destroy(iterator);
}
- /* destroy task if not registered in any active task */
- task->destroy(task);
+ return FALSE;
}
/**
@@ -623,9 +622,17 @@ static status_t build_response(private_task_manager_t *this, message_t *request)
case SUCCESS:
/* task completed, remove it */
iterator->remove(iterator);
- handle_collisions(this, task);
+ if (!handle_collisions(this, task))
+ {
+ task->destroy(task);
+ }
+ break;
case NEED_MORE:
/* processed, but task needs another exchange */
+ if (handle_collisions(this, task))
+ {
+ iterator->remove(iterator);
+ }
break;
case FAILED:
default: