Remove redundant calls to set peer config after checking out IKE_SAs by config
This commit is contained in:
parent
c46c40ef24
commit
7f6386afd9
|
@ -884,18 +884,13 @@ static gboolean connect_(NMVpnServicePlugin *plugin, NMConnection *connection,
|
||||||
*/
|
*/
|
||||||
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
|
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
|
||||||
peer_cfg);
|
peer_cfg);
|
||||||
|
peer_cfg->destroy(peer_cfg);
|
||||||
if (!ike_sa)
|
if (!ike_sa)
|
||||||
{
|
{
|
||||||
peer_cfg->destroy(peer_cfg);
|
|
||||||
g_set_error(err, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
|
g_set_error(err, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
|
||||||
"IKE version not supported.");
|
"IKE version not supported.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!ike_sa->get_peer_cfg(ike_sa))
|
|
||||||
{
|
|
||||||
ike_sa->set_peer_cfg(ike_sa, peer_cfg);
|
|
||||||
}
|
|
||||||
peer_cfg->destroy(peer_cfg);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register listener, enable initiate-failure-detection hooks
|
* Register listener, enable initiate-failure-detection hooks
|
||||||
|
|
|
@ -911,18 +911,13 @@ static job_requeue_t initiate(private_android_service_t *this)
|
||||||
/* get us an IKE_SA */
|
/* get us an IKE_SA */
|
||||||
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
|
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
|
||||||
peer_cfg);
|
peer_cfg);
|
||||||
|
peer_cfg->destroy(peer_cfg);
|
||||||
if (!ike_sa)
|
if (!ike_sa)
|
||||||
{
|
{
|
||||||
peer_cfg->destroy(peer_cfg);
|
|
||||||
charonservice->update_status(charonservice,
|
charonservice->update_status(charonservice,
|
||||||
CHARONSERVICE_GENERIC_ERROR);
|
CHARONSERVICE_GENERIC_ERROR);
|
||||||
return JOB_REQUEUE_NONE;
|
return JOB_REQUEUE_NONE;
|
||||||
}
|
}
|
||||||
if (!ike_sa->get_peer_cfg(ike_sa))
|
|
||||||
{
|
|
||||||
ike_sa->set_peer_cfg(ike_sa, peer_cfg);
|
|
||||||
}
|
|
||||||
peer_cfg->destroy(peer_cfg);
|
|
||||||
|
|
||||||
/* store the IKE_SA so we can track its progress */
|
/* store the IKE_SA so we can track its progress */
|
||||||
this->ike_sa = ike_sa;
|
this->ike_sa = ike_sa;
|
||||||
|
|
|
@ -417,10 +417,10 @@ METHOD(job_t, initiate_execute, job_requeue_t,
|
||||||
|
|
||||||
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
|
ike_sa = charon->ike_sa_manager->checkout_by_config(charon->ike_sa_manager,
|
||||||
peer_cfg);
|
peer_cfg);
|
||||||
|
peer_cfg->destroy(peer_cfg);
|
||||||
if (!ike_sa)
|
if (!ike_sa)
|
||||||
{
|
{
|
||||||
DESTROY_IF(listener->child_cfg);
|
DESTROY_IF(listener->child_cfg);
|
||||||
peer_cfg->destroy(peer_cfg);
|
|
||||||
listener->status = FAILED;
|
listener->status = FAILED;
|
||||||
listener_done(listener);
|
listener_done(listener);
|
||||||
return JOB_REQUEUE_NONE;
|
return JOB_REQUEUE_NONE;
|
||||||
|
@ -429,11 +429,6 @@ METHOD(job_t, initiate_execute, job_requeue_t,
|
||||||
listener->ike_sa = ike_sa;
|
listener->ike_sa = ike_sa;
|
||||||
listener->lock->unlock(listener->lock);
|
listener->lock->unlock(listener->lock);
|
||||||
|
|
||||||
if (ike_sa->get_peer_cfg(ike_sa) == NULL)
|
|
||||||
{
|
|
||||||
ike_sa->set_peer_cfg(ike_sa, peer_cfg);
|
|
||||||
}
|
|
||||||
peer_cfg->destroy(peer_cfg);
|
|
||||||
|
|
||||||
if (listener->options.limits && ike_sa->get_state(ike_sa) == IKE_CREATED)
|
if (listener->options.limits && ike_sa->get_state(ike_sa) == IKE_CREATED)
|
||||||
{ /* only check if we are not reusing an IKE_SA */
|
{ /* only check if we are not reusing an IKE_SA */
|
||||||
|
|
|
@ -538,12 +538,10 @@ METHOD(trap_manager_t, acquire, void,
|
||||||
ike_sa = charon->ike_sa_manager->checkout_by_config(
|
ike_sa = charon->ike_sa_manager->checkout_by_config(
|
||||||
charon->ike_sa_manager, peer);
|
charon->ike_sa_manager, peer);
|
||||||
}
|
}
|
||||||
|
peer->destroy(peer);
|
||||||
|
|
||||||
if (ike_sa)
|
if (ike_sa)
|
||||||
{
|
{
|
||||||
if (ike_sa->get_peer_cfg(ike_sa) == NULL)
|
|
||||||
{
|
|
||||||
ike_sa->set_peer_cfg(ike_sa, peer);
|
|
||||||
}
|
|
||||||
if (this->ignore_acquire_ts || ike_sa->get_version(ike_sa) == IKEV1)
|
if (this->ignore_acquire_ts || ike_sa->get_version(ike_sa) == IKEV1)
|
||||||
{ /* in IKEv1, don't prepend the acquiring packet TS, as we only
|
{ /* in IKEv1, don't prepend the acquiring packet TS, as we only
|
||||||
* have a single TS that we can establish in a Quick Mode. */
|
* have a single TS that we can establish in a Quick Mode. */
|
||||||
|
@ -572,7 +570,6 @@ METHOD(trap_manager_t, acquire, void,
|
||||||
destroy_acquire(acquire);
|
destroy_acquire(acquire);
|
||||||
child->destroy(child);
|
child->destroy(child);
|
||||||
}
|
}
|
||||||
peer->destroy(peer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue