aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Berger <stefanb@us.ibm.com>2010-04-30 08:12:26 -0400
committerStefan Berger <stefanb@us.ibm.com>2010-04-30 08:12:26 -0400
commit5054e89272cf121c4c1b7d87cb73adc4739c368e (patch)
tree24390aadffdf959bf7c59c190384f0891cb97ada
parentSyncronize the teardown of rules with the thread (diff)
downloadlibvirt-5054e89272cf121c4c1b7d87cb73adc4739c368e.tar.gz
libvirt-5054e89272cf121c4c1b7d87cb73adc4739c368e.tar.bz2
libvirt-5054e89272cf121c4c1b7d87cb73adc4739c368e.zip
Prevent updates while IP address learn thread is running
Prevent updating and tearing down of filter while the IP address learning thread is running and has its own filtering rules applied.
-rw-r--r--src/nwfilter/nwfilter_gentech_driver.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 9fede3b67..0108197bf 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -610,6 +610,8 @@ virNWFilterInstantiate(virConnectPtr conn,
} else if (virHashSize(missing_vars->hashTable) > 1) {
rc = 1;
goto err_exit;
+ } else if (virNWFilterLookupLearnReq(ifindex) == NULL) {
+ goto err_exit;
}
rc = _virNWFilterInstantiateRec(conn,
@@ -890,7 +892,9 @@ int virNWFilterRollbackUpdateFilter(virConnectPtr conn,
const virDomainNetDefPtr net)
{
const char *drvname = EBIPTABLES_DRIVER_ID;
+ int ifindex;
virNWFilterTechDriverPtr techdriver;
+
techdriver = virNWFilterTechDriverForName(drvname);
if (!techdriver) {
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
@@ -900,6 +904,11 @@ int virNWFilterRollbackUpdateFilter(virConnectPtr conn,
return 1;
}
+ /* don't tear anything while the address is being learned */
+ if (ifaceGetIndex(true, net->ifname, &ifindex) == 0 &&
+ virNWFilterLookupLearnReq(ifindex) != NULL)
+ return 0;
+
return techdriver->tearNewRules(conn, net->ifname);
}
@@ -909,7 +918,9 @@ virNWFilterTearOldFilter(virConnectPtr conn,
virDomainNetDefPtr net)
{
const char *drvname = EBIPTABLES_DRIVER_ID;
+ int ifindex;
virNWFilterTechDriverPtr techdriver;
+
techdriver = virNWFilterTechDriverForName(drvname);
if (!techdriver) {
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
@@ -919,6 +930,11 @@ virNWFilterTearOldFilter(virConnectPtr conn,
return 1;
}
+ /* don't tear anything while the address is being learned */
+ if (ifaceGetIndex(true, net->ifname, &ifindex) == 0 &&
+ virNWFilterLookupLearnReq(ifindex) != NULL)
+ return 0;
+
return techdriver->tearOldRules(conn, net->ifname);
}