include TSi/TSr of triggering packet in acquire

This commit is contained in:
Martin Willi
2009-05-20 11:44:43 +02:00
parent cd37e13133
commit a13c013b6f
11 changed files with 57 additions and 21 deletions
+27 -2
View File
@@ -84,6 +84,16 @@ struct private_child_create_t {
*/
linked_list_t *tsr;
/**
* source of triggering packet
*/
traffic_selector_t *packet_tsi;
/**
* destination of triggering packet
*/
traffic_selector_t *packet_tsr;
/**
* optional diffie hellman exchange
*/
@@ -692,7 +702,17 @@ static status_t build_i(private_child_create_t *this, message_t *message)
}
this->tsr = this->config->get_traffic_selectors(this->config, FALSE,
NULL, other);
if (this->packet_tsi)
{
this->tsi->insert_first(this->tsi,
this->packet_tsi->clone(this->packet_tsi));
}
if (this->packet_tsr)
{
this->tsr->insert_first(this->tsr,
this->packet_tsr->clone(this->packet_tsr));
}
this->proposals = this->config->get_proposals(this->config,
this->dh_group == MODP_NONE);
this->mode = this->config->get_mode(this->config);
@@ -1138,6 +1158,8 @@ static void destroy(private_child_create_t *this)
{
DESTROY_IF(this->child_sa);
}
DESTROY_IF(this->packet_tsi);
DESTROY_IF(this->packet_tsr);
DESTROY_IF(this->proposal);
DESTROY_IF(this->dh);
if (this->proposals)
@@ -1152,7 +1174,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,
traffic_selector_t *tsi, traffic_selector_t *tsr)
{
private_child_create_t *this = malloc_thing(private_child_create_t);
@@ -1184,6 +1207,8 @@ child_create_t *child_create_create(ike_sa_t *ike_sa, child_cfg_t *config)
this->proposal = NULL;
this->tsi = NULL;
this->tsr = NULL;
this->packet_tsi = tsi ? tsi->clone(tsi) : NULL;
this->packet_tsr = tsr ? tsr->clone(tsr) : NULL;
this->dh = NULL;
this->dh_group = MODP_NONE;
this->keymat = ike_sa->get_keymat(ike_sa);
+5 -2
View File
@@ -71,8 +71,11 @@ struct child_create_t {
*
* @param ike_sa IKE_SA this task works for
* @param config child_cfg if task initiator, NULL if responder
* @return child_create task to handle by the task_manager
* @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,
traffic_selector_t *tsi, traffic_selector_t *tsr);
#endif /** CHILD_CREATE_H_ @}*/
+2 -1
View File
@@ -201,7 +201,8 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
{
case ACTION_RESTART:
child_cfg->get_ref(child_cfg);
status = this->ike_sa->initiate(this->ike_sa, child_cfg, 0);
status = this->ike_sa->initiate(this->ike_sa, child_cfg, 0,
NULL, NULL);
break;
case ACTION_ROUTE:
charon->traps->install(charon->traps,
+2 -2
View File
@@ -157,7 +157,7 @@ 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);
this->child_create = child_create_create(this->ike_sa, config, NULL, NULL);
this->child_create->use_reqid(this->child_create, reqid);
this->child_create->task.build(&this->child_create->task, message);
@@ -416,7 +416,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);
this->child_create = child_create_create(ike_sa, NULL, NULL, NULL);
}
this->ike_sa = ike_sa;
+2 -2
View File
@@ -98,7 +98,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message)
/* we initiate the new IKE_SA of the mediation connection without CHILD_SA */
if (peer_cfg->is_mediation(peer_cfg))
{
if (new->initiate(new, NULL, 0) == DESTROY_ME)
if (new->initiate(new, NULL, 0, NULL, NULL) == DESTROY_ME)
{
charon->ike_sa_manager->checkin_and_destroy(
charon->ike_sa_manager, new);
@@ -126,7 +126,7 @@ static status_t process_i(private_ike_reauth_t *this, message_t *message)
/* initiate/queue all child SAs */
child_cfg_t *child_cfg = child_sa->get_config(child_sa);
child_cfg->get_ref(child_cfg);
if (new->initiate(new, child_cfg, 0) == DESTROY_ME)
if (new->initiate(new, child_cfg, 0, NULL, NULL) == DESTROY_ME)
{
iterator->destroy(iterator);
charon->ike_sa_manager->checkin_and_destroy(