ikev2: use protocol of selected proposal to delete a failed CHILD_SA
authorMartin Willi <martin@revosec.ch>
Thu, 20 Jun 2013 10:05:13 +0000 (12:05 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 20 Jun 2013 10:09:46 +0000 (12:09 +0200)
Depending on the failure, the protocol might not yet be set on the CHILD_SA.

src/libcharon/sa/ikev2/tasks/child_create.c

index 3e5dcc8..dd3813e 100644 (file)
@@ -1284,13 +1284,13 @@ METHOD(task_t, build_i_delete, status_t,
        private_child_create_t *this, message_t *message)
 {
        message->set_exchange_type(message, INFORMATIONAL);
-       if (this->child_sa)
+       if (this->child_sa && this->proposal)
        {
                protocol_id_t proto;
                delete_payload_t *del;
                u_int32_t spi;
 
-               proto = this->child_sa->get_protocol(this->child_sa);
+               proto = this->proposal->get_protocol(this->proposal);
                spi = this->child_sa->get_spi(this->child_sa, TRUE);
                del = delete_payload_create(DELETE, proto);
                del->add_spi(del, spi);