Invoke message hook before generation, allowing plugins to mangle it
authorMartin Willi <martin@strongswan.org>
Mon, 2 Nov 2009 09:44:11 +0000 (10:44 +0100)
committerMartin Willi <martin@strongswan.org>
Thu, 12 Nov 2009 13:37:06 +0000 (13:37 +0000)
src/charon/sa/task_manager.c

index d12b291..3fac125 100644 (file)
@@ -454,6 +454,7 @@ static status_t build_request(private_task_manager_t *this)
        /* update exchange type if a task changed it */
        this->initiating.type = message->get_exchange_type(message);
 
+       charon->bus->message(charon->bus, message, FALSE);
        status = this->ike_sa->generate_message(this->ike_sa, message,
                                                                                        &this->initiating.packet);
        if (status != SUCCESS)
@@ -465,8 +466,6 @@ static status_t build_request(private_task_manager_t *this)
                charon->bus->ike_updown(charon->bus, this->ike_sa, FALSE);
                return DESTROY_ME;
        }
-
-       charon->bus->message(charon->bus, message, FALSE);
        message->destroy(message);
 
        return retransmit(this, this->initiating.mid);
@@ -644,9 +643,9 @@ static status_t build_response(private_task_manager_t *this, message_t *request)
        /* message complete, send it */
        DESTROY_IF(this->responding.packet);
        this->responding.packet = NULL;
+       charon->bus->message(charon->bus, message, FALSE);
        status = this->ike_sa->generate_message(this->ike_sa, message,
                                                                                        &this->responding.packet);
-       charon->bus->message(charon->bus, message, FALSE);
        message->destroy(message);
        if (status != SUCCESS)
        {