trap-manager: Maintain allocated reqids when handling acquires
This commit is contained in:
@@ -524,6 +524,7 @@ METHOD(trap_manager_t, acquire, void,
|
|||||||
child_cfg_t *child;
|
child_cfg_t *child;
|
||||||
ike_sa_t *ike_sa;
|
ike_sa_t *ike_sa;
|
||||||
host_t *host;
|
host_t *host;
|
||||||
|
uint32_t allocated_reqid;
|
||||||
bool wildcard, ignore = FALSE;
|
bool wildcard, ignore = FALSE;
|
||||||
|
|
||||||
this->lock->read_lock(this->lock);
|
this->lock->read_lock(this->lock);
|
||||||
@@ -596,6 +597,8 @@ METHOD(trap_manager_t, acquire, void,
|
|||||||
peer = found->peer_cfg->get_ref(found->peer_cfg);
|
peer = found->peer_cfg->get_ref(found->peer_cfg);
|
||||||
child = found->child_sa->get_config(found->child_sa);
|
child = found->child_sa->get_config(found->child_sa);
|
||||||
child = child->get_ref(child);
|
child = child->get_ref(child);
|
||||||
|
/* only pass allocated reqids explicitly, take a reference */
|
||||||
|
allocated_reqid = found->child_sa->get_reqid_ref(found->child_sa);
|
||||||
/* don't hold the lock while checking out the IKE_SA */
|
/* don't hold the lock while checking out the IKE_SA */
|
||||||
this->lock->unlock(this->lock);
|
this->lock->unlock(this->lock);
|
||||||
|
|
||||||
@@ -635,7 +638,7 @@ METHOD(trap_manager_t, acquire, void,
|
|||||||
if (ike_sa)
|
if (ike_sa)
|
||||||
{
|
{
|
||||||
child_init_args_t args = {
|
child_init_args_t args = {
|
||||||
.reqid = reqid,
|
.reqid = allocated_reqid,
|
||||||
.src = data->src,
|
.src = data->src,
|
||||||
.dst = data->dst,
|
.dst = data->dst,
|
||||||
.label = data->label,
|
.label = data->label,
|
||||||
@@ -669,6 +672,10 @@ METHOD(trap_manager_t, acquire, void,
|
|||||||
destroy_acquire(acquire);
|
destroy_acquire(acquire);
|
||||||
child->destroy(child);
|
child->destroy(child);
|
||||||
}
|
}
|
||||||
|
if (allocated_reqid)
|
||||||
|
{
|
||||||
|
charon->kernel->release_reqid(charon->kernel, allocated_reqid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user