Handle initiation of not supported IKE versions properly

This commit is contained in:
Martin Willi
2012-03-20 17:31:30 +01:00
parent daee47ba46
commit 3d54ae94d9
9 changed files with 111 additions and 47 deletions
+6 -4
View File
@@ -54,7 +54,6 @@ METHOD(task_t, process_i, status_t,
ike_sa_t *new;
host_t *host;
enumerator_t *enumerator;
ike_version_t version;
child_sa_t *child_sa;
peer_cfg_t *peer_cfg;
@@ -75,9 +74,12 @@ METHOD(task_t, process_i, status_t,
return FAILED;
}
version = this->ike_sa->get_version(this->ike_sa);
new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager, version,
TRUE);
new = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
this->ike_sa->get_version(this->ike_sa), TRUE);
if (!new)
{ /* shouldn't happen */
return FAILED;
}
new->set_peer_cfg(new, peer_cfg);
host = this->ike_sa->get_other_host(this->ike_sa);
+11 -5
View File
@@ -123,16 +123,20 @@ METHOD(task_t, process_i_delete, status_t,
METHOD(task_t, build_i, status_t,
private_ike_rekey_t *this, message_t *message)
{
ike_version_t version;
peer_cfg_t *peer_cfg;
host_t *other_host;
/* create new SA only on first try */
if (this->new_sa == NULL)
{
ike_version_t version = this->ike_sa->get_version(this->ike_sa);
version = this->ike_sa->get_version(this->ike_sa);
this->new_sa = charon->ike_sa_manager->checkout_new(
charon->ike_sa_manager, version, TRUE);
if (!this->new_sa)
{ /* shouldn't happen */
return FAILED;
}
peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa);
other_host = this->ike_sa->get_other_host(this->ike_sa);
this->new_sa->set_peer_cfg(this->new_sa, peer_cfg);
@@ -149,7 +153,6 @@ METHOD(task_t, process_r, status_t,
private_ike_rekey_t *this, message_t *message)
{
enumerator_t *enumerator;
ike_version_t version;
peer_cfg_t *peer_cfg;
child_sa_t *child_sa;
@@ -177,9 +180,12 @@ METHOD(task_t, process_r, status_t,
}
enumerator->destroy(enumerator);
version = this->ike_sa->get_version(this->ike_sa);
this->new_sa = charon->ike_sa_manager->checkout_new(charon->ike_sa_manager,
version, FALSE);
this->ike_sa->get_version(this->ike_sa), FALSE);
if (!this->new_sa)
{ /* shouldn't happen */
return FAILED;
}
peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa);
this->new_sa->set_peer_cfg(this->new_sa, peer_cfg);