mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
pass info where request stems from to have rules applied
For the decision on whether to instantiate the rules, the check for a pending IP address learn request is not sufficient since then only the thread could instantiate the rules. So, a boolean needs to be passed when the thread instantiates the filter rules late and the IP address learn request is still pending in order to override the check for the pending learn request. If the rules are to be updated while the thread is active, this will not be done immediately but the thread will do that later on.
This commit is contained in:
parent
9f87b631ce
commit
5c77fddf4e
@ -543,6 +543,8 @@ virNWFilterRuleInstancesToArray(int nEntries,
|
|||||||
* @ifname: The name of the interface to apply the rules to
|
* @ifname: The name of the interface to apply the rules to
|
||||||
* @vars: A map holding variable names and values used for instantiating
|
* @vars: A map holding variable names and values used for instantiating
|
||||||
* the filter and its subfilters.
|
* the filter and its subfilters.
|
||||||
|
* @forceWithPendingReq: Ignore the check whether a pending learn request
|
||||||
|
* is active; 'true' only when the rules are applied late
|
||||||
*
|
*
|
||||||
* Returns 0 on success, a value otherwise.
|
* Returns 0 on success, a value otherwise.
|
||||||
*
|
*
|
||||||
@ -563,7 +565,8 @@ virNWFilterInstantiate(virConnectPtr conn,
|
|||||||
enum instCase useNewFilter, int *foundNewFilter,
|
enum instCase useNewFilter, int *foundNewFilter,
|
||||||
bool teardownOld,
|
bool teardownOld,
|
||||||
const unsigned char *macaddr,
|
const unsigned char *macaddr,
|
||||||
virNWFilterDriverStatePtr driver)
|
virNWFilterDriverStatePtr driver,
|
||||||
|
bool forceWithPendingReq)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
int j, nptrs;
|
int j, nptrs;
|
||||||
@ -610,7 +613,8 @@ virNWFilterInstantiate(virConnectPtr conn,
|
|||||||
} else if (virHashSize(missing_vars->hashTable) > 1) {
|
} else if (virHashSize(missing_vars->hashTable) > 1) {
|
||||||
rc = 1;
|
rc = 1;
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
} else if (virNWFilterLookupLearnReq(ifindex) == NULL) {
|
} else if (!forceWithPendingReq &&
|
||||||
|
virNWFilterLookupLearnReq(ifindex) != NULL) {
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,7 +692,8 @@ __virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams,
|
virNWFilterHashTablePtr filterparams,
|
||||||
enum instCase useNewFilter,
|
enum instCase useNewFilter,
|
||||||
virNWFilterDriverStatePtr driver)
|
virNWFilterDriverStatePtr driver,
|
||||||
|
bool forceWithPendingReq)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
const char *drvname = EBIPTABLES_DRIVER_ID;
|
const char *drvname = EBIPTABLES_DRIVER_ID;
|
||||||
@ -789,7 +794,8 @@ __virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
useNewFilter, &foundNewFilter,
|
useNewFilter, &foundNewFilter,
|
||||||
teardownOld,
|
teardownOld,
|
||||||
macaddr,
|
macaddr,
|
||||||
driver);
|
driver,
|
||||||
|
forceWithPendingReq);
|
||||||
|
|
||||||
virNWFilterHashTableFree(vars);
|
virNWFilterHashTableFree(vars);
|
||||||
|
|
||||||
@ -830,7 +836,8 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
net->filter,
|
net->filter,
|
||||||
net->filterparams,
|
net->filterparams,
|
||||||
useNewFilter,
|
useNewFilter,
|
||||||
conn->nwfilterPrivateData);
|
conn->nwfilterPrivateData,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -856,7 +863,8 @@ virNWFilterInstantiateFilterLate(virConnectPtr conn,
|
|||||||
filtername,
|
filtername,
|
||||||
filterparams,
|
filterparams,
|
||||||
INSTANTIATE_ALWAYS,
|
INSTANTIATE_ALWAYS,
|
||||||
driver);
|
driver,
|
||||||
|
true);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
//something went wrong... 'DOWN' the interface
|
//something went wrong... 'DOWN' the interface
|
||||||
if (ifaceCheck(false, ifname, NULL, ifindex) != 0 ||
|
if (ifaceCheck(false, ifname, NULL, ifindex) != 0 ||
|
||||||
|
Loading…
Reference in New Issue
Block a user