consistent logging of IKE and CHILD SAs
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 21 Jul 2008 12:47:59 +0000 (12:47 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 21 Jul 2008 12:47:59 +0000 (12:47 -0000)
src/charon/kernel/kernel_interface.c
src/charon/sa/ike_sa.c
src/charon/sa/tasks/child_create.c
src/charon/sa/tasks/child_delete.c
src/charon/sa/tasks/ike_auth.c

index c403fb8..ea25bd1 100644 (file)
@@ -577,7 +577,7 @@ static void process_acquire(private_kernel_interface_t *this, struct nlmsghdr *h
                return;
        }
        DBG2(DBG_KNL, "received a XFRM_MSG_ACQUIRE");
-       DBG1(DBG_KNL, "creating acquire job for CHILD_SA with reqid %d", reqid);
+       DBG1(DBG_KNL, "creating acquire job for CHILD_SA with {reqid %d}", reqid);
        job = (job_t*)acquire_job_create(reqid);
        charon->processor->queue_job(charon->processor, job);
 }
@@ -601,12 +601,12 @@ static void process_expire(private_kernel_interface_t *this, struct nlmsghdr *hd
        
        if (protocol != PROTO_ESP && protocol != PROTO_AH)
        {
-               DBG2(DBG_KNL, "ignoring XFRM_MSG_EXPIRE for SA 0x%x (reqid %d) which is "
+               DBG2(DBG_KNL, "ignoring XFRM_MSG_EXPIRE for SA 0x%x {reqid %d} which is "
                                "not a CHILD_SA", ntohl(spi), reqid);
                return;
        }
        
-       DBG1(DBG_KNL, "creating %s job for %N CHILD_SA 0x%x (reqid %d)",
+       DBG1(DBG_KNL, "creating %s job for %N CHILD_SA 0x%x {reqid %d}",
                 expire->hard ? "delete" : "rekey",  protocol_id_names,
                 protocol, ntohl(spi), reqid);
        if (expire->hard)
index 04fb558..21bb2f2 100644 (file)
@@ -1176,7 +1176,7 @@ static status_t acquire(private_ike_sa_t *this, u_int32_t reqid)
        if (this->state == IKE_DELETING)
        {
                SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request");
-               SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA (reqid %d) failed: "
+               SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA {reqid %d} failed: "
                        "IKE_SA is deleting", reqid);
                return FAILED;
        }
@@ -1195,7 +1195,7 @@ static status_t acquire(private_ike_sa_t *this, u_int32_t reqid)
        if (!child_sa)
        {
                SIG_CHD(UP_START, NULL, "acquiring CHILD_SA on kernel request");
-               SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA (reqid %d) failed: "
+               SIG_CHD(UP_FAILED, NULL, "acquiring CHILD_SA {reqid %d} failed: "
                        "CHILD_SA not found", reqid);
                return FAILED;
        }
@@ -2037,7 +2037,7 @@ static status_t reestablish(private_ike_sa_t *this)
                        switch (action)
                        {
                                case ACTION_RESTART:
-                                       DBG1(DBG_IKE, "restarting CHILD_SA %s",
+                                       DBG1(DBG_IKE, "restarting CHILD_SA '%s'",
                                                 child_cfg->get_name(child_cfg));
                                        child_cfg->get_ref(child_cfg);
                                        status = new->initiate(new, child_cfg);
index 8c58b4e..743cf5b 100644 (file)
@@ -590,7 +590,8 @@ static status_t build_i(private_child_create_t *this, message_t *message)
                        break;
        }
        
-       SIG_CHD(UP_START, NULL, "establishing CHILD_SA");
+       SIG_CHD(UP_START, NULL, "establishing CHILD_SA '%s'",
+                       this->config->get_name(this->config));
        
        /* reuse virtual IP if we already have one */
        me = this->ike_sa->get_virtual_ip(this->ike_sa, TRUE);
@@ -861,8 +862,12 @@ static status_t build_r(private_child_create_t *this, message_t *message)
        
        build_payloads(this, message);
        
-       SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s' established successfully",
-                       this->child_sa->get_name(this->child_sa));
+       SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s{%d}' established "
+                       "with ts %#R=== %#R",
+                       this->child_sa->get_name(this->child_sa),
+                       this->child_sa->get_reqid(this->child_sa),
+                       this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
+                       this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
 
        return SUCCESS;
 }
@@ -969,8 +974,12 @@ static status_t process_i(private_child_create_t *this, message_t *message)
        
        if (select_and_install(this, no_dh) == SUCCESS)
        {
-               SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s' established "
-                               "successfully", this->child_sa->get_name(this->child_sa));
+               SIG_CHD(UP_SUCCESS, this->child_sa, "CHILD_SA '%s{%d}' established "
+                               "with ts %#R=== %#R",
+                               this->child_sa->get_name(this->child_sa),
+                               this->child_sa->get_reqid(this->child_sa),
+                               this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
+                               this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
        }
        else
        {
index 264650c..281f177 100644 (file)
@@ -207,9 +207,12 @@ static void log_children(private_child_delete_t *this)
        iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
        while (iterator->iterate(iterator, (void**)&child_sa))
        {
-               SIG_CHD(DOWN_START, child_sa, "closing CHILD_SA %#R=== %#R",
-                       child_sa->get_traffic_selectors(child_sa, TRUE),
-                       child_sa->get_traffic_selectors(child_sa, FALSE));
+               SIG_CHD(DOWN_START, child_sa, "closing CHILD_SA '%s{%d}' "
+                               "with ts %#R=== %#R",
+                               child_sa->get_name(child_sa),
+                               child_sa->get_reqid(child_sa),
+                               child_sa->get_traffic_selectors(child_sa, TRUE),
+                               child_sa->get_traffic_selectors(child_sa, FALSE));
        }
        iterator->destroy(iterator);
 }
index 003fd4b..d45da76 100644 (file)
@@ -377,12 +377,13 @@ static status_t build_auth_eap(private_ike_auth_t *this, message_t *message)
        if (!this->initiator)
        {
                this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
-               SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H",
+               SIG_IKE(UP_SUCCESS, "IKE_SA '%s[%d]' established between %H[%D]...%H[%D]",
                        this->ike_sa->get_name(this->ike_sa),
+                       this->ike_sa->get_unique_id(this->ike_sa),
                        this->ike_sa->get_my_host(this->ike_sa),
                        this->ike_sa->get_my_id(this->ike_sa), 
-                       this->ike_sa->get_other_id(this->ike_sa),
-                       this->ike_sa->get_other_host(this->ike_sa));
+                       this->ike_sa->get_other_host(this->ike_sa),
+                       this->ike_sa->get_other_id(this->ike_sa));
                return SUCCESS;
        }
        return NEED_MORE;
