emit a single assig_vips bus message for all VIPs

This commit is contained in:
Andreas Steffen
2013-04-06 14:16:30 +02:00
parent ba2880d569
commit 12fa1784d0
8 changed files with 57 additions and 62 deletions
+8 -6
View File
@@ -766,7 +766,6 @@ METHOD(ike_sa_t, add_virtual_ip, void,
else
{
this->other_vips->insert_last(this->other_vips, ip->clone(ip));
charon->bus->assign_vip(charon->bus, &this->public, ip, TRUE);
}
}
@@ -777,6 +776,10 @@ METHOD(ike_sa_t, clear_virtual_ips, void,
linked_list_t *vips = local ? this->my_vips : this->other_vips;
host_t *vip;
if (!local && vips->get_count(vips))
{
charon->bus->assign_vips(charon->bus, &this->public, FALSE);
}
while (vips->remove_first(vips, (void**)&vip) == SUCCESS)
{
if (local)
@@ -784,10 +787,6 @@ METHOD(ike_sa_t, clear_virtual_ips, void,
hydra->kernel_interface->del_ip(hydra->kernel_interface,
vip, -1, TRUE);
}
else
{
charon->bus->assign_vip(charon->bus, &this->public, vip, FALSE);
}
vip->destroy(vip);
}
}
@@ -2110,6 +2109,10 @@ METHOD(ike_sa_t, destroy, void,
vip->destroy(vip);
}
this->my_vips->destroy(this->my_vips);
if (this->other_vips->get_count(this->other_vips))
{
charon->bus->assign_vips(charon->bus, &this->public, FALSE);
}
while (this->other_vips->remove_last(this->other_vips,
(void**)&vip) == SUCCESS)
{
@@ -2124,7 +2127,6 @@ METHOD(ike_sa_t, destroy, void,
hydra->attributes->release_address(hydra->attributes, pools, vip, id);
pools->destroy(pools);
}
charon->bus->assign_vip(charon->bus, &this->public, vip, FALSE);
vip->destroy(vip);
}
this->other_vips->destroy(this->other_vips);
@@ -387,6 +387,8 @@ METHOD(task_t, build_r, status_t,
pools->destroy(pools);
return SUCCESS;
}
charon->bus->assign_vips(charon->bus, this->ike_sa, TRUE);
if (pools->get_count(pools) && !this->vips->get_count(this->vips))
{
DBG1(DBG_IKE, "expected a virtual IP request, sending %N",