mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
nwfilter: remove virConnectPtr from internal API calls
Remove the virConnectPtr from the nwfilter's internal API calls as far as possible.
This commit is contained in:
parent
c4b32641f1
commit
dc62c22532
@ -592,27 +592,22 @@ typedef void (*virNWFilterTechDrvShutdown)(void);
|
|||||||
|
|
||||||
enum virDomainNetType;
|
enum virDomainNetType;
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleCreateInstance)(virConnectPtr conn,
|
typedef int (*virNWFilterRuleCreateInstance)(enum virDomainNetType nettype,
|
||||||
enum virDomainNetType nettype,
|
|
||||||
virNWFilterDefPtr filter,
|
virNWFilterDefPtr filter,
|
||||||
virNWFilterRuleDefPtr rule,
|
virNWFilterRuleDefPtr rule,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
virNWFilterHashTablePtr vars,
|
virNWFilterHashTablePtr vars,
|
||||||
virNWFilterRuleInstPtr res);
|
virNWFilterRuleInstPtr res);
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleApplyNewRules)(virConnectPtr conn,
|
typedef int (*virNWFilterRuleApplyNewRules)(const char *ifname,
|
||||||
const char *ifname,
|
|
||||||
int nruleInstances,
|
int nruleInstances,
|
||||||
void **_inst);
|
void **_inst);
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleTeardownNewRules)(virConnectPtr conn,
|
typedef int (*virNWFilterRuleTeardownNewRules)(const char *ifname);
|
||||||
const char *ifname);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleTeardownOldRules)(virConnectPtr conn,
|
typedef int (*virNWFilterRuleTeardownOldRules)(const char *ifname);
|
||||||
const char *ifname);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleRemoveRules)(virConnectPtr conn,
|
typedef int (*virNWFilterRuleRemoveRules)(const char *ifname,
|
||||||
const char *ifname,
|
|
||||||
int nruleInstances,
|
int nruleInstances,
|
||||||
void **_inst);
|
void **_inst);
|
||||||
|
|
||||||
@ -620,8 +615,7 @@ typedef int (*virNWFilterRuleAllTeardown)(const char *ifname);
|
|||||||
|
|
||||||
typedef int (*virNWFilterRuleFreeInstanceData)(void * _inst);
|
typedef int (*virNWFilterRuleFreeInstanceData)(void * _inst);
|
||||||
|
|
||||||
typedef int (*virNWFilterRuleDisplayInstanceData)(virConnectPtr conn,
|
typedef int (*virNWFilterRuleDisplayInstanceData)(void *_inst);
|
||||||
void *_inst);
|
|
||||||
|
|
||||||
typedef int (*virNWFilterCanApplyBasicRules)(void);
|
typedef int (*virNWFilterCanApplyBasicRules)(void);
|
||||||
|
|
||||||
|
@ -1188,8 +1188,7 @@ iptablesEnforceDirection(int directionIn,
|
|||||||
* Convert a single rule into its representation for later instantiation
|
* Convert a single rule into its representation for later instantiation
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success with the result stored in the data structure
|
* Returns 0 in case of success with the result stored in the data structure
|
||||||
* pointed to by res, != 0 otherwise with the error message stored in the
|
* pointed to by res, != 0 otherwise.
|
||||||
* virConnect object.
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
_iptablesCreateRuleInstance(int directionIn,
|
_iptablesCreateRuleInstance(int directionIn,
|
||||||
@ -1917,8 +1916,7 @@ iptablesCreateRuleInstance(virNWFilterDefPtr nwfilter,
|
|||||||
* Convert a single rule into its representation for later instantiation
|
* Convert a single rule into its representation for later instantiation
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success with the result stored in the data structure
|
* Returns 0 in case of success with the result stored in the data structure
|
||||||
* pointed to by res, != 0 otherwise with the error message stored in the
|
* pointed to by res, != 0 otherwise.
|
||||||
* virConnect object.
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ebtablesCreateRuleInstance(char chainPrefix,
|
ebtablesCreateRuleInstance(char chainPrefix,
|
||||||
@ -2503,7 +2501,6 @@ err_exit:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* ebiptablesCreateRuleInstance:
|
* ebiptablesCreateRuleInstance:
|
||||||
* @conn : Pointer to a virConnect object
|
|
||||||
* @nwfilter : The filter
|
* @nwfilter : The filter
|
||||||
* @rule: The rule of the filter to convert
|
* @rule: The rule of the filter to convert
|
||||||
* @ifname : The name of the interface to apply the rule to
|
* @ifname : The name of the interface to apply the rule to
|
||||||
@ -2513,12 +2510,10 @@ err_exit:
|
|||||||
* Convert a single rule into its representation for later instantiation
|
* Convert a single rule into its representation for later instantiation
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success with the result stored in the data structure
|
* Returns 0 in case of success with the result stored in the data structure
|
||||||
* pointed to by res, != 0 otherwise with the error message stored in the
|
* pointed to by res, != 0 otherwise.
|
||||||
* virConnect object.
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ebiptablesCreateRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
|
ebiptablesCreateRuleInstance(enum virDomainNetType nettype ATTRIBUTE_UNUSED,
|
||||||
enum virDomainNetType nettype ATTRIBUTE_UNUSED,
|
|
||||||
virNWFilterDefPtr nwfilter,
|
virNWFilterDefPtr nwfilter,
|
||||||
virNWFilterRuleDefPtr rule,
|
virNWFilterRuleDefPtr rule,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
@ -2610,7 +2605,6 @@ ebiptablesCreateRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
ebiptablesCreateRuleInstanceIterate(
|
ebiptablesCreateRuleInstanceIterate(
|
||||||
virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
||||||
enum virDomainNetType nettype ATTRIBUTE_UNUSED,
|
enum virDomainNetType nettype ATTRIBUTE_UNUSED,
|
||||||
virNWFilterDefPtr nwfilter,
|
virNWFilterDefPtr nwfilter,
|
||||||
virNWFilterRuleDefPtr rule,
|
virNWFilterRuleDefPtr rule,
|
||||||
@ -2630,8 +2624,7 @@ ebiptablesCreateRuleInstanceIterate(
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rc = ebiptablesCreateRuleInstance(conn,
|
rc = ebiptablesCreateRuleInstance(nettype,
|
||||||
nettype,
|
|
||||||
nwfilter,
|
nwfilter,
|
||||||
rule,
|
rule,
|
||||||
ifname,
|
ifname,
|
||||||
@ -2656,8 +2649,7 @@ ebiptablesFreeRuleInstance(void *_inst)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ebiptablesDisplayRuleInstance(virConnectPtr conn ATTRIBUTE_UNUSED,
|
ebiptablesDisplayRuleInstance(void *_inst)
|
||||||
void *_inst)
|
|
||||||
{
|
{
|
||||||
ebiptablesRuleInstPtr inst = (ebiptablesRuleInstPtr)_inst;
|
ebiptablesRuleInstPtr inst = (ebiptablesRuleInstPtr)_inst;
|
||||||
VIR_INFO("Command Template: '%s', Needed protocol: '%s'",
|
VIR_INFO("Command Template: '%s', Needed protocol: '%s'",
|
||||||
@ -3096,7 +3088,6 @@ ebiptablesCanApplyBasicRules(void) {
|
|||||||
/**
|
/**
|
||||||
* ebtablesApplyBasicRules
|
* ebtablesApplyBasicRules
|
||||||
*
|
*
|
||||||
* @conn: virConnect object
|
|
||||||
* @ifname: name of the backend-interface to which to apply the rules
|
* @ifname: name of the backend-interface to which to apply the rules
|
||||||
* @macaddr: MAC address the VM is using in packets sent through the
|
* @macaddr: MAC address the VM is using in packets sent through the
|
||||||
* interface
|
* interface
|
||||||
@ -3552,8 +3543,7 @@ ebtablesCreateTmpRootAndSubChains(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ebiptablesApplyNewRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
ebiptablesApplyNewRules(const char *ifname,
|
||||||
const char *ifname,
|
|
||||||
int nruleInstances,
|
int nruleInstances,
|
||||||
void **_inst)
|
void **_inst)
|
||||||
{
|
{
|
||||||
@ -3824,8 +3814,7 @@ exit_free_sets:
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ebiptablesTearNewRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
ebiptablesTearNewRules(const char *ifname)
|
||||||
const char *ifname)
|
|
||||||
{
|
{
|
||||||
int cli_status;
|
int cli_status;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
@ -3862,8 +3851,7 @@ ebiptablesTearNewRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ebiptablesTearOldRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
ebiptablesTearOldRules(const char *ifname)
|
||||||
const char *ifname)
|
|
||||||
{
|
{
|
||||||
int cli_status;
|
int cli_status;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
@ -3911,7 +3899,6 @@ ebiptablesTearOldRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ebiptablesRemoveRules:
|
* ebiptablesRemoveRules:
|
||||||
* @conn : pointer to virConnect object
|
|
||||||
* @ifname : the name of the interface to which the rules apply
|
* @ifname : the name of the interface to which the rules apply
|
||||||
* @nRuleInstance : the number of given rules
|
* @nRuleInstance : the number of given rules
|
||||||
* @_inst : array of rule instantiation data
|
* @_inst : array of rule instantiation data
|
||||||
@ -3922,8 +3909,7 @@ ebiptablesTearOldRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
* commands failed.
|
* commands failed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ebiptablesRemoveRules(virConnectPtr conn ATTRIBUTE_UNUSED,
|
ebiptablesRemoveRules(const char *ifname ATTRIBUTE_UNUSED,
|
||||||
const char *ifname ATTRIBUTE_UNUSED,
|
|
||||||
int nruleInstances,
|
int nruleInstances,
|
||||||
void **_inst)
|
void **_inst)
|
||||||
{
|
{
|
||||||
|
@ -98,8 +98,7 @@ virNWFilterTechDriverForName(const char *name) {
|
|||||||
* for bidirectional traffic and data needs to be added to the incoming
|
* for bidirectional traffic and data needs to be added to the incoming
|
||||||
* and outgoing chains.
|
* and outgoing chains.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success, 1 in case of an error with the error
|
* Returns 0 in case of success, 1 in case of an error.
|
||||||
* message attached to the virConnect object.
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virNWFilterRuleInstAddData(virNWFilterRuleInstPtr res,
|
virNWFilterRuleInstAddData(virNWFilterRuleInstPtr res,
|
||||||
@ -190,8 +189,7 @@ virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
|
|||||||
* Create a hashmap used for evaluating the firewall rules. Initializes
|
* Create a hashmap used for evaluating the firewall rules. Initializes
|
||||||
* it with the standard variable 'MAC' and 'IP' if provided.
|
* it with the standard variable 'MAC' and 'IP' if provided.
|
||||||
*
|
*
|
||||||
* Returns pointer to hashmap, NULL if an error occcurred and error message
|
* Returns pointer to hashmap, NULL if an error occcurred.
|
||||||
* is attached to the virConnect object.
|
|
||||||
*/
|
*/
|
||||||
virNWFilterHashTablePtr
|
virNWFilterHashTablePtr
|
||||||
virNWFilterCreateVarHashmap(char *macaddr,
|
virNWFilterCreateVarHashmap(char *macaddr,
|
||||||
@ -274,7 +272,6 @@ virNWFilterPrintVars(virHashTablePtr vars,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* virNWFilterRuleInstantiate:
|
* virNWFilterRuleInstantiate:
|
||||||
* @conn: pointer to virConnect object
|
|
||||||
* @techdriver: the driver to use for instantiation
|
* @techdriver: the driver to use for instantiation
|
||||||
* @filter: The filter the rule is part of
|
* @filter: The filter the rule is part of
|
||||||
* @rule : The rule that is to be instantiated
|
* @rule : The rule that is to be instantiated
|
||||||
@ -289,8 +286,7 @@ virNWFilterPrintVars(virHashTablePtr vars,
|
|||||||
* from the instantiation. Returns NULL on error with error reported.
|
* from the instantiation. Returns NULL on error with error reported.
|
||||||
*/
|
*/
|
||||||
static virNWFilterRuleInstPtr
|
static virNWFilterRuleInstPtr
|
||||||
virNWFilterRuleInstantiate(virConnectPtr conn,
|
virNWFilterRuleInstantiate(virNWFilterTechDriverPtr techdriver,
|
||||||
virNWFilterTechDriverPtr techdriver,
|
|
||||||
enum virDomainNetType nettype,
|
enum virDomainNetType nettype,
|
||||||
virNWFilterDefPtr filter,
|
virNWFilterDefPtr filter,
|
||||||
virNWFilterRuleDefPtr rule,
|
virNWFilterRuleDefPtr rule,
|
||||||
@ -308,7 +304,7 @@ virNWFilterRuleInstantiate(virConnectPtr conn,
|
|||||||
|
|
||||||
ret->techdriver = techdriver;
|
ret->techdriver = techdriver;
|
||||||
|
|
||||||
rc = techdriver->createRuleInstance(conn, nettype, filter,
|
rc = techdriver->createRuleInstance(nettype, filter,
|
||||||
rule, ifname, vars, ret);
|
rule, ifname, vars, ret);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@ -359,7 +355,6 @@ err_exit:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* _virNWFilterInstantiateRec:
|
* _virNWFilterInstantiateRec:
|
||||||
* @conn: pointer to virConnect object
|
|
||||||
* @techdriver: The driver to use for instantiation
|
* @techdriver: The driver to use for instantiation
|
||||||
* @filter: The filter to instantiate
|
* @filter: The filter to instantiate
|
||||||
* @ifname: The name of the interface to apply the rules to
|
* @ifname: The name of the interface to apply the rules to
|
||||||
@ -382,8 +377,7 @@ err_exit:
|
|||||||
* resolved -- among other reasons.
|
* resolved -- among other reasons.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
_virNWFilterInstantiateRec(virConnectPtr conn,
|
_virNWFilterInstantiateRec(virNWFilterTechDriverPtr techdriver,
|
||||||
virNWFilterTechDriverPtr techdriver,
|
|
||||||
enum virDomainNetType nettype,
|
enum virDomainNetType nettype,
|
||||||
virNWFilterDefPtr filter,
|
virNWFilterDefPtr filter,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
@ -403,8 +397,7 @@ _virNWFilterInstantiateRec(virConnectPtr conn,
|
|||||||
virNWFilterRuleDefPtr rule = filter->filterEntries[i]->rule;
|
virNWFilterRuleDefPtr rule = filter->filterEntries[i]->rule;
|
||||||
virNWFilterIncludeDefPtr inc = filter->filterEntries[i]->include;
|
virNWFilterIncludeDefPtr inc = filter->filterEntries[i]->include;
|
||||||
if (rule) {
|
if (rule) {
|
||||||
inst = virNWFilterRuleInstantiate(conn,
|
inst = virNWFilterRuleInstantiate(techdriver,
|
||||||
techdriver,
|
|
||||||
nettype,
|
nettype,
|
||||||
filter,
|
filter,
|
||||||
rule,
|
rule,
|
||||||
@ -461,8 +454,7 @@ _virNWFilterInstantiateRec(virConnectPtr conn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = _virNWFilterInstantiateRec(conn,
|
rc = _virNWFilterInstantiateRec(techdriver,
|
||||||
techdriver,
|
|
||||||
nettype,
|
nettype,
|
||||||
next_filter,
|
next_filter,
|
||||||
ifname,
|
ifname,
|
||||||
@ -491,8 +483,7 @@ _virNWFilterInstantiateRec(virConnectPtr conn,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterDetermineMissingVarsRec(virConnectPtr conn,
|
virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
||||||
virNWFilterDefPtr filter,
|
|
||||||
virNWFilterHashTablePtr vars,
|
virNWFilterHashTablePtr vars,
|
||||||
virNWFilterHashTablePtr missing_vars,
|
virNWFilterHashTablePtr missing_vars,
|
||||||
int useNewFilter,
|
int useNewFilter,
|
||||||
@ -559,8 +550,7 @@ virNWFilterDetermineMissingVarsRec(virConnectPtr conn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = virNWFilterDetermineMissingVarsRec(conn,
|
rc = virNWFilterDetermineMissingVarsRec(next_filter,
|
||||||
next_filter,
|
|
||||||
tmpvars,
|
tmpvars,
|
||||||
missing_vars,
|
missing_vars,
|
||||||
useNewFilter,
|
useNewFilter,
|
||||||
@ -617,7 +607,6 @@ virNWFilterRuleInstancesToArray(int nEntries,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* virNWFilterInstantiate:
|
* virNWFilterInstantiate:
|
||||||
* @conn: pointer to virConnect object
|
|
||||||
* @techdriver: The driver to use for instantiation
|
* @techdriver: The driver to use for instantiation
|
||||||
* @filter: The filter to instantiate
|
* @filter: The filter to instantiate
|
||||||
* @ifname: The name of the interface to apply the rules to
|
* @ifname: The name of the interface to apply the rules to
|
||||||
@ -636,8 +625,7 @@ virNWFilterRuleInstancesToArray(int nEntries,
|
|||||||
* Call this function while holding the NWFilter filter update lock
|
* Call this function while holding the NWFilter filter update lock
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
virNWFilterInstantiate(virConnectPtr conn,
|
virNWFilterInstantiate(virNWFilterTechDriverPtr techdriver,
|
||||||
virNWFilterTechDriverPtr techdriver,
|
|
||||||
enum virDomainNetType nettype,
|
enum virDomainNetType nettype,
|
||||||
virNWFilterDefPtr filter,
|
virNWFilterDefPtr filter,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
@ -665,8 +653,7 @@ virNWFilterInstantiate(virConnectPtr conn,
|
|||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = virNWFilterDetermineMissingVarsRec(conn,
|
rc = virNWFilterDetermineMissingVarsRec(filter,
|
||||||
filter,
|
|
||||||
vars,
|
vars,
|
||||||
missing_vars,
|
missing_vars,
|
||||||
useNewFilter,
|
useNewFilter,
|
||||||
@ -697,8 +684,7 @@ virNWFilterInstantiate(virConnectPtr conn,
|
|||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = _virNWFilterInstantiateRec(conn,
|
rc = _virNWFilterInstantiateRec(techdriver,
|
||||||
techdriver,
|
|
||||||
nettype,
|
nettype,
|
||||||
filter,
|
filter,
|
||||||
ifname,
|
ifname,
|
||||||
@ -729,10 +715,10 @@ virNWFilterInstantiate(virConnectPtr conn,
|
|||||||
if (virNWFilterLockIface(ifname))
|
if (virNWFilterLockIface(ifname))
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
|
||||||
rc = techdriver->applyNewRules(conn, ifname, nptrs, ptrs);
|
rc = techdriver->applyNewRules(ifname, nptrs, ptrs);
|
||||||
|
|
||||||
if (teardownOld && rc == 0)
|
if (teardownOld && rc == 0)
|
||||||
techdriver->tearOldRules(conn, ifname);
|
techdriver->tearOldRules(ifname);
|
||||||
|
|
||||||
if (rc == 0 && (virNetDevValidateConfig(ifname, NULL, ifindex) <= 0)) {
|
if (rc == 0 && (virNetDevValidateConfig(ifname, NULL, ifindex) <= 0)) {
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
@ -775,8 +761,7 @@ err_unresolvable_vars:
|
|||||||
* Call this function while holding the NWFilter filter update lock
|
* Call this function while holding the NWFilter filter update lock
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__virNWFilterInstantiateFilter(virConnectPtr conn,
|
__virNWFilterInstantiateFilter(bool teardownOld,
|
||||||
bool teardownOld,
|
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
@ -868,8 +853,7 @@ __virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = virNWFilterInstantiate(conn,
|
rc = virNWFilterInstantiate(techdriver,
|
||||||
techdriver,
|
|
||||||
nettype,
|
nettype,
|
||||||
filter,
|
filter,
|
||||||
ifname,
|
ifname,
|
||||||
@ -924,8 +908,7 @@ _virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = __virNWFilterInstantiateFilter(conn,
|
rc = __virNWFilterInstantiateFilter(teardownOld,
|
||||||
teardownOld,
|
|
||||||
net->ifname,
|
net->ifname,
|
||||||
ifindex,
|
ifindex,
|
||||||
linkdev,
|
linkdev,
|
||||||
@ -946,8 +929,7 @@ cleanup:
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterInstantiateFilterLate(virConnectPtr conn,
|
virNWFilterInstantiateFilterLate(const char *ifname,
|
||||||
const char *ifname,
|
|
||||||
int ifindex,
|
int ifindex,
|
||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
enum virDomainNetType nettype,
|
enum virDomainNetType nettype,
|
||||||
@ -961,8 +943,7 @@ virNWFilterInstantiateFilterLate(virConnectPtr conn,
|
|||||||
|
|
||||||
virNWFilterLockFilterUpdates();
|
virNWFilterLockFilterUpdates();
|
||||||
|
|
||||||
rc = __virNWFilterInstantiateFilter(conn,
|
rc = __virNWFilterInstantiateFilter(true,
|
||||||
1,
|
|
||||||
ifname,
|
ifname,
|
||||||
ifindex,
|
ifindex,
|
||||||
linkdev,
|
linkdev,
|
||||||
@ -1019,8 +1000,7 @@ virNWFilterUpdateInstantiateFilter(virConnectPtr conn,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int virNWFilterRollbackUpdateFilter(virConnectPtr conn,
|
int virNWFilterRollbackUpdateFilter(const virDomainNetDefPtr net)
|
||||||
const virDomainNetDefPtr net)
|
|
||||||
{
|
{
|
||||||
const char *drvname = EBIPTABLES_DRIVER_ID;
|
const char *drvname = EBIPTABLES_DRIVER_ID;
|
||||||
int ifindex;
|
int ifindex;
|
||||||
@ -1041,13 +1021,12 @@ int virNWFilterRollbackUpdateFilter(virConnectPtr conn,
|
|||||||
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return techdriver->tearNewRules(conn, net->ifname);
|
return techdriver->tearNewRules(net->ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterTearOldFilter(virConnectPtr conn,
|
virNWFilterTearOldFilter(virDomainNetDefPtr net)
|
||||||
virDomainNetDefPtr net)
|
|
||||||
{
|
{
|
||||||
const char *drvname = EBIPTABLES_DRIVER_ID;
|
const char *drvname = EBIPTABLES_DRIVER_ID;
|
||||||
int ifindex;
|
int ifindex;
|
||||||
@ -1068,7 +1047,7 @@ virNWFilterTearOldFilter(virConnectPtr conn,
|
|||||||
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
else if (virNWFilterLookupLearnReq(ifindex) != NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return techdriver->tearOldRules(conn, net->ifname);
|
return techdriver->tearOldRules(net->ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1141,14 +1120,13 @@ virNWFilterDomainFWUpdateCB(void *payload,
|
|||||||
|
|
||||||
case STEP_TEAR_NEW:
|
case STEP_TEAR_NEW:
|
||||||
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||||
cb->err = virNWFilterRollbackUpdateFilter(cb->conn,
|
cb->err = virNWFilterRollbackUpdateFilter(net);
|
||||||
net);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_TEAR_OLD:
|
case STEP_TEAR_OLD:
|
||||||
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||||
cb->err = virNWFilterTearOldFilter(cb->conn, net);
|
cb->err = virNWFilterTearOldFilter(net);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,11 @@ int virNWFilterInstantiateFilter(virConnectPtr conn,
|
|||||||
int virNWFilterUpdateInstantiateFilter(virConnectPtr conn,
|
int virNWFilterUpdateInstantiateFilter(virConnectPtr conn,
|
||||||
const virDomainNetDefPtr net,
|
const virDomainNetDefPtr net,
|
||||||
bool *skipIface);
|
bool *skipIface);
|
||||||
int virNWFilterRollbackUpdateFilter(virConnectPtr conn,
|
int virNWFilterRollbackUpdateFilter(const virDomainNetDefPtr net);
|
||||||
const virDomainNetDefPtr net);
|
|
||||||
|
|
||||||
int virNWFilterTearOldFilter(virConnectPtr conn,
|
int virNWFilterTearOldFilter(const virDomainNetDefPtr net);
|
||||||
const virDomainNetDefPtr net);
|
|
||||||
|
|
||||||
int virNWFilterInstantiateFilterLate(virConnectPtr conn,
|
int virNWFilterInstantiateFilterLate(const char *ifname,
|
||||||
const char *ifname,
|
|
||||||
int ifindex,
|
int ifindex,
|
||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
enum virDomainNetType nettype,
|
enum virDomainNetType nettype,
|
||||||
|
@ -707,8 +707,7 @@ learnIPAddressThread(void *arg)
|
|||||||
"cache for interface %s"), inetaddr, req->ifname);
|
"cache for interface %s"), inetaddr, req->ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = virNWFilterInstantiateFilterLate(NULL,
|
ret = virNWFilterInstantiateFilterLate(req->ifname,
|
||||||
req->ifname,
|
|
||||||
req->ifindex,
|
req->ifindex,
|
||||||
req->linkdev,
|
req->linkdev,
|
||||||
req->nettype,
|
req->nettype,
|
||||||
|
Loading…
Reference in New Issue
Block a user