Simplified some route lookups now that we store all peer addresses in a list.

This commit is contained in:
Tobias Brunner
2012-03-09 10:22:21 +01:00
parent 94bbc60256
commit 72b2811204
2 changed files with 9 additions and 25 deletions
+9 -14
View File
@@ -1874,25 +1874,20 @@ static bool is_any_path_valid(private_ike_sa_t *this)
bool valid = FALSE;
enumerator_t *enumerator;
host_t *src, *addr;
DBG1(DBG_IKE, "old path is not available anymore, try to find another");
src = hydra->kernel_interface->get_source_addr(hydra->kernel_interface,
this->other_host, NULL);
if (!src)
enumerator = this->peer_addresses->create_enumerator(this->peer_addresses);
while (enumerator->enumerate(enumerator, &addr))
{
enumerator = this->peer_addresses->create_enumerator(
this->peer_addresses);
while (enumerator->enumerate(enumerator, &addr))
DBG1(DBG_IKE, "looking for a route to %H ...", addr);
src = hydra->kernel_interface->get_source_addr(
hydra->kernel_interface, addr, NULL);
if (src)
{
DBG1(DBG_IKE, "looking for a route to %H ...", addr);
src = hydra->kernel_interface->get_source_addr(
hydra->kernel_interface, addr, NULL);
if (src)
{
break;
}
break;
}
enumerator->destroy(enumerator);
}
enumerator->destroy(enumerator);
if (src)
{
valid = TRUE;
-11
View File
@@ -299,17 +299,6 @@ METHOD(ike_mobike_t, transmit, void,
other_old = this->ike_sa->get_other_host(this->ike_sa);
ike_cfg = this->ike_sa->get_ike_cfg(this->ike_sa);
me = hydra->kernel_interface->get_source_addr(
hydra->kernel_interface, other_old, NULL);
if (me)
{
apply_port(me, me_old, ike_cfg->get_my_port(ike_cfg));
DBG1(DBG_IKE, "checking original path %#H - %#H", me, other_old);
copy = packet->clone(packet);
copy->set_source(copy, me);
charon->sender->send(charon->sender, copy);
}
enumerator = this->ike_sa->create_peer_address_enumerator(this->ike_sa);
while (enumerator->enumerate(enumerator, (void**)&other))
{