u_int32_t hard_lifetime;
/**
- * reqid of a CHILD_SA which rekeyed this one
+ * has this CHILD_SA been rekeyed?
*/
- u_int32_t rekeyed;
+ bool rekeyed;
/**
* CHILD_SAs own logger
/**
* Implementation of child_sa_t.set_rekeyed.
*/
-static void set_rekeyed(private_child_sa_t *this, u_int32_t reqid)
+static void set_rekeyed(private_child_sa_t *this)
{
- this->rekeyed = reqid;
+ this->rekeyed = TRUE;
}
/**
this->public.add = (status_t(*)(child_sa_t*,proposal_t*,prf_plus_t*))add;
this->public.update = (status_t(*)(child_sa_t*,proposal_t*,prf_plus_t*))update;
this->public.add_policies = (status_t (*)(child_sa_t*, linked_list_t*,linked_list_t*))add_policies;
- this->public.set_rekeyed = (void (*)(child_sa_t*,u_int32_t))set_rekeyed;
+ this->public.set_rekeyed = (void (*)(child_sa_t*))set_rekeyed;
this->public.log_status = (void (*)(child_sa_t*, logger_t*, char*))log_status;
this->public.destroy = (void(*)(child_sa_t*))destroy;
this->reqid = rekey ? rekey : ++reqid;
this->policies = linked_list_create();
this->protocol = PROTO_NONE;
- this->rekeyed = 0;
+ this->rekeyed = FALSE;
return (&this->public);
}
* not remove its policy, as the new SA uses it.
*
* @param this calling object
- * @param reqid reqid of the SA which replaces this one.
*/
- void (*set_rekeyed) (child_sa_t *this, u_int32_t reqid);
+ void (*set_rekeyed) (child_sa_t *this);
/**
* @brief Log the status of a child_sa to a logger.
while (iterator->has_next(iterator))
{
iterator->current(iterator, (void**)&child_sa);
- if (child_sa->get_spi(child_sa, TRUE) == spi)
+ if (child_sa->get_spi(child_sa, FALSE) == spi)
{
iterator->remove(iterator);
break;
return 0;
}
- spi = child_sa->get_spi(child_sa, FALSE);
+ spi = child_sa->get_spi(child_sa, TRUE);
child_sa->destroy(child_sa);
return spi;
}
while (iterator->has_next(iterator))
{
iterator->current(iterator, (void**)¤t);
- if (current->get_spi(current, TRUE) == spi)
+ if (current->get_spi(current, FALSE) == spi)
{
found = current;
}
old_child_sa = this->ike_sa->public.get_child_sa(&this->ike_sa->public, this->reqid);
if (old_child_sa)
{
- old_child_sa->set_rekeyed(old_child_sa, this->child_sa->get_reqid(this->child_sa));
+ old_child_sa->set_rekeyed(old_child_sa);
}
this->ike_sa->public.delete_child_sa(&this->ike_sa->public, this->reqid);
}
if (notify && notify->get_notify_message_type(notify) == REKEY_SA)
{
- this->old_child_sa = this->ike_sa->get_child_sa(this->ike_sa, notify->get_spi(notify));
+ u_int32_t spi = notify->get_spi(notify);
+ this->old_child_sa = this->ike_sa->get_child_sa(this->ike_sa, spi);
+ this->logger->log(this->logger, CONTROL, "Rekeying CHILD_SA with SPI 0x%x", spi);
+ }
+ else
+ {
+ this->logger->log(this->logger, CONTROL, "Create new CHILD_SA");
}
/* build response */
}
if (this->old_child_sa)
{ /* mark old child sa as rekeyed */
- this->old_child_sa->set_rekeyed(this->old_child_sa, this->child_sa->get_reqid(this->child_sa));
+ this->old_child_sa->set_rekeyed(this->old_child_sa);
}
this->ike_sa->add_child_sa(this->ike_sa, this->child_sa);
}