mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 05:17:54 +03:00
nwfilter: remove virNWFilterHashTable typedefs entirely
All the code now just uses the virHashTablePtr type directly. Reviewed-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
1cf16d755e
commit
d60896321b
@ -10869,7 +10869,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
char *vhostuser_type = NULL;
|
char *vhostuser_type = NULL;
|
||||||
char *trustGuestRxFilters = NULL;
|
char *trustGuestRxFilters = NULL;
|
||||||
char *vhost_path = NULL;
|
char *vhost_path = NULL;
|
||||||
virNWFilterHashTablePtr filterparams = NULL;
|
virHashTablePtr filterparams = NULL;
|
||||||
virDomainActualNetDefPtr actual = NULL;
|
virDomainActualNetDefPtr actual = NULL;
|
||||||
xmlNodePtr oldnode = ctxt->node;
|
xmlNodePtr oldnode = ctxt->node;
|
||||||
virDomainChrSourceReconnectDef reconnect = {0};
|
virDomainChrSourceReconnectDef reconnect = {0};
|
||||||
|
@ -1054,7 +1054,7 @@ struct _virDomainNetDef {
|
|||||||
virNetDevIPInfo guestIP;
|
virNetDevIPInfo guestIP;
|
||||||
virDomainDeviceInfo info;
|
virDomainDeviceInfo info;
|
||||||
char *filter;
|
char *filter;
|
||||||
virNWFilterHashTablePtr filterparams;
|
virHashTablePtr filterparams;
|
||||||
virNetDevBandwidthPtr bandwidth;
|
virNetDevBandwidthPtr bandwidth;
|
||||||
virNetDevVlan vlan;
|
virNetDevVlan vlan;
|
||||||
int trustGuestRxFilters; /* enum virTristateBool */
|
int trustGuestRxFilters; /* enum virTristateBool */
|
||||||
|
@ -501,7 +501,7 @@ typedef struct _virNWFilterIncludeDef virNWFilterIncludeDef;
|
|||||||
typedef virNWFilterIncludeDef *virNWFilterIncludeDefPtr;
|
typedef virNWFilterIncludeDef *virNWFilterIncludeDefPtr;
|
||||||
struct _virNWFilterIncludeDef {
|
struct _virNWFilterIncludeDef {
|
||||||
char *filterref;
|
char *filterref;
|
||||||
virNWFilterHashTablePtr params;
|
virHashTablePtr params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
#define VIR_FROM_THIS VIR_FROM_NWFILTER
|
||||||
|
|
||||||
static virMutex ipAddressMapLock = VIR_MUTEX_INITIALIZER;
|
static virMutex ipAddressMapLock = VIR_MUTEX_INITIALIZER;
|
||||||
static virNWFilterHashTablePtr ipAddressMap;
|
static virHashTablePtr ipAddressMap;
|
||||||
|
|
||||||
|
|
||||||
/* Add an IP address to the list of IP addresses an interface is
|
/* Add an IP address to the list of IP addresses an interface is
|
||||||
|
@ -348,7 +348,7 @@ virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntryPtr cie,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
|
virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
|
||||||
virNWFilterHashTablePtr hash,
|
virHashTablePtr hash,
|
||||||
const virNWFilterVarAccess *varAccess)
|
const virNWFilterVarAccess *varAccess)
|
||||||
{
|
{
|
||||||
virNWFilterVarValuePtr varValue;
|
virNWFilterVarValuePtr varValue;
|
||||||
@ -415,7 +415,7 @@ virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
|
|||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
|
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
|
||||||
virNWFilterHashTablePtr hash)
|
virHashTablePtr hash)
|
||||||
{
|
{
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
virNWFilterVarValuePtr varValue, tmp;
|
virNWFilterVarValuePtr varValue, tmp;
|
||||||
@ -473,7 +473,7 @@ virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
|
|||||||
* be created.
|
* be created.
|
||||||
*/
|
*/
|
||||||
virNWFilterVarCombIterPtr
|
virNWFilterVarCombIterPtr
|
||||||
virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash,
|
virNWFilterVarCombIterCreate(virHashTablePtr hash,
|
||||||
virNWFilterVarAccessPtr *varAccess,
|
virNWFilterVarAccessPtr *varAccess,
|
||||||
size_t nVarAccess)
|
size_t nVarAccess)
|
||||||
{
|
{
|
||||||
@ -631,14 +631,14 @@ hashDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virNWFilterHashTablePtr
|
virHashTablePtr
|
||||||
virNWFilterHashTableCreate(int n)
|
virNWFilterHashTableCreate(int n)
|
||||||
{
|
{
|
||||||
return virHashCreate(n, hashDataFree);
|
return virHashCreate(n, hashDataFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct addToTableStruct {
|
struct addToTableStruct {
|
||||||
virNWFilterHashTablePtr target;
|
virHashTablePtr target;
|
||||||
int errOccurred;
|
int errOccurred;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -668,8 +668,8 @@ addToTable(void *payload, const void *name, void *data)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterHashTablePutAll(virNWFilterHashTablePtr src,
|
virNWFilterHashTablePutAll(virHashTablePtr src,
|
||||||
virNWFilterHashTablePtr dest)
|
virHashTablePtr dest)
|
||||||
{
|
{
|
||||||
struct addToTableStruct atts = {
|
struct addToTableStruct atts = {
|
||||||
.target = dest,
|
.target = dest,
|
||||||
@ -698,8 +698,8 @@ virNWFilterVarValueCompare(const void *a, const void *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
|
virNWFilterHashTableEqual(virHashTablePtr a,
|
||||||
virNWFilterHashTablePtr b)
|
virHashTablePtr b)
|
||||||
{
|
{
|
||||||
return virHashEqual(a, b, virNWFilterVarValueCompare);
|
return virHashEqual(a, b, virNWFilterVarValueCompare);
|
||||||
}
|
}
|
||||||
@ -723,13 +723,13 @@ virNWFilterParseVarValue(const char *val)
|
|||||||
return virNWFilterVarValueCreateSimpleCopyValue(val);
|
return virNWFilterVarValueCreateSimpleCopyValue(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
virNWFilterHashTablePtr
|
virHashTablePtr
|
||||||
virNWFilterParseParamAttributes(xmlNodePtr cur)
|
virNWFilterParseParamAttributes(xmlNodePtr cur)
|
||||||
{
|
{
|
||||||
char *nam, *val;
|
char *nam, *val;
|
||||||
virNWFilterVarValuePtr value;
|
virNWFilterVarValuePtr value;
|
||||||
|
|
||||||
virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
|
virHashTablePtr table = virNWFilterHashTableCreate(0);
|
||||||
if (!table)
|
if (!table)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -791,7 +791,7 @@ virNWFilterFormatParameterNameSorter(const virHashKeyValuePair *a,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterFormatParamAttributes(virBufferPtr buf,
|
virNWFilterFormatParamAttributes(virBufferPtr buf,
|
||||||
virNWFilterHashTablePtr table,
|
virHashTablePtr table,
|
||||||
const char *filterref)
|
const char *filterref)
|
||||||
{
|
{
|
||||||
virHashKeyValuePairPtr items;
|
virHashKeyValuePairPtr items;
|
||||||
@ -1023,7 +1023,7 @@ virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *vap)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *varAccess,
|
virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *varAccess,
|
||||||
const virNWFilterHashTable *hash)
|
const virHashTable *hash)
|
||||||
{
|
{
|
||||||
const char *varName = virNWFilterVarAccessGetVarName(varAccess);
|
const char *varName = virNWFilterVarAccessGetVarName(varAccess);
|
||||||
const char *res;
|
const char *res;
|
||||||
|
@ -63,19 +63,16 @@ int virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value);
|
|||||||
int virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value);
|
int virNWFilterVarValueAddValueCopy(virNWFilterVarValuePtr val, const char *value);
|
||||||
int virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value);
|
int virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value);
|
||||||
|
|
||||||
typedef virHashTable virNWFilterHashTable;
|
virHashTablePtr virNWFilterParseParamAttributes(xmlNodePtr cur);
|
||||||
typedef virHashTable *virNWFilterHashTablePtr;
|
|
||||||
|
|
||||||
virNWFilterHashTablePtr virNWFilterParseParamAttributes(xmlNodePtr cur);
|
|
||||||
int virNWFilterFormatParamAttributes(virBufferPtr buf,
|
int virNWFilterFormatParamAttributes(virBufferPtr buf,
|
||||||
virNWFilterHashTablePtr table,
|
virHashTablePtr table,
|
||||||
const char *filterref);
|
const char *filterref);
|
||||||
|
|
||||||
virNWFilterHashTablePtr virNWFilterHashTableCreate(int n);
|
virHashTablePtr virNWFilterHashTableCreate(int n);
|
||||||
int virNWFilterHashTablePutAll(virNWFilterHashTablePtr src,
|
int virNWFilterHashTablePutAll(virHashTablePtr src,
|
||||||
virNWFilterHashTablePtr dest);
|
virHashTablePtr dest);
|
||||||
bool virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
|
bool virNWFilterHashTableEqual(virHashTablePtr a,
|
||||||
virNWFilterHashTablePtr b);
|
virHashTablePtr b);
|
||||||
|
|
||||||
# define VALID_VARNAME \
|
# define VALID_VARNAME \
|
||||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
|
||||||
@ -123,7 +120,7 @@ virNWFilterVarAccessType virNWFilterVarAccessGetType(
|
|||||||
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
|
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
|
||||||
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);
|
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);
|
||||||
bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *vap,
|
bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *vap,
|
||||||
const virNWFilterHashTable *hash);
|
const virHashTable *hash);
|
||||||
|
|
||||||
typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry;
|
typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry;
|
||||||
typedef virNWFilterVarCombIterEntry *virNWFilterVarCombIterEntryPtr;
|
typedef virNWFilterVarCombIterEntry *virNWFilterVarCombIterEntryPtr;
|
||||||
@ -139,12 +136,12 @@ struct _virNWFilterVarCombIterEntry {
|
|||||||
typedef struct _virNWFilterVarCombIter virNWFilterVarCombIter;
|
typedef struct _virNWFilterVarCombIter virNWFilterVarCombIter;
|
||||||
typedef virNWFilterVarCombIter *virNWFilterVarCombIterPtr;
|
typedef virNWFilterVarCombIter *virNWFilterVarCombIterPtr;
|
||||||
struct _virNWFilterVarCombIter {
|
struct _virNWFilterVarCombIter {
|
||||||
virNWFilterHashTablePtr hashTable;
|
virHashTablePtr hashTable;
|
||||||
size_t nIter;
|
size_t nIter;
|
||||||
virNWFilterVarCombIterEntry iter[0];
|
virNWFilterVarCombIterEntry iter[0];
|
||||||
};
|
};
|
||||||
virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate(
|
virNWFilterVarCombIterPtr virNWFilterVarCombIterCreate(
|
||||||
virNWFilterHashTablePtr hash,
|
virHashTablePtr hash,
|
||||||
virNWFilterVarAccessPtr *vars,
|
virNWFilterVarAccessPtr *vars,
|
||||||
size_t nVars);
|
size_t nVars);
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ struct _virNWFilterSnoopReq {
|
|||||||
char ifkey[VIR_IFKEY_LEN];
|
char ifkey[VIR_IFKEY_LEN];
|
||||||
virMacAddr macaddr;
|
virMacAddr macaddr;
|
||||||
char *filtername;
|
char *filtername;
|
||||||
virNWFilterHashTablePtr vars;
|
virHashTablePtr vars;
|
||||||
virNWFilterDriverStatePtr driver;
|
virNWFilterDriverStatePtr driver;
|
||||||
/* start and end of lease list, ordered by lease time */
|
/* start and end of lease list, ordered by lease time */
|
||||||
virNWFilterSnoopIPLeasePtr start;
|
virNWFilterSnoopIPLeasePtr start;
|
||||||
@ -1611,7 +1611,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|||||||
const unsigned char *vmuuid,
|
const unsigned char *vmuuid,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams,
|
virHashTablePtr filterparams,
|
||||||
virNWFilterDriverStatePtr driver)
|
virNWFilterDriverStatePtr driver)
|
||||||
{
|
{
|
||||||
virNWFilterSnoopReqPtr req;
|
virNWFilterSnoopReqPtr req;
|
||||||
@ -2255,7 +2255,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
|
|||||||
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
||||||
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
||||||
const char *filtername ATTRIBUTE_UNUSED,
|
const char *filtername ATTRIBUTE_UNUSED,
|
||||||
virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
|
virHashTablePtr filterparams ATTRIBUTE_UNUSED,
|
||||||
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED)
|
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -35,7 +35,7 @@ int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|||||||
const unsigned char *vmuuid,
|
const unsigned char *vmuuid,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams,
|
virHashTablePtr filterparams,
|
||||||
virNWFilterDriverStatePtr driver);
|
virNWFilterDriverStatePtr driver);
|
||||||
void virNWFilterDHCPSnoopEnd(const char *ifname);
|
void virNWFilterDHCPSnoopEnd(const char *ifname);
|
||||||
#endif /* __NWFILTER_DHCPSNOOP_H */
|
#endif /* __NWFILTER_DHCPSNOOP_H */
|
||||||
|
@ -142,7 +142,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInstPtr inst)
|
|||||||
* Adds a couple of standard keys (MAC, IP) to the hash table.
|
* Adds a couple of standard keys (MAC, IP) to the hash table.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
|
virNWFilterVarHashmapAddStdValues(virHashTablePtr table,
|
||||||
char *macaddr,
|
char *macaddr,
|
||||||
const virNWFilterVarValue *ipaddr)
|
const virNWFilterVarValue *ipaddr)
|
||||||
{
|
{
|
||||||
@ -191,11 +191,11 @@ virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
|
|||||||
*
|
*
|
||||||
* Returns pointer to hashmap, NULL if an error occurred.
|
* Returns pointer to hashmap, NULL if an error occurred.
|
||||||
*/
|
*/
|
||||||
virNWFilterHashTablePtr
|
virHashTablePtr
|
||||||
virNWFilterCreateVarHashmap(char *macaddr,
|
virNWFilterCreateVarHashmap(char *macaddr,
|
||||||
const virNWFilterVarValue *ipaddr)
|
const virNWFilterVarValue *ipaddr)
|
||||||
{
|
{
|
||||||
virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
|
virHashTablePtr table = virNWFilterHashTableCreate(0);
|
||||||
if (!table)
|
if (!table)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ virNWFilterCreateVarHashmap(char *macaddr,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a virNWFilterHashTable into a string of comma-separated
|
* Convert a virHashTable into a string of comma-separated
|
||||||
* variable names.
|
* variable names.
|
||||||
*/
|
*/
|
||||||
struct printString
|
struct printString
|
||||||
@ -278,11 +278,11 @@ virNWFilterPrintVars(virHashTablePtr vars,
|
|||||||
* Creates a new hash table with contents of var1 and var2 added where
|
* Creates a new hash table with contents of var1 and var2 added where
|
||||||
* contents of var2 will overwrite those of var1.
|
* contents of var2 will overwrite those of var1.
|
||||||
*/
|
*/
|
||||||
static virNWFilterHashTablePtr
|
static virHashTablePtr
|
||||||
virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
|
virNWFilterCreateVarsFrom(virHashTablePtr vars1,
|
||||||
virNWFilterHashTablePtr vars2)
|
virHashTablePtr vars2)
|
||||||
{
|
{
|
||||||
virNWFilterHashTablePtr res = virNWFilterHashTableCreate(0);
|
virHashTablePtr res = virNWFilterHashTableCreate(0);
|
||||||
if (!res)
|
if (!res)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
|
|||||||
static int
|
static int
|
||||||
virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
|
virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
|
||||||
virNWFilterDefPtr def,
|
virNWFilterDefPtr def,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
enum instCase useNewFilter,
|
enum instCase useNewFilter,
|
||||||
bool *foundNewFilter,
|
bool *foundNewFilter,
|
||||||
virNWFilterInstPtr inst);
|
virNWFilterInstPtr inst);
|
||||||
@ -338,7 +338,7 @@ virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
|
|||||||
static int
|
static int
|
||||||
virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
||||||
virNWFilterRuleDefPtr rule,
|
virNWFilterRuleDefPtr rule,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
virNWFilterInstPtr inst)
|
virNWFilterInstPtr inst)
|
||||||
{
|
{
|
||||||
virNWFilterRuleInstPtr ruleinst;
|
virNWFilterRuleInstPtr ruleinst;
|
||||||
@ -371,13 +371,13 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
|||||||
static int
|
static int
|
||||||
virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
|
virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
|
||||||
virNWFilterIncludeDefPtr inc,
|
virNWFilterIncludeDefPtr inc,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
enum instCase useNewFilter,
|
enum instCase useNewFilter,
|
||||||
bool *foundNewFilter,
|
bool *foundNewFilter,
|
||||||
virNWFilterInstPtr inst)
|
virNWFilterInstPtr inst)
|
||||||
{
|
{
|
||||||
virNWFilterObjPtr obj;
|
virNWFilterObjPtr obj;
|
||||||
virNWFilterHashTablePtr tmpvars = NULL;
|
virHashTablePtr tmpvars = NULL;
|
||||||
virNWFilterDefPtr childdef;
|
virNWFilterDefPtr childdef;
|
||||||
virNWFilterDefPtr newChilddef;
|
virNWFilterDefPtr newChilddef;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -452,7 +452,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterDriverStatePtr driver,
|
|||||||
static int
|
static int
|
||||||
virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
|
virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
|
||||||
virNWFilterDefPtr def,
|
virNWFilterDefPtr def,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
enum instCase useNewFilter,
|
enum instCase useNewFilter,
|
||||||
bool *foundNewFilter,
|
bool *foundNewFilter,
|
||||||
virNWFilterInstPtr inst)
|
virNWFilterInstPtr inst)
|
||||||
@ -487,8 +487,8 @@ virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
virNWFilterHashTablePtr missing_vars,
|
virHashTablePtr missing_vars,
|
||||||
int useNewFilter,
|
int useNewFilter,
|
||||||
virNWFilterDriverStatePtr driver)
|
virNWFilterDriverStatePtr driver)
|
||||||
{
|
{
|
||||||
@ -498,7 +498,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
|||||||
virNWFilterDefPtr next_filter;
|
virNWFilterDefPtr next_filter;
|
||||||
virNWFilterDefPtr newNext_filter;
|
virNWFilterDefPtr newNext_filter;
|
||||||
virNWFilterVarValuePtr val;
|
virNWFilterVarValuePtr val;
|
||||||
virNWFilterHashTablePtr tmpvars;
|
virHashTablePtr tmpvars;
|
||||||
|
|
||||||
for (i = 0; i < filter->nentries; i++) {
|
for (i = 0; i < filter->nentries; i++) {
|
||||||
virNWFilterRuleDefPtr rule = filter->filterEntries[i]->rule;
|
virNWFilterRuleDefPtr rule = filter->filterEntries[i]->rule;
|
||||||
@ -600,7 +600,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
|
|||||||
const char *ifname,
|
const char *ifname,
|
||||||
int ifindex,
|
int ifindex,
|
||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
enum instCase useNewFilter,
|
enum instCase useNewFilter,
|
||||||
bool *foundNewFilter,
|
bool *foundNewFilter,
|
||||||
bool teardownOld,
|
bool teardownOld,
|
||||||
@ -616,7 +616,7 @@ virNWFilterDoInstantiate(const unsigned char *vmuuid,
|
|||||||
const char *learning;
|
const char *learning;
|
||||||
bool reportIP = false;
|
bool reportIP = false;
|
||||||
|
|
||||||
virNWFilterHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
|
virHashTablePtr missing_vars = virNWFilterHashTableCreate(0);
|
||||||
|
|
||||||
memset(&inst, 0, sizeof(inst));
|
memset(&inst, 0, sizeof(inst));
|
||||||
|
|
||||||
@ -754,7 +754,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
|
|||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams,
|
virHashTablePtr filterparams,
|
||||||
enum instCase useNewFilter,
|
enum instCase useNewFilter,
|
||||||
bool forceWithPendingReq,
|
bool forceWithPendingReq,
|
||||||
bool *foundNewFilter)
|
bool *foundNewFilter)
|
||||||
@ -763,7 +763,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverStatePtr driver,
|
|||||||
const char *drvname = EBIPTABLES_DRIVER_ID;
|
const char *drvname = EBIPTABLES_DRIVER_ID;
|
||||||
virNWFilterTechDriverPtr techdriver;
|
virNWFilterTechDriverPtr techdriver;
|
||||||
virNWFilterObjPtr obj;
|
virNWFilterObjPtr obj;
|
||||||
virNWFilterHashTablePtr vars, vars1;
|
virHashTablePtr vars, vars1;
|
||||||
virNWFilterDefPtr filter;
|
virNWFilterDefPtr filter;
|
||||||
virNWFilterDefPtr newFilter;
|
virNWFilterDefPtr newFilter;
|
||||||
char vmmacaddr[VIR_MAC_STRING_BUFLEN] = {0};
|
char vmmacaddr[VIR_MAC_STRING_BUFLEN] = {0};
|
||||||
@ -896,7 +896,7 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
|
|||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams)
|
virHashTablePtr filterparams)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
bool foundNewFilter = false;
|
bool foundNewFilter = false;
|
||||||
|
@ -53,12 +53,12 @@ int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
|
|||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams);
|
virHashTablePtr filterparams);
|
||||||
|
|
||||||
int virNWFilterTeardownFilter(const virDomainNetDef *net);
|
int virNWFilterTeardownFilter(const virDomainNetDef *net);
|
||||||
|
|
||||||
virNWFilterHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
|
virHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
|
||||||
const virNWFilterVarValue *value);
|
const virNWFilterVarValue *value);
|
||||||
|
|
||||||
int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
|
int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
|
||||||
void *data);
|
void *data);
|
||||||
|
@ -692,14 +692,14 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
|||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams,
|
virHashTablePtr filterparams,
|
||||||
virNWFilterDriverStatePtr driver,
|
virNWFilterDriverStatePtr driver,
|
||||||
enum howDetect howDetect)
|
enum howDetect howDetect)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
virThread thread;
|
virThread thread;
|
||||||
virNWFilterIPAddrLearnReqPtr req = NULL;
|
virNWFilterIPAddrLearnReqPtr req = NULL;
|
||||||
virNWFilterHashTablePtr ht = NULL;
|
virHashTablePtr ht = NULL;
|
||||||
|
|
||||||
if (howDetect == 0)
|
if (howDetect == 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -781,7 +781,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
|
|||||||
const char *linkdev ATTRIBUTE_UNUSED,
|
const char *linkdev ATTRIBUTE_UNUSED,
|
||||||
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
||||||
const char *filtername ATTRIBUTE_UNUSED,
|
const char *filtername ATTRIBUTE_UNUSED,
|
||||||
virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
|
virHashTablePtr filterparams ATTRIBUTE_UNUSED,
|
||||||
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
|
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
|
||||||
enum howDetect howDetect ATTRIBUTE_UNUSED)
|
enum howDetect howDetect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ struct _virNWFilterIPAddrLearnReq {
|
|||||||
char linkdev[IF_NAMESIZE];
|
char linkdev[IF_NAMESIZE];
|
||||||
virMacAddr macaddr;
|
virMacAddr macaddr;
|
||||||
char *filtername;
|
char *filtername;
|
||||||
virNWFilterHashTablePtr filterparams;
|
virHashTablePtr filterparams;
|
||||||
virNWFilterDriverStatePtr driver;
|
virNWFilterDriverStatePtr driver;
|
||||||
enum howDetect howDetect;
|
enum howDetect howDetect;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
|||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
const virMacAddr *macaddr,
|
const virMacAddr *macaddr,
|
||||||
const char *filtername,
|
const char *filtername,
|
||||||
virNWFilterHashTablePtr filterparams,
|
virHashTablePtr filterparams,
|
||||||
virNWFilterDriverStatePtr driver,
|
virNWFilterDriverStatePtr driver,
|
||||||
enum howDetect howDetect);
|
enum howDetect howDetect);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ struct _virNWFilterRuleInst {
|
|||||||
virNWFilterChainPriority chainPriority;
|
virNWFilterChainPriority chainPriority;
|
||||||
virNWFilterRuleDefPtr def;
|
virNWFilterRuleDefPtr def;
|
||||||
virNWFilterRulePriority priority;
|
virNWFilterRulePriority priority;
|
||||||
virNWFilterHashTablePtr vars;
|
virHashTablePtr vars;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,11 +147,11 @@ static const char *commonRules[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static virNWFilterHashTablePtr
|
static virHashTablePtr
|
||||||
virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
|
virNWFilterCreateVarsFrom(virHashTablePtr vars1,
|
||||||
virNWFilterHashTablePtr vars2)
|
virHashTablePtr vars2)
|
||||||
{
|
{
|
||||||
virNWFilterHashTablePtr res = virNWFilterHashTableCreate(0);
|
virHashTablePtr res = virNWFilterHashTableCreate(0);
|
||||||
if (!res)
|
if (!res)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -199,13 +199,13 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterDefToInst(const char *xml,
|
virNWFilterDefToInst(const char *xml,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
virNWFilterInstPtr inst);
|
virNWFilterInstPtr inst);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
||||||
virNWFilterRuleDefPtr rule,
|
virNWFilterRuleDefPtr rule,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
virNWFilterInstPtr inst)
|
virNWFilterInstPtr inst)
|
||||||
{
|
{
|
||||||
virNWFilterRuleInstPtr ruleinst;
|
virNWFilterRuleInstPtr ruleinst;
|
||||||
@ -238,10 +238,10 @@ virNWFilterRuleDefToRuleInst(virNWFilterDefPtr def,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
|
virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
virNWFilterInstPtr inst)
|
virNWFilterInstPtr inst)
|
||||||
{
|
{
|
||||||
virNWFilterHashTablePtr tmpvars = NULL;
|
virHashTablePtr tmpvars = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *xml;
|
char *xml;
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDefPtr inc,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virNWFilterDefToInst(const char *xml,
|
virNWFilterDefToInst(const char *xml,
|
||||||
virNWFilterHashTablePtr vars,
|
virHashTablePtr vars,
|
||||||
virNWFilterInstPtr inst)
|
virNWFilterInstPtr inst)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -326,7 +326,7 @@ static void testRemoveCommonRules(char *rules)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int testSetOneParameter(virNWFilterHashTablePtr vars,
|
static int testSetOneParameter(virHashTablePtr vars,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *value)
|
const char *value)
|
||||||
{
|
{
|
||||||
@ -350,7 +350,7 @@ static int testSetOneParameter(virNWFilterHashTablePtr vars,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testSetDefaultParameters(virNWFilterHashTablePtr vars)
|
static int testSetDefaultParameters(virHashTablePtr vars)
|
||||||
{
|
{
|
||||||
if (testSetOneParameter(vars, "IPSETNAME", "tck_test") < 0 ||
|
if (testSetOneParameter(vars, "IPSETNAME", "tck_test") < 0 ||
|
||||||
testSetOneParameter(vars, "A", "1.1.1.1") ||
|
testSetOneParameter(vars, "A", "1.1.1.1") ||
|
||||||
@ -374,7 +374,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
{
|
{
|
||||||
char *actualargv = NULL;
|
char *actualargv = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
virNWFilterHashTablePtr vars = virNWFilterHashTableCreate(0);
|
virHashTablePtr vars = virNWFilterHashTableCreate(0);
|
||||||
virNWFilterInst inst;
|
virNWFilterInst inst;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user