@@ -423,12 +424,13 @@ static status_t process_auth_eap(private_ike_auth_t *this, message_t *message)
        if (this->initiator)
        {
                this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
-               SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H",
+               SIG_IKE(UP_SUCCESS, "IKE_SA '%s[%d]' established between %H[%D]...%H[%D]",
                        this->ike_sa->get_name(this->ike_sa),
+                       this->ike_sa->get_unique_id(this->ike_sa),
                        this->ike_sa->get_my_host(this->ike_sa),
                        this->ike_sa->get_my_id(this->ike_sa), 
-                       this->ike_sa->get_other_id(this->ike_sa),
-                       this->ike_sa->get_other_host(this->ike_sa));
+                       this->ike_sa->get_other_host(this->ike_sa),
+                       this->ike_sa->get_other_id(this->ike_sa));
                return SUCCESS;
        }
        return NEED_MORE;
@@ -649,12 +651,13 @@ static status_t build_r(private_ike_auth_t *this, message_t *message)
        if (this->peer_authenticated)
        {
                this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
-               SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H",
+               SIG_IKE(UP_SUCCESS, "IKE_SA '%s[%d]' established between %H[%D]...%H[%D]",
                        this->ike_sa->get_name(this->ike_sa),
+                       this->ike_sa->get_unique_id(this->ike_sa),
                        this->ike_sa->get_my_host(this->ike_sa),
                        this->ike_sa->get_my_id(this->ike_sa), 
-                       this->ike_sa->get_other_id(this->ike_sa),
-                       this->ike_sa->get_other_host(this->ike_sa));
+                       this->ike_sa->get_other_host(this->ike_sa),
+                       this->ike_sa->get_other_id(this->ike_sa));
                return SUCCESS;
        }
        
@@ -762,12 +765,13 @@ static status_t process_i(private_ike_auth_t *this, message_t *message)
                return FAILED;
        }
        this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
-       SIG_IKE(UP_SUCCESS, "IKE_SA '%s' established between %H[%D]...[%D]%H",
+       SIG_IKE(UP_SUCCESS, "IKE_SA '%s[%d]' established between %H[%D]...%H[%D]",
                this->ike_sa->get_name(this->ike_sa),
+               this->ike_sa->get_unique_id(this->ike_sa),
                this->ike_sa->get_my_host(this->ike_sa),
                this->ike_sa->get_my_id(this->ike_sa),
-               this->ike_sa->get_other_id(this->ike_sa),
-               this->ike_sa->get_other_host(this->ike_sa));
+               this->ike_sa->get_other_host(this->ike_sa),
+               this->ike_sa->get_other_id(this->ike_sa));
        return SUCCESS;
 }