diff options
author | Martin Willi <martin@revosec.ch> | 2012-05-21 14:48:48 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-05-21 14:57:33 +0200 |
commit | 4ce92ef350d535ce43b79786e4260dbd2672e6e3 (patch) | |
tree | 553304549e5353e56f14ac5577d961016315d760 /src | |
parent | 7ce504e182c1ce1cde7c80e7dfe2a70b3e5dbed4 (diff) | |
download | strongswan-4ce92ef350d535ce43b79786e4260dbd2672e6e3.tar.bz2 strongswan-4ce92ef350d535ce43b79786e4260dbd2672e6e3.tar.xz |
Cancel active quick mode task when receiving INFORMATIONAL error
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/sa/ikev1/tasks/informational.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libcharon/sa/ikev1/tasks/informational.c b/src/libcharon/sa/ikev1/tasks/informational.c index 266d47fa9..8228d016a 100644 --- a/src/libcharon/sa/ikev1/tasks/informational.c +++ b/src/libcharon/sa/ikev1/tasks/informational.c @@ -49,6 +49,27 @@ struct private_informational_t { task_t *del; }; +/** + * Cancel active quick mode after receiving an error + */ +static void cancel_quick_mode(private_informational_t *this) +{ + enumerator_t *enumerator; + task_t *task; + + enumerator = this->ike_sa->create_task_enumerator(this->ike_sa, + TASK_QUEUE_ACTIVE); + while (enumerator->enumerate(enumerator, &task)) + { + if (task->get_type(task) == TASK_QUICK_MODE) + { + this->ike_sa->flush_queue(this->ike_sa, TASK_QUEUE_ACTIVE); + break; + } + } + enumerator->destroy(enumerator); +} + METHOD(task_t, build_i, status_t, private_informational_t *this, message_t *message) { @@ -114,6 +135,15 @@ METHOD(task_t, process_r, status_t, { /* only critical during main mode */ status = FAILED; } + switch (type) + { + case INVALID_ID_INFORMATION: + case NO_PROPOSAL_CHOSEN: + cancel_quick_mode(this); + break; + default: + break; + } break; } else |