load-tester: Use appropriate family to request addresses from source IP pools

Looks like this wasn't necessary before 40e9089889 ("Strictly enforce
address family match while acquiring mem_pool IPs").

Fixes #3595.
This commit is contained in:
Tobias Brunner 2020-10-21 16:04:37 +02:00
parent 12a3f3ca52
commit 1d232d4954
1 changed files with 3 additions and 2 deletions

View File

@ -633,13 +633,15 @@ static host_t *allocate_addr(private_load_tester_config_t *this, uint num)
char *iface = NULL, buf[32]; char *iface = NULL, buf[32];
entry_t *entry; entry_t *entry;
requested = host_create_any(AF_INET);
snprintf(buf, sizeof(buf), "ext-%d", num); snprintf(buf, sizeof(buf), "ext-%d", num);
id = identification_create_from_string(buf); id = identification_create_from_string(buf);
enumerator = this->pools->create_enumerator(this->pools); enumerator = this->pools->create_enumerator(this->pools);
while (enumerator->enumerate(enumerator, &pool)) 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); found = pool->acquire_address(pool, id, requested, MEM_POOL_NEW, NULL);
requested->destroy(requested);
if (found) if (found)
{ {
iface = (char*)pool->get_name(pool); 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); enumerator->destroy(enumerator);
requested->destroy(requested);
if (!found) if (!found)
{ {