aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2015-09-28 17:33:46 +0200
committerTobias Brunner <tobias@strongswan.org>2015-10-30 10:27:09 +0100
commit3f56f73159d1e53004358f3f02d1a0c2fd67839f (patch)
treeeb5a2de2799c7b63294641dce8b87b2922cb90f4 /src
parentb0b0c9137d7bfd7afe54f64e49bc45d317a8e101 (diff)
downloadstrongswan-3f56f73159d1e53004358f3f02d1a0c2fd67839f.tar.bz2
strongswan-3f56f73159d1e53004358f3f02d1a0c2fd67839f.tar.xz
ikev1: Extract queueing of TRANSACTIONAL requests when MM is not complete yet
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/sa/ikev1/task_manager_v1.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/libcharon/sa/ikev1/task_manager_v1.c b/src/libcharon/sa/ikev1/task_manager_v1.c
index 1a6f868dd..0b329e03a 100644
--- a/src/libcharon/sa/ikev1/task_manager_v1.c
+++ b/src/libcharon/sa/ikev1/task_manager_v1.c
@@ -1262,6 +1262,29 @@ static status_t parse_message(private_task_manager_t *this, message_t *msg)
return status;
}
+/**
+ * Queue the given message if possible
+ */
+static status_t queue_message(private_task_manager_t *this, message_t *msg)
+{
+ if (this->queued)
+ {
+ DBG1(DBG_IKE, "ignoring %N request, queue full",
+ exchange_type_names, msg->get_exchange_type(msg));
+ return FAILED;
+ }
+ this->queued = message_create_from_packet(msg->get_packet(msg));
+ if (this->queued->parse_header(this->queued) != SUCCESS)
+ {
+ this->queued->destroy(this->queued);
+ this->queued = NULL;
+ return FAILED;
+ }
+ DBG1(DBG_IKE, "queueing %N request as tasks still active",
+ exchange_type_names, msg->get_exchange_type(msg));
+ return SUCCESS;
+}
+
METHOD(task_manager_t, process_message, status_t,
private_task_manager_t *this, message_t *msg)
{
@@ -1372,25 +1395,12 @@ METHOD(task_manager_t, process_message, status_t,
return FAILED;
}
+ /* queue XAuth/Mode Config messages unless the Main Mode exchange we
+ * initiated is complete */
if (msg->get_exchange_type(msg) == TRANSACTION &&
this->active_tasks->get_count(this->active_tasks))
- { /* main mode not yet complete, queue XAuth/Mode config tasks */
- if (this->queued)
- {
- DBG1(DBG_IKE, "ignoring additional %N request, queue full",
- exchange_type_names, TRANSACTION);
- return SUCCESS;
- }
- this->queued = message_create_from_packet(msg->get_packet(msg));
- if (this->queued->parse_header(this->queued) != SUCCESS)
- {
- this->queued->destroy(this->queued);
- this->queued = NULL;
- return FAILED;
- }
- DBG1(DBG_IKE, "queueing %N request as tasks still active",
- exchange_type_names, TRANSACTION);
- return SUCCESS;
+ {
+ return queue_message(this, msg);
}
msg->set_request(msg, TRUE);