Check if colliding task has actually a CHILD, i.e. after a migrate
[strongswan.git] / src / libcharon / sa / tasks / child_rekey.c
index e74ca4e..05db057 100644 (file)
@@ -252,7 +252,10 @@ static child_sa_t *handle_collision(private_child_rekey_t *this)
                        {
                                /* disable close action for the redundand child */
                                child_sa = other->child_create->get_child(other->child_create);
-                               child_sa->set_close_action(child_sa, ACTION_NONE);
+                               if (child_sa)
+                               {
+                                       child_sa->set_close_action(child_sa, ACTION_NONE);
+                               }
                        }
                }
                else
@@ -382,7 +385,7 @@ static void collide(private_child_rekey_t *this, task_t *other)
        if (other->get_type(other) == CHILD_REKEY)
        {
                private_child_rekey_t *rekey = (private_child_rekey_t*)other;
-               if (rekey == NULL || rekey->child_sa != this->child_sa)
+               if (rekey->child_sa != this->child_sa)
                {
                        /* not the same child => no collision */
                        other->destroy(other);
@@ -399,7 +402,7 @@ static void collide(private_child_rekey_t *this, task_t *other)
                        other->destroy(other);
                        return;
                }
-               if (del == NULL || del->get_child(del) != this->child_sa)
+               if (del->get_child(del) != this->child_sa)
                {
                        /* not the same child => no collision */
                        other->destroy(other);
@@ -412,6 +415,8 @@ static void collide(private_child_rekey_t *this, task_t *other)
                other->destroy(other);
                return;
        }
+       DBG1(DBG_IKE, "detected %N collision with %N", task_type_names, CHILD_REKEY,
+                task_type_names, other->get_type(other));
        DESTROY_IF(this->collision);
        this->collision = other;
 }