aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-12-12 10:38:53 +0000
committerMartin Willi <martin@strongswan.org>2008-12-12 10:38:53 +0000
commitd183adbc9d778e7fde92c35a1b4fc7f9eb633a20 (patch)
tree78ffd52497bb9a36a85a1a6cd13b54401f719a2f
parent3993b91334369dc68775a7b336a2105972e88700 (diff)
downloadstrongswan-d183adbc9d778e7fde92c35a1b4fc7f9eb633a20.tar.bz2
strongswan-d183adbc9d778e7fde92c35a1b4fc7f9eb633a20.tar.xz
avoid DNS lookup if possible
-rw-r--r--src/charon/sa/ike_sa_manager.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/charon/sa/ike_sa_manager.c b/src/charon/sa/ike_sa_manager.c
index 4560d8f19..3d3c7d869 100644
--- a/src/charon/sa/ike_sa_manager.c
+++ b/src/charon/sa/ike_sa_manager.c
@@ -1031,13 +1031,20 @@ static ike_sa_t* checkout_by_config(private_ike_sa_manager_t *this,
ike_cfg_t *ike_cfg;
u_int segment;
+ if (!this->reuse_ikesa)
+ { /* IKE_SA reuse disable by config */
+ ike_sa = checkout_new(this, TRUE);
+ charon->bus->set_sa(charon->bus, ike_sa);
+ return ike_sa;
+ }
+
ike_cfg = peer_cfg->get_ike_cfg(peer_cfg);
my_id = peer_cfg->get_my_id(peer_cfg);
other_id = peer_cfg->get_other_id(peer_cfg);
my_host = host_create_from_dns(ike_cfg->get_my_addr(ike_cfg), 0, 0);
other_host = host_create_from_dns(ike_cfg->get_other_addr(ike_cfg), 0, 0);
- if (my_host && other_host && this->reuse_ikesa)
+ if (my_host && other_host)
{
enumerator = create_table_enumerator(this);
while (enumerator->enumerate(enumerator, &entry, &segment))
@@ -1097,18 +1104,8 @@ static ike_sa_t* checkout_by_config(private_ike_sa_manager_t *this,
DESTROY_IF(other_host);
if (!ike_sa)
- {
- entry = entry_create();
- entry->ike_sa_id = ike_sa_id_create(get_next_spi(this), 0, TRUE);
- entry->ike_sa = ike_sa_create(entry->ike_sa_id);
-
- segment = put_entry(this, entry);
-
- /* check ike_sa out */
- DBG2(DBG_MGR, "new IKE_SA created for IDs [%D]...[%D]", my_id, other_id);
- entry->checked_out = TRUE;
- ike_sa = entry->ike_sa;
- unlock_single_segment(this, segment);
+ { /* no IKE_SA using such a config, hand out a new */
+ ike_sa = checkout_new(this, TRUE);
}
charon->bus->set_sa(charon->bus, ike_sa);
return ike_sa;