mode-config: Reassign migrated virtual IP if client requests %any
authorTobias Brunner <tobias@strongswan.org>
Tue, 13 Oct 2015 10:10:42 +0000 (12:10 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 12 Nov 2015 13:42:36 +0000 (14:42 +0100)
If we mistakenly detect a new IKE_SA as a reauthentication the client
won't request the previous virtual IP, but since we already migrated
it we already triggered the assign_vips() hook, so we should reassign
the migrated virtual IP.

Fixes #1152.

src/libcharon/sa/ikev1/tasks/mode_config.c

index d0994a9..a03477e 100644 (file)
@@ -482,7 +482,9 @@ static host_t *assign_migrated_vip(linked_list_t *migrated, host_t *requested)
        enumerator = migrated->create_enumerator(migrated);
        while (enumerator->enumerate(enumerator, &vip))
        {
-               if (vip->ip_equals(vip, requested))
+               if (vip->ip_equals(vip, requested) ||
+                  (requested->is_anyaddr(requested) &&
+                       requested->get_family(requested) == vip->get_family(vip)))
                {
                        migrated->remove_at(migrated, enumerator);
                        found = vip;