ikev1: Avoid fourth QM message if third QM messages of multiple exchanges are handled...
authorTobias Brunner <tobias@strongswan.org>
Wed, 7 Oct 2015 14:08:22 +0000 (16:08 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 29 Oct 2015 15:03:15 +0000 (16:03 +0100)
If we haven't received the third QM message for multiple exchanges the
return value of NEED_MORE for passive tasks that are not responsible for
a specific exchange would trigger a fourth empty QM message.

Fixes: 4de361d92c54 ("ikev1: Fix handling of overlapping Quick Mode exchanges")

References #1076.

src/libcharon/sa/ikev1/task_manager_v1.c
src/libcharon/sa/ikev1/tasks/quick_mode.c

index 678f99d..e1747d2 100644 (file)
@@ -752,6 +752,12 @@ static status_t build_response(private_task_manager_t *this, message_t *request)
                        case ALREADY_DONE:
                                cancelled = TRUE;
                                break;
+                       case INVALID_ARG:
+                               if (task->get_type(task) == TASK_QUICK_MODE)
+                               {       /* not responsible for this exchange */
+                                       continue;
+                               }
+                               /* FALL */
                        case FAILED:
                        default:
                                charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
@@ -1034,6 +1040,12 @@ static status_t process_request(private_task_manager_t *this,
                        case ALREADY_DONE:
                                send_response = FALSE;
                                break;
+                       case INVALID_ARG:
+                               if (task->get_type(task) == TASK_QUICK_MODE)
+                               {       /* not responsible for this exchange */
+                                       continue;
+                               }
+                               /* FALL */
                        case FAILED:
                        default:
                                charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
index d6a3f2c..45eb7f0 100644 (file)
@@ -1026,7 +1026,7 @@ METHOD(task_t, process_r, status_t,
 {
        if (this->mid && this->mid != message->get_message_id(message))
        {       /* not responsible for this quick mode exchange */
-               return NEED_MORE;
+               return INVALID_ARG;
        }
 
        switch (this->state)
@@ -1200,7 +1200,7 @@ METHOD(task_t, build_r, status_t,
 {
        if (this->mid && this->mid != message->get_message_id(message))
        {       /* not responsible for this quick mode exchange */
-               return NEED_MORE;
+               return INVALID_ARG;
        }
 
        switch (this->state)