]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
load-tester: Use appropriate family to request addresses from source IP pools
authorTobias Brunner <tobias@strongswan.org>
Wed, 21 Oct 2020 14:04:37 +0000 (16:04 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 27 Oct 2020 15:40:05 +0000 (16:40 +0100)
Looks like this wasn't necessary before 40e90898895c ("Strictly enforce
address family match while acquiring mem_pool IPs").

Fixes #3595.

src/libcharon/plugins/load_tester/load_tester_config.c

index 36410652cb5e8792ca83022a676f5f728fb4d9e9..b0b6f146ef10c5f5ef929b1cc88ddf9a80adccef 100644 (file)
@@ -633,13 +633,15 @@ static host_t *allocate_addr(private_load_tester_config_t *this, uint num)
        char *iface = NULL, buf[32];
        entry_t *entry;
 
-       requested = host_create_any(AF_INET);
        snprintf(buf, sizeof(buf), "ext-%d", num);
        id = identification_create_from_string(buf);
        enumerator = this->pools->create_enumerator(this->pools);
        while (enumerator->enumerate(enumerator, &pool))
        {
+               requested = pool->get_base(pool);
+               requested = host_create_any(requested->get_family(requested));
                found = pool->acquire_address(pool, id, requested, MEM_POOL_NEW, NULL);
+               requested->destroy(requested);
                if (found)
                {
                        iface = (char*)pool->get_name(pool);
@@ -647,7 +649,6 @@ static host_t *allocate_addr(private_load_tester_config_t *this, uint num)
                }
        }
        enumerator->destroy(enumerator);
-       requested->destroy(requested);
 
        if (!found)
        {