Improved check for first IKE_AUTH message in ike_mobike task.
authorTobias Brunner <tobias@strongswan.org>
Tue, 5 Oct 2010 14:42:39 +0000 (16:42 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 12 Oct 2010 09:11:05 +0000 (11:11 +0200)
If the original responder initiated a MOBIKE exchange, the previous
check was not always correct.

src/libcharon/sa/tasks/ike_mobike.c

index 91f8e68..3b1fbb0 100644 (file)
@@ -342,7 +342,8 @@ METHOD(ike_mobike_t, transmit, void,
 METHOD(task_t, build_i, status_t,
           private_ike_mobike_t *this, message_t *message)
 {
-       if (message->get_message_id(message) == 1)
+       if (message->get_exchange_type(message) == IKE_AUTH &&
+               message->get_message_id(message) == 1)
        {       /* only in first IKE_AUTH */
                message->add_notify(message, FALSE, MOBIKE_SUPPORTED, chunk_empty);
                build_address_list(this, message);
@@ -369,7 +370,8 @@ METHOD(task_t, build_i, status_t,
                }
                if (this->update)
                {
-                       message->add_notify(message, FALSE, UPDATE_SA_ADDRESSES, chunk_empty);
+                       message->add_notify(message, FALSE, UPDATE_SA_ADDRESSES,
+                                                               chunk_empty);
                        build_cookie(this, message);
                        update_children(this);
                }
@@ -388,7 +390,8 @@ METHOD(task_t, build_i, status_t,
 METHOD(task_t, process_r, status_t,
           private_ike_mobike_t *this, message_t *message)
 {
-       if (message->get_message_id(message) == 1)
+       if (message->get_exchange_type(message) == IKE_AUTH &&
+               message->get_message_id(message) == 1)
        {       /* only first IKE_AUTH */
                process_payloads(this, message);
        }