Don't wait while removing external IPs used for load testing

This commit is contained in:
Martin Willi 2012-11-12 11:14:03 +01:00
parent b185cdd16d
commit d88597f0dd
8 changed files with 18 additions and 11 deletions

View File

@ -539,7 +539,7 @@ METHOD(load_tester_config_t, delete_ip, void,
if (pool->release_address(pool, ip, found))
{
hydra->kernel_interface->del_ip(hydra->kernel_interface,
ip, this->prefix);
ip, this->prefix, FALSE);
}
found->destroy(found);
break;

View File

@ -829,7 +829,7 @@ static void reinstall_vip(host_t *vip, host_t *me)
if (hydra->kernel_interface->get_interface(hydra->kernel_interface,
me, &iface))
{
hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1);
hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1, TRUE);
hydra->kernel_interface->add_ip(hydra->kernel_interface, vip, -1, iface);
free(iface);
}

View File

@ -780,7 +780,8 @@ METHOD(ike_sa_t, clear_virtual_ips, void,
{
if (local)
{
hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1);
hydra->kernel_interface->del_ip(hydra->kernel_interface,
vip, -1, TRUE);
}
vip->destroy(vip);
}
@ -2087,7 +2088,7 @@ METHOD(ike_sa_t, destroy, void,
while (this->my_vips->remove_last(this->my_vips, (void**)&vip) == SUCCESS)
{
hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1);
hydra->kernel_interface->del_ip(hydra->kernel_interface, vip, -1, TRUE);
vip->destroy(vip);
}
this->my_vips->destroy(this->my_vips);

View File

@ -323,13 +323,13 @@ METHOD(kernel_interface_t, add_ip, status_t,
}
METHOD(kernel_interface_t, del_ip, status_t,
private_kernel_interface_t *this, host_t *virtual_ip, int prefix)
private_kernel_interface_t *this, host_t *virtual_ip, int prefix, bool wait)
{
if (!this->net)
{
return NOT_SUPPORTED;
}
return this->net->del_ip(this->net, virtual_ip, prefix);
return this->net->del_ip(this->net, virtual_ip, prefix, wait);
}
METHOD(kernel_interface_t, add_route, status_t,

View File

@ -349,9 +349,11 @@ struct kernel_interface_t {
*
* @param virtual_ip virtual ip address to assign
* @param prefix prefix length of the IP to uninstall, -1 for auto
* @param wait TRUE to wait untily IP is gone
* @return SUCCESS if operation completed
*/
status_t (*del_ip) (kernel_interface_t *this, host_t *virtual_ip, int prefix);
status_t (*del_ip) (kernel_interface_t *this, host_t *virtual_ip,
int prefix, bool wait);
/**
* Add a route.

View File

@ -128,9 +128,11 @@ struct kernel_net_t {
*
* @param virtual_ip virtual ip address to assign
* @param prefix prefix length of the IP to uninstall, -1 for auto
* @param wait TRUE to wait until IP is gone
* @return SUCCESS if operation completed
*/
status_t (*del_ip) (kernel_net_t *this, host_t *virtual_ip, int prefix);
status_t (*del_ip) (kernel_net_t *this, host_t *virtual_ip, int prefix,
bool wait);
/**
* Add a route.

View File

@ -1758,7 +1758,8 @@ METHOD(kernel_net_t, add_ip, status_t,
}
METHOD(kernel_net_t, del_ip, status_t,
private_kernel_netlink_net_t *this, host_t *virtual_ip, int prefix)
private_kernel_netlink_net_t *this, host_t *virtual_ip, int prefix,
bool wait)
{
addr_map_entry_t *entry, lookup = {
.ip = virtual_ip,
@ -1798,7 +1799,7 @@ METHOD(kernel_net_t, del_ip, status_t,
entry->addr->installed = FALSE;
status = manage_ipaddr(this, RTM_DELADDR, 0, entry->iface->ifindex,
virtual_ip, prefix);
if (status == SUCCESS)
if (status == SUCCESS && wait)
{ /* wait until the address is really gone */
while (is_known_vip(this, virtual_ip))
{

View File

@ -647,7 +647,8 @@ METHOD(kernel_net_t, add_ip, status_t,
}
METHOD(kernel_net_t, del_ip, status_t,
private_kernel_pfroute_net_t *this, host_t *virtual_ip, int prefix)
private_kernel_pfroute_net_t *this, host_t *virtual_ip, int prefix,
bool wait)
{
return FAILED;
}