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;