initiate trapped CHILD_SAs with same reqid
This commit is contained in:
@@ -230,7 +230,7 @@ static status_t initiate_execute(interface_job_t *job)
|
||||
}
|
||||
peer_cfg->destroy(peer_cfg);
|
||||
|
||||
if (ike_sa->initiate(ike_sa, listener->child_cfg) == SUCCESS)
|
||||
if (ike_sa->initiate(ike_sa, listener->child_cfg, 0) == SUCCESS)
|
||||
{
|
||||
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
|
||||
return SUCCESS;
|
||||
|
||||
@@ -406,7 +406,7 @@ static gboolean connect_(NMVPNPlugin *plugin, NMConnection *connection,
|
||||
{
|
||||
peer_cfg->destroy(peer_cfg);
|
||||
}
|
||||
if (ike_sa->initiate(ike_sa, child_cfg) != SUCCESS)
|
||||
if (ike_sa->initiate(ike_sa, child_cfg, 0) != SUCCESS)
|
||||
{
|
||||
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager, ike_sa);
|
||||
|
||||
|
||||
+6
-14
@@ -1103,10 +1103,10 @@ static void resolve_hosts(private_ike_sa_t *this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a CHILD_SA using the appropriate reqid
|
||||
* Implementation of ike_sa_t.initiate
|
||||
*/
|
||||
static status_t initiate_with_reqid(private_ike_sa_t *this,
|
||||
child_cfg_t *child_cfg, u_int32_t reqid)
|
||||
static status_t initiate(private_ike_sa_t *this,
|
||||
child_cfg_t *child_cfg, u_int32_t reqid)
|
||||
{
|
||||
task_t *task;
|
||||
|
||||
@@ -1191,14 +1191,6 @@ static status_t initiate_with_reqid(private_ike_sa_t *this,
|
||||
return this->task_manager->initiate(this->task_manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of ike_sa_t.initiate.
|
||||
*/
|
||||
static status_t initiate(private_ike_sa_t *this, child_cfg_t *child_cfg)
|
||||
{
|
||||
return initiate_with_reqid(this, child_cfg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of ike_sa_t.process_message.
|
||||
*/
|
||||
@@ -1615,7 +1607,7 @@ static status_t reestablish(private_ike_sa_t *this)
|
||||
#ifdef ME
|
||||
if (this->peer_cfg->is_mediation(this->peer_cfg))
|
||||
{
|
||||
status = new->initiate(new, NULL);
|
||||
status = new->initiate(new, NULL, 0);
|
||||
}
|
||||
else
|
||||
#endif /* ME */
|
||||
@@ -1638,7 +1630,7 @@ static status_t reestablish(private_ike_sa_t *this)
|
||||
DBG1(DBG_IKE, "restarting CHILD_SA %s",
|
||||
child_cfg->get_name(child_cfg));
|
||||
child_cfg->get_ref(child_cfg);
|
||||
status = new->initiate(new, child_cfg);
|
||||
status = new->initiate(new, child_cfg, 0);
|
||||
break;
|
||||
case ACTION_ROUTE:
|
||||
charon->traps->install(charon->traps,
|
||||
@@ -1997,7 +1989,7 @@ ike_sa_t * ike_sa_create(ike_sa_id_t *ike_sa_id)
|
||||
this->public.get_name = (char* (*)(ike_sa_t*))get_name;
|
||||
this->public.get_statistic = (u_int32_t(*)(ike_sa_t*, statistic_t kind))get_statistic;
|
||||
this->public.process_message = (status_t (*)(ike_sa_t*, message_t*)) process_message;
|
||||
this->public.initiate = (status_t (*)(ike_sa_t*,child_cfg_t*)) initiate;
|
||||
this->public.initiate = (status_t (*)(ike_sa_t*,child_cfg_t*,u_int32_t)) initiate;
|
||||
this->public.get_ike_cfg = (ike_cfg_t* (*)(ike_sa_t*))get_ike_cfg;
|
||||
this->public.set_ike_cfg = (void (*)(ike_sa_t*,ike_cfg_t*))set_ike_cfg;
|
||||
this->public.get_peer_cfg = (peer_cfg_t* (*)(ike_sa_t*))get_peer_cfg;
|
||||
|
||||
@@ -603,11 +603,13 @@ struct ike_sa_t {
|
||||
* The configs are owned by the IKE_SA after the call.
|
||||
*
|
||||
* @param child_cfg child config to create CHILD from
|
||||
* @param reqid reqid to use for CHILD_SA, 0 assigne uniquely
|
||||
* @return
|
||||
* - SUCCESS if initialization started
|
||||
* - DESTROY_ME if initialization failed
|
||||
*/
|
||||
status_t (*initiate) (ike_sa_t *this, child_cfg_t *child_cfg);
|
||||
status_t (*initiate) (ike_sa_t *this, child_cfg_t *child_cfg,
|
||||
u_int32_t reqid);
|
||||
|
||||
/**
|
||||
* Initiates the deletion of an IKE_SA.
|
||||
|
||||
@@ -201,7 +201,7 @@ 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);
|
||||
status = this->ike_sa->initiate(this->ike_sa, child_cfg, 0);
|
||||
break;
|
||||
case ACTION_ROUTE:
|
||||
charon->traps->install(charon->traps,
|
||||
|
||||
@@ -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) == DESTROY_ME)
|
||||
if (new->initiate(new, NULL, 0) == 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) == DESTROY_ME)
|
||||
if (new->initiate(new, child_cfg, 0) == DESTROY_ME)
|
||||
{
|
||||
iterator->destroy(iterator);
|
||||
charon->ike_sa_manager->checkin_and_destroy(
|
||||
|
||||
@@ -66,7 +66,7 @@ static void destroy_entry(entry_t *entry)
|
||||
/**
|
||||
* Implementation of trap_manager_t.install
|
||||
*/
|
||||
static u_int install(private_trap_manager_t *this, peer_cfg_t *peer,
|
||||
static u_int32_t install(private_trap_manager_t *this, peer_cfg_t *peer,
|
||||
child_cfg_t *child)
|
||||
{
|
||||
entry_t *entry;
|
||||
@@ -77,7 +77,7 @@ static u_int install(private_trap_manager_t *this, peer_cfg_t *peer,
|
||||
enumerator_t *enumerator;
|
||||
bool found = FALSE;
|
||||
status_t status;
|
||||
u_int reqid;
|
||||
u_int32_t reqid;
|
||||
|
||||
/* check if not already done */
|
||||
this->mutex->lock(this->mutex);
|
||||
@@ -158,7 +158,7 @@ static u_int install(private_trap_manager_t *this, peer_cfg_t *peer,
|
||||
/**
|
||||
* Implementation of trap_manager_t.uninstall
|
||||
*/
|
||||
static bool uninstall(private_trap_manager_t *this, u_int reqid)
|
||||
static bool uninstall(private_trap_manager_t *this, u_int32_t reqid)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
entry_t *entry, *found = NULL;
|
||||
@@ -218,7 +218,7 @@ static enumerator_t* create_enumerator(private_trap_manager_t *this)
|
||||
/**
|
||||
* Implementation of trap_manager_t.acquire
|
||||
*/
|
||||
static void acquire(private_trap_manager_t *this, u_int reqid,
|
||||
static void acquire(private_trap_manager_t *this, u_int32_t reqid,
|
||||
traffic_selector_t *src, traffic_selector_t *dst)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
@@ -255,7 +255,7 @@ static void acquire(private_trap_manager_t *this, u_int reqid,
|
||||
}
|
||||
child->get_ref(child);
|
||||
this->mutex->unlock(this->mutex);
|
||||
if (ike_sa->initiate(ike_sa, child) != DESTROY_ME)
|
||||
if (ike_sa->initiate(ike_sa, child, reqid) != DESTROY_ME)
|
||||
{
|
||||
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
|
||||
return;
|
||||
@@ -281,10 +281,10 @@ trap_manager_t *trap_manager_create()
|
||||
{
|
||||
private_trap_manager_t *this = malloc_thing(private_trap_manager_t);
|
||||
|
||||
this->public.install = (u_int(*)(trap_manager_t*, peer_cfg_t *peer, child_cfg_t *child))install;
|
||||
this->public.uninstall = (bool(*)(trap_manager_t*, u_int id))uninstall;
|
||||
this->public.install = (u_int32_t(*)(trap_manager_t*, peer_cfg_t *peer, child_cfg_t *child))install;
|
||||
this->public.uninstall = (bool(*)(trap_manager_t*, u_int32_t id))uninstall;
|
||||
this->public.create_enumerator = (enumerator_t*(*)(trap_manager_t*))create_enumerator;
|
||||
this->public.acquire = (void(*)(trap_manager_t*, u_int reqid, traffic_selector_t *src, traffic_selector_t *dst))acquire;
|
||||
this->public.acquire = (void(*)(trap_manager_t*, u_int32_t reqid, traffic_selector_t *src, traffic_selector_t *dst))acquire;
|
||||
this->public.destroy = (void(*)(trap_manager_t*))destroy;
|
||||
|
||||
this->traps = linked_list_create();
|
||||
|
||||
@@ -39,7 +39,8 @@ struct trap_manager_t {
|
||||
* @param child child configuration to install as a trap
|
||||
* @return reqid of installed CHILD_SA, 0 if failed
|
||||
*/
|
||||
u_int (*install)(trap_manager_t *this, peer_cfg_t *peer, child_cfg_t *child);
|
||||
u_int32_t (*install)(trap_manager_t *this, peer_cfg_t *peer,
|
||||
child_cfg_t *child);
|
||||
|
||||
/**
|
||||
* Uninstall a trap policy.
|
||||
@@ -47,7 +48,7 @@ struct trap_manager_t {
|
||||
* @param id reqid of CHILD_SA to uninstall, returned by install()
|
||||
* @return TRUE if uninstalled successfully
|
||||
*/
|
||||
bool (*uninstall)(trap_manager_t *this, u_int reqid);
|
||||
bool (*uninstall)(trap_manager_t *this, u_int32_t reqid);
|
||||
|
||||
/**
|
||||
* Create an enumerator over all installed traps.
|
||||
@@ -63,8 +64,8 @@ struct trap_manager_t {
|
||||
* @param src source of the triggering packet
|
||||
* @param dst destination of the triggering packet
|
||||
*/
|
||||
void (*acquire)(trap_manager_t *this, u_int reqid, traffic_selector_t *src,
|
||||
traffic_selector_t *dst);
|
||||
void (*acquire)(trap_manager_t *this, u_int32_t reqid,
|
||||
traffic_selector_t *src, traffic_selector_t *dst);
|
||||
|
||||
/**
|
||||
* Destroy a trap_manager_t.
|
||||
|
||||
Reference in New Issue
Block a user