Simplified some route lookups now that we store all peer addresses in a list.
authorTobias Brunner <tobias@strongswan.org>
Fri, 9 Mar 2012 09:22:21 +0000 (10:22 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 9 Mar 2012 09:22:21 +0000 (10:22 +0100)
src/libcharon/sa/ike_sa.c
src/libcharon/sa/tasks/ike_mobike.c

index a1ce526..ed3e51e 100644 (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;
        bool valid = FALSE;
        enumerator_t *enumerator;
        host_t *src, *addr;
+
        DBG1(DBG_IKE, "old path is not available anymore, try to find another");
        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;
        if (src)
        {
                valid = TRUE;
index da693f2..1402b2e 100644 (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);
 
        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))
        {
        enumerator = this->ike_sa->create_peer_address_enumerator(this->ike_sa);
        while (enumerator->enumerate(enumerator, (void**)&other))
        {