child-create: Don't log CHILD_SA initiation until we know the unique ID
[strongswan.git] / src / libcharon / sa / ikev2 / tasks / child_create.c
index 9fe6929..cac3bc0 100644 (file)
@@ -1022,17 +1022,6 @@ METHOD(task_t, build_i, status_t,
                        break;
        }
 
-       if (this->reqid)
-       {
-               DBG0(DBG_IKE, "establishing CHILD_SA %s{%d}",
-                        this->config->get_name(this->config), this->reqid);
-       }
-       else
-       {
-               DBG0(DBG_IKE, "establishing CHILD_SA %s",
-                        this->config->get_name(this->config));
-       }
-
        /* check if we want a virtual IP, but don't have one */
        list = linked_list_create();
        peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa);
@@ -1085,6 +1074,19 @@ METHOD(task_t, build_i, status_t,
                        this->ike_sa->has_condition(this->ike_sa, COND_NAT_ANY),
                        this->mark_in, this->mark_out);
 
+       if (this->reqid)
+       {
+               DBG0(DBG_IKE, "establishing CHILD_SA %s{%d} reqid %d",
+                        this->child_sa->get_name(this->child_sa),
+                        this->child_sa->get_unique_id(this->child_sa), this->reqid);
+       }
+       else
+       {
+               DBG0(DBG_IKE, "establishing CHILD_SA %s{%d}",
+                        this->child_sa->get_name(this->child_sa),
+                        this->child_sa->get_unique_id(this->child_sa));
+       }
+
        if (!allocate_spi(this))
        {
                DBG1(DBG_IKE, "unable to allocate SPIs from kernel");