implemented child_up() bus hook
This commit is contained in:
@@ -158,6 +158,11 @@ struct private_child_create_t {
|
||||
* successfully established the CHILD?
|
||||
*/
|
||||
bool established;
|
||||
|
||||
/**
|
||||
* whether the CHILD_SA rekeys an existing one
|
||||
*/
|
||||
bool rekey;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -939,7 +944,11 @@ static status_t build_r(private_child_create_t *this, message_t *message)
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, FALSE)),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
|
||||
|
||||
|
||||
if (!this->rekey)
|
||||
{ /* invoke the child_up() hook if we are not rekeying */
|
||||
charon->bus->child_updown(charon->bus, this->child_sa, TRUE);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1052,6 +1061,11 @@ static status_t process_i(private_child_create_t *this, message_t *message)
|
||||
ntohl(this->child_sa->get_spi(this->child_sa, FALSE)),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, TRUE),
|
||||
this->child_sa->get_traffic_selectors(this->child_sa, FALSE));
|
||||
|
||||
if (!this->rekey)
|
||||
{ /* invoke the child_up() hook if we are not rekeying */
|
||||
charon->bus->child_updown(charon->bus, this->child_sa, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1174,7 +1188,8 @@ static void destroy(private_child_create_t *this)
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
child_create_t *child_create_create(ike_sa_t *ike_sa, child_cfg_t *config,
|
||||
child_create_t *child_create_create(ike_sa_t *ike_sa,
|
||||
child_cfg_t *config, bool rekey,
|
||||
traffic_selector_t *tsi, traffic_selector_t *tsr)
|
||||
{
|
||||
private_child_create_t *this = malloc_thing(private_child_create_t);
|
||||
@@ -1222,6 +1237,7 @@ child_create_t *child_create_create(ike_sa_t *ike_sa, child_cfg_t *config,
|
||||
this->other_cpi = 0;
|
||||
this->reqid = 0;
|
||||
this->established = FALSE;
|
||||
this->rekey = rekey;
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
@@ -71,11 +71,13 @@ struct child_create_t {
|
||||
*
|
||||
* @param ike_sa IKE_SA this task works for
|
||||
* @param config child_cfg if task initiator, NULL if responder
|
||||
* @param rekey whether we do a rekey or not
|
||||
* @param tsi source of triggering packet, or NULL
|
||||
* @param tsr destination of triggering packet, or NULL
|
||||
* @return child_create task to handle by the task_manager
|
||||
*/
|
||||
child_create_t *child_create_create(ike_sa_t *ike_sa, child_cfg_t *config,
|
||||
child_create_t *child_create_create(ike_sa_t *ike_sa,
|
||||
child_cfg_t *config, bool rekey,
|
||||
traffic_selector_t *tsi, traffic_selector_t *tsr);
|
||||
|
||||
#endif /** CHILD_CREATE_H_ @}*/
|
||||
|
||||
@@ -157,7 +157,8 @@ static status_t build_i(private_child_rekey_t *this, message_t *message)
|
||||
|
||||
/* ... our CHILD_CREATE task does the hard work for us. */
|
||||
reqid = this->child_sa->get_reqid(this->child_sa);
|
||||
this->child_create = child_create_create(this->ike_sa, config, NULL, NULL);
|
||||
this->child_create = child_create_create(this->ike_sa, config, TRUE,
|
||||
NULL, NULL);
|
||||
this->child_create->use_reqid(this->child_create, reqid);
|
||||
this->child_create->task.build(&this->child_create->task, message);
|
||||
|
||||
@@ -426,7 +427,7 @@ child_rekey_t *child_rekey_create(ike_sa_t *ike_sa, protocol_id_t protocol,
|
||||
this->public.task.build = (status_t(*)(task_t*,message_t*))build_r;
|
||||
this->public.task.process = (status_t(*)(task_t*,message_t*))process_r;
|
||||
this->initiator = FALSE;
|
||||
this->child_create = child_create_create(ike_sa, NULL, NULL, NULL);
|
||||
this->child_create = child_create_create(ike_sa, NULL, TRUE, NULL, NULL);
|
||||
}
|
||||
|
||||
this->ike_sa = ike_sa;
|
||||
|
||||
Reference in New Issue
Block a user