mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
maint: avoid 'const fooPtr' in nwfilter files
'const fooPtr' is the same as 'foo * const' (the pointer won't change, but it's contents can). But in general, if an interface is trying to be const-correct, it should be using 'const foo *' (the pointer is to data that can't be changed). Fix up offenders in nwfilter code. This patch does nothing about the stupidity evident in having __virNWFilterInstantiateFilter, _virNWFilterInstantiateFilter, and virNWFilterInstantiateFilter, which differ only by leading underscores, and which infringes on the namespace reserved to the implementation - that would need to be a separate cleanup. * src/nwfilter/nwfilter_dhcpsnoop.h (virNWFilterDHCPSnoopReq): Use intended type. * src/nwfilter/nwfilter_gentech_driver.h (virNWFilterInstantiateFilter) (virNWFilterUpdateInstantiateFilter) (virNWFilterInstantiataeFilterLate, virNWFilterTeardownFilter) (virNWFilterCreateVarHashmap): Likewise. * src/nwfilter/nwfilter_learnipaddr.h (virNWFilterLearnIPAddress): Likewise. * src/conf/nwfilter_conf.h (virNWFilterApplyBasicRules) (virNWFilterApplyDHCPOnlyRules): Likewise. (virNWFilterDefFormat): Make const-correct. * src/conf/nwfilter_params.h (virNWFilterVarValueCopy) (virNWFilterVarValueGetSimple, virNWFilterVarValueGetCardinality) (virNWFilterVarValueEqual, virNWFilterVarAccessEqual) (virNWFilterVarAccessGetVarName, virNWFilterVarAccessGetType) (virNWFilterVarAccessGetIterId, virNWFilterVarAccessGetIndex) (virNWFilterVarAccessIsAvailable) (virNWFilterVarCombIterGetVarValue): Use intended type. (virNWFilterVarValueGetNthValue): Make const-correct. * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel) (virNWFilterSnoopIFKeyFMT, virNWFilterDHCPSnoopReq) (virNWFilterSnoopPruneIter, virNWFilterSnoopRemAllReqIter) (virNWFilterDHCPSnoopReq): Fix fallout. * src/nwfilter/nwfilter_gentech_driver.c (virNWFilterVarHashmapAddStdValues, virNWFilterCreateVarHashmap) (virNWFilterInstantiate, __virNWFilterInstantiateFilter) (_virNWFilterInstantiateFilter, virNWFilterInstantiateFilterLate) (virNWFilterInstantiateFilter) (virNWFilterUpdateInstantiateFilter) (virNWFilterRollbackUpdateFilter, virNWFilterTeardownFilter): Likewise. * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnIPAddress): Likewise. * src/conf/nwfilter_params.c (virNWFilterVarValueCopy) (virNWFilterVarValueGetSimple) (virNWFilterVarValueGetCardinality, virNWFilterVarValueEqual) (virNWFilterVarCombIterAddVariable) (virNWFilterVarCombIterGetVarValue, virNWFilterVarValueCompare) (virNWFilterFormatParamAttributes, virNWFilterVarAccessEqual) (virNWFilterVarAccessGetVarName, virNWFilterVarAccessGetType) (virNWFilterVarAccessGetIterId, virNWFilterVarAccessGetIndex) (virNWFilterVarAccessGetIntIterId) (virNWFilterVarAccessIsAvailable) (virNWFilterVarValueGetNthValue): Likewise. * src/nwfilter/nwfilter_ebiptables_driver.c (ebtablesApplyBasicRules) (ebtablesApplyDHCPOnlyRules, ebiptablesRuleOrderSort) (ebiptablesRuleOrderSortPtr): Likewise. * src/conf/nwfilter_conf.c (virNWFilterDefEqual) (virNWFilterDefFormat): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
d694ae0c55
commit
1b7ec657c5
@ -2,7 +2,7 @@
|
||||
* nwfilter_conf.c: network filter XML processing
|
||||
* (derived from storage_conf.c)
|
||||
*
|
||||
* Copyright (C) 2006-2012 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||
*
|
||||
* Copyright (C) 2010-2011 IBM Corporation
|
||||
@ -2927,7 +2927,7 @@ virNWFilterTestUnassignDef(virNWFilterObjPtr nwfilter)
|
||||
}
|
||||
|
||||
static bool
|
||||
virNWFilterDefEqual(const virNWFilterDefPtr def1, virNWFilterDefPtr def2,
|
||||
virNWFilterDefEqual(const virNWFilterDef *def1, virNWFilterDefPtr def2,
|
||||
bool cmpUUIDs)
|
||||
{
|
||||
bool ret = false;
|
||||
@ -3412,7 +3412,7 @@ virNWFilterEntryFormat(virNWFilterEntryPtr entry)
|
||||
|
||||
|
||||
char *
|
||||
virNWFilterDefFormat(virNWFilterDefPtr def)
|
||||
virNWFilterDefFormat(const virNWFilterDef *def)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||
|
@ -2,7 +2,7 @@
|
||||
* nwfilter_conf.h: network filter XML processing
|
||||
* (derived from storage_conf.h)
|
||||
*
|
||||
* Copyright (C) 2006-2010, 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2010, 2012-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||
*
|
||||
* Copyright (C) 2010 IBM Corporation
|
||||
@ -625,10 +625,10 @@ typedef int (*virNWFilterRuleDisplayInstanceData)(void *_inst);
|
||||
typedef int (*virNWFilterCanApplyBasicRules)(void);
|
||||
|
||||
typedef int (*virNWFilterApplyBasicRules)(const char *ifname,
|
||||
const virMacAddrPtr macaddr);
|
||||
const virMacAddr *macaddr);
|
||||
|
||||
typedef int (*virNWFilterApplyDHCPOnlyRules)(const char *ifname,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
virNWFilterVarValuePtr dhcpsrvs,
|
||||
bool leaveTemporary);
|
||||
|
||||
@ -695,7 +695,7 @@ int virNWFilterTestUnassignDef(virNWFilterObjPtr nwfilter);
|
||||
virNWFilterDefPtr virNWFilterDefParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root);
|
||||
|
||||
char *virNWFilterDefFormat(virNWFilterDefPtr def);
|
||||
char *virNWFilterDefFormat(const virNWFilterDef *def);
|
||||
|
||||
int virNWFilterSaveXML(const char *configDir,
|
||||
virNWFilterDefPtr def,
|
||||
|
@ -38,8 +38,7 @@
|
||||
static bool isValidVarValue(const char *value);
|
||||
static void virNWFilterVarAccessSetIntIterId(virNWFilterVarAccessPtr,
|
||||
unsigned int);
|
||||
static unsigned int virNWFilterVarAccessGetIntIterId(
|
||||
const virNWFilterVarAccessPtr);
|
||||
static unsigned int virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *);
|
||||
|
||||
void
|
||||
virNWFilterVarValueFree(virNWFilterVarValuePtr val)
|
||||
@ -65,7 +64,7 @@ virNWFilterVarValueFree(virNWFilterVarValuePtr val)
|
||||
}
|
||||
|
||||
virNWFilterVarValuePtr
|
||||
virNWFilterVarValueCopy(const virNWFilterVarValuePtr val)
|
||||
virNWFilterVarValueCopy(const virNWFilterVarValue *val)
|
||||
{
|
||||
virNWFilterVarValuePtr res;
|
||||
size_t i;
|
||||
@ -132,7 +131,7 @@ virNWFilterVarValueCreateSimpleCopyValue(const char *value)
|
||||
}
|
||||
|
||||
const char *
|
||||
virNWFilterVarValueGetSimple(const virNWFilterVarValuePtr val)
|
||||
virNWFilterVarValueGetSimple(const virNWFilterVarValue *val)
|
||||
{
|
||||
if (val->valType == NWFILTER_VALUE_TYPE_SIMPLE)
|
||||
return val->u.simple.value;
|
||||
@ -140,7 +139,7 @@ virNWFilterVarValueGetSimple(const virNWFilterVarValuePtr val)
|
||||
}
|
||||
|
||||
const char *
|
||||
virNWFilterVarValueGetNthValue(virNWFilterVarValuePtr val, unsigned int idx)
|
||||
virNWFilterVarValueGetNthValue(const virNWFilterVarValue* val, unsigned int idx)
|
||||
{
|
||||
const char *res = NULL;
|
||||
|
||||
@ -164,7 +163,7 @@ virNWFilterVarValueGetNthValue(virNWFilterVarValuePtr val, unsigned int idx)
|
||||
}
|
||||
|
||||
unsigned int
|
||||
virNWFilterVarValueGetCardinality(const virNWFilterVarValuePtr val)
|
||||
virNWFilterVarValueGetCardinality(const virNWFilterVarValue *val)
|
||||
{
|
||||
switch (val->valType) {
|
||||
case NWFILTER_VALUE_TYPE_SIMPLE:
|
||||
@ -180,8 +179,8 @@ virNWFilterVarValueGetCardinality(const virNWFilterVarValuePtr val)
|
||||
}
|
||||
|
||||
bool
|
||||
virNWFilterVarValueEqual(const virNWFilterVarValuePtr a,
|
||||
const virNWFilterVarValuePtr b)
|
||||
virNWFilterVarValueEqual(const virNWFilterVarValue *a,
|
||||
const virNWFilterVarValue *b)
|
||||
{
|
||||
unsigned int card;
|
||||
size_t i, j;
|
||||
@ -335,7 +334,7 @@ virNWFilterVarCombIterEntryInit(virNWFilterVarCombIterEntryPtr cie,
|
||||
static int
|
||||
virNWFilterVarCombIterAddVariable(virNWFilterVarCombIterEntryPtr cie,
|
||||
virNWFilterHashTablePtr hash,
|
||||
const virNWFilterVarAccessPtr varAccess)
|
||||
const virNWFilterVarAccess *varAccess)
|
||||
{
|
||||
virNWFilterVarValuePtr varValue;
|
||||
unsigned int maxValue = 0, minValue = 0;
|
||||
@ -543,7 +542,7 @@ next:
|
||||
|
||||
const char *
|
||||
virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
||||
const virNWFilterVarAccessPtr vap)
|
||||
const virNWFilterVarAccess *vap)
|
||||
{
|
||||
size_t i;
|
||||
unsigned int iterId;
|
||||
@ -783,8 +782,8 @@ err_exit:
|
||||
static int
|
||||
virNWFilterVarValueCompare(const void *a, const void *b)
|
||||
{
|
||||
return virNWFilterVarValueEqual((const virNWFilterVarValuePtr) a,
|
||||
(const virNWFilterVarValuePtr) b) ? 0 : 1;
|
||||
return virNWFilterVarValueEqual((const virNWFilterVarValue *) a,
|
||||
(const virNWFilterVarValue *) b) ? 0 : 1;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -909,8 +908,7 @@ virNWFilterFormatParamAttributes(virBufferPtr buf,
|
||||
if (numKeys) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
for (i = 0; i < numKeys; i++) {
|
||||
const virNWFilterVarValuePtr value =
|
||||
(const virNWFilterVarValuePtr)items[i].value;
|
||||
const virNWFilterVarValue *value = items[i].value;
|
||||
|
||||
card = virNWFilterVarValueGetCardinality(value);
|
||||
|
||||
@ -942,8 +940,8 @@ virNWFilterVarAccessFree(virNWFilterVarAccessPtr varAccess)
|
||||
}
|
||||
|
||||
bool
|
||||
virNWFilterVarAccessEqual(const virNWFilterVarAccessPtr a,
|
||||
const virNWFilterVarAccessPtr b)
|
||||
virNWFilterVarAccessEqual(const virNWFilterVarAccess *a,
|
||||
const virNWFilterVarAccess *b)
|
||||
{
|
||||
if (a->accessType != b->accessType)
|
||||
return false;
|
||||
@ -1078,25 +1076,25 @@ virNWFilterVarAccessPrint(virNWFilterVarAccessPtr vap, virBufferPtr buf)
|
||||
}
|
||||
|
||||
const char *
|
||||
virNWFilterVarAccessGetVarName(const virNWFilterVarAccessPtr vap)
|
||||
virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap)
|
||||
{
|
||||
return vap->varName;
|
||||
}
|
||||
|
||||
enum virNWFilterVarAccessType
|
||||
virNWFilterVarAccessGetType(const virNWFilterVarAccessPtr vap)
|
||||
virNWFilterVarAccessGetType(const virNWFilterVarAccess *vap)
|
||||
{
|
||||
return vap->accessType;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
virNWFilterVarAccessGetIterId(const virNWFilterVarAccessPtr vap)
|
||||
virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap)
|
||||
{
|
||||
return vap->u.iterId;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
virNWFilterVarAccessGetIndex(const virNWFilterVarAccessPtr vap)
|
||||
virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap)
|
||||
{
|
||||
return vap->u.index.index;
|
||||
}
|
||||
@ -1109,14 +1107,14 @@ virNWFilterVarAccessSetIntIterId(virNWFilterVarAccessPtr vap,
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccessPtr vap)
|
||||
virNWFilterVarAccessGetIntIterId(const virNWFilterVarAccess *vap)
|
||||
{
|
||||
return vap->u.index.intIterId;
|
||||
}
|
||||
|
||||
bool
|
||||
virNWFilterVarAccessIsAvailable(const virNWFilterVarAccessPtr varAccess,
|
||||
const virNWFilterHashTablePtr hash)
|
||||
virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *varAccess,
|
||||
const virNWFilterHashTable *hash)
|
||||
{
|
||||
const char *varName = virNWFilterVarAccessGetVarName(varAccess);
|
||||
const char *res;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* nwfilter_params.h: parsing and data maintenance of filter parameters
|
||||
*
|
||||
* Copyright (C) 2011-2012 Red Hat, Inc.
|
||||
* Copyright (C) 2011-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2010 IBM Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -51,14 +51,14 @@ struct _virNWFilterVarValue {
|
||||
|
||||
virNWFilterVarValuePtr virNWFilterVarValueCreateSimple(char *);
|
||||
virNWFilterVarValuePtr virNWFilterVarValueCreateSimpleCopyValue(const char *);
|
||||
virNWFilterVarValuePtr virNWFilterVarValueCopy(const virNWFilterVarValuePtr);
|
||||
virNWFilterVarValuePtr virNWFilterVarValueCopy(const virNWFilterVarValue *);
|
||||
void virNWFilterVarValueFree(virNWFilterVarValuePtr val);
|
||||
const char *virNWFilterVarValueGetSimple(const virNWFilterVarValuePtr val);
|
||||
const char *virNWFilterVarValueGetNthValue(virNWFilterVarValuePtr val,
|
||||
const char *virNWFilterVarValueGetSimple(const virNWFilterVarValue *val);
|
||||
const char *virNWFilterVarValueGetNthValue(const virNWFilterVarValue *val,
|
||||
unsigned int idx);
|
||||
unsigned int virNWFilterVarValueGetCardinality(const virNWFilterVarValuePtr);
|
||||
bool virNWFilterVarValueEqual(const virNWFilterVarValuePtr a,
|
||||
const virNWFilterVarValuePtr b);
|
||||
unsigned int virNWFilterVarValueGetCardinality(const virNWFilterVarValue *);
|
||||
bool virNWFilterVarValueEqual(const virNWFilterVarValue *a,
|
||||
const virNWFilterVarValue *b);
|
||||
int virNWFilterVarValueAddValue(virNWFilterVarValuePtr val, char *value);
|
||||
int virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value);
|
||||
|
||||
@ -125,18 +125,18 @@ struct _virNWFilterVarAccess {
|
||||
# define VIR_NWFILTER_MAX_ITERID 1000
|
||||
|
||||
void virNWFilterVarAccessFree(virNWFilterVarAccessPtr varAccess);
|
||||
bool virNWFilterVarAccessEqual(const virNWFilterVarAccessPtr a,
|
||||
const virNWFilterVarAccessPtr b);
|
||||
bool virNWFilterVarAccessEqual(const virNWFilterVarAccess *a,
|
||||
const virNWFilterVarAccess *b);
|
||||
virNWFilterVarAccessPtr virNWFilterVarAccessParse(const char *varAccess);
|
||||
void virNWFilterVarAccessPrint(virNWFilterVarAccessPtr vap,
|
||||
virBufferPtr buf);
|
||||
const char *virNWFilterVarAccessGetVarName(const virNWFilterVarAccessPtr vap);
|
||||
const char *virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap);
|
||||
enum virNWFilterVarAccessType virNWFilterVarAccessGetType(
|
||||
const virNWFilterVarAccessPtr vap);
|
||||
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccessPtr vap);
|
||||
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccessPtr vap);
|
||||
bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccessPtr vap,
|
||||
const virNWFilterHashTablePtr hash);
|
||||
const virNWFilterVarAccess *vap);
|
||||
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
|
||||
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);
|
||||
bool virNWFilterVarAccessIsAvailable(const virNWFilterVarAccess *vap,
|
||||
const virNWFilterHashTable *hash);
|
||||
|
||||
typedef struct _virNWFilterVarCombIterEntry virNWFilterVarCombIterEntry;
|
||||
typedef virNWFilterVarCombIterEntry *virNWFilterVarCombIterEntryPtr;
|
||||
@ -165,7 +165,7 @@ void virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci);
|
||||
virNWFilterVarCombIterPtr virNWFilterVarCombIterNext(
|
||||
virNWFilterVarCombIterPtr ci);
|
||||
const char *virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
|
||||
const virNWFilterVarAccessPtr);
|
||||
const virNWFilterVarAccess *);
|
||||
|
||||
|
||||
#endif /* NWFILTER_PARAMS_H */
|
||||
|
@ -877,7 +877,7 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
|
||||
req->filtername,
|
||||
req->vars);
|
||||
} else {
|
||||
const virNWFilterVarValuePtr dhcpsrvrs =
|
||||
virNWFilterVarValuePtr dhcpsrvrs =
|
||||
virHashLookup(req->vars->hashTable, NWFILTER_VARNAME_DHCPSERVER);
|
||||
|
||||
if (req->techdriver &&
|
||||
@ -1569,7 +1569,7 @@ exit:
|
||||
|
||||
static void
|
||||
virNWFilterSnoopIFKeyFMT(char *ifkey, const unsigned char *vmuuid,
|
||||
const virMacAddrPtr macaddr)
|
||||
const virMacAddr *macaddr)
|
||||
{
|
||||
virUUIDFormat(vmuuid, ifkey);
|
||||
ifkey[VIR_UUID_STRING_BUFLEN - 1] = '-';
|
||||
@ -1582,7 +1582,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const unsigned char *vmuuid,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams,
|
||||
virNWFilterDriverStatePtr driver)
|
||||
@ -1829,7 +1829,7 @@ virNWFilterSnoopPruneIter(const void *payload,
|
||||
const void *name ATTRIBUTE_UNUSED,
|
||||
const void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
const virNWFilterSnoopReqPtr req = (virNWFilterSnoopReqPtr)payload;
|
||||
virNWFilterSnoopReqPtr req = (virNWFilterSnoopReqPtr)payload;
|
||||
bool del_req;
|
||||
|
||||
/* clean up orphaned, expired leases */
|
||||
@ -2025,7 +2025,7 @@ virNWFilterSnoopRemAllReqIter(const void *payload,
|
||||
const void *name ATTRIBUTE_UNUSED,
|
||||
const void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
const virNWFilterSnoopReqPtr req = (virNWFilterSnoopReqPtr)payload;
|
||||
virNWFilterSnoopReqPtr req = (virNWFilterSnoopReqPtr)payload;
|
||||
|
||||
/* protect req->ifname */
|
||||
virNWFilterSnoopReqLock(req);
|
||||
@ -2216,7 +2216,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
|
||||
const char *linkdev ATTRIBUTE_UNUSED,
|
||||
enum virDomainNetType nettype ATTRIBUTE_UNUSED,
|
||||
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
||||
const virMacAddrPtr macaddr ATTRIBUTE_UNUSED,
|
||||
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
||||
const char *filtername ATTRIBUTE_UNUSED,
|
||||
virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
|
||||
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED)
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* nwfilter_dhcpsnoop.h: support DHCP snooping for a VM on an interface
|
||||
*
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2012 IBM Corp.
|
||||
* Copyright (C) 2010-2012 David L Stevens
|
||||
*
|
||||
@ -31,7 +32,7 @@ int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const unsigned char *vmuuid,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams,
|
||||
virNWFilterDriverStatePtr driver);
|
||||
|
@ -3235,7 +3235,7 @@ ebiptablesCanApplyBasicRules(void) {
|
||||
*/
|
||||
static int
|
||||
ebtablesApplyBasicRules(const char *ifname,
|
||||
const virMacAddrPtr macaddr)
|
||||
const virMacAddr *macaddr)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
char chain[MAX_CHAINNAME_LENGTH];
|
||||
@ -3328,7 +3328,7 @@ tear_down_tmpebchains:
|
||||
*/
|
||||
static int
|
||||
ebtablesApplyDHCPOnlyRules(const char *ifname,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
virNWFilterVarValuePtr dhcpsrvrs,
|
||||
bool leaveTemporary)
|
||||
{
|
||||
@ -3564,8 +3564,8 @@ static int ebtablesCleanAll(const char *ifname)
|
||||
static int
|
||||
ebiptablesRuleOrderSort(const void *a, const void *b)
|
||||
{
|
||||
const ebiptablesRuleInstPtr insta = (const ebiptablesRuleInstPtr)a;
|
||||
const ebiptablesRuleInstPtr instb = (const ebiptablesRuleInstPtr)b;
|
||||
const ebiptablesRuleInst *insta = a;
|
||||
const ebiptablesRuleInst *instb = b;
|
||||
const char *root = virNWFilterChainSuffixTypeToString(
|
||||
VIR_NWFILTER_CHAINSUFFIX_ROOT);
|
||||
bool root_a = STREQ(insta->neededProtocolChain, root);
|
||||
@ -3590,8 +3590,8 @@ normal:
|
||||
static int
|
||||
ebiptablesRuleOrderSortPtr(const void *a, const void *b)
|
||||
{
|
||||
const ebiptablesRuleInstPtr *insta = a;
|
||||
const ebiptablesRuleInstPtr *instb = b;
|
||||
ebiptablesRuleInst * const *insta = a;
|
||||
ebiptablesRuleInst * const *instb = b;
|
||||
return ebiptablesRuleOrderSort(*insta, *instb);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* nwfilter_gentech_driver.c: generic technology driver
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011, 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2010 IBM Corp.
|
||||
* Copyright (C) 2010 Stefan Berger
|
||||
*
|
||||
@ -148,7 +148,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInstPtr inst)
|
||||
static int
|
||||
virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
|
||||
char *macaddr,
|
||||
const virNWFilterVarValuePtr ipaddr)
|
||||
const virNWFilterVarValue *ipaddr)
|
||||
{
|
||||
virNWFilterVarValue *val;
|
||||
|
||||
@ -197,7 +197,8 @@ virNWFilterVarHashmapAddStdValues(virNWFilterHashTablePtr table,
|
||||
*/
|
||||
virNWFilterHashTablePtr
|
||||
virNWFilterCreateVarHashmap(char *macaddr,
|
||||
const virNWFilterVarValuePtr ipaddr) {
|
||||
const virNWFilterVarValue *ipaddr)
|
||||
{
|
||||
virNWFilterHashTablePtr table = virNWFilterHashTableCreate(0);
|
||||
if (!table)
|
||||
return NULL;
|
||||
@ -644,7 +645,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
||||
virNWFilterHashTablePtr vars,
|
||||
enum instCase useNewFilter, bool *foundNewFilter,
|
||||
bool teardownOld,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
virNWFilterDriverStatePtr driver,
|
||||
bool forceWithPendingReq)
|
||||
{
|
||||
@ -807,7 +808,7 @@ __virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
int ifindex,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams,
|
||||
enum instCase useNewFilter,
|
||||
@ -923,7 +924,7 @@ err_exit:
|
||||
static int
|
||||
_virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
const unsigned char *vmuuid,
|
||||
const virDomainNetDefPtr net,
|
||||
const virDomainNetDef *net,
|
||||
bool teardownOld,
|
||||
enum instCase useNewFilter,
|
||||
bool *foundNewFilter)
|
||||
@ -976,7 +977,7 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
|
||||
int ifindex,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams)
|
||||
{
|
||||
@ -1017,7 +1018,7 @@ virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
|
||||
int
|
||||
virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
const unsigned char *vmuuid,
|
||||
const virDomainNetDefPtr net)
|
||||
const virDomainNetDef *net)
|
||||
{
|
||||
bool foundNewFilter = false;
|
||||
|
||||
@ -1031,7 +1032,7 @@ virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
int
|
||||
virNWFilterUpdateInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
const unsigned char *vmuuid,
|
||||
const virDomainNetDefPtr net,
|
||||
const virDomainNetDef *net,
|
||||
bool *skipIface)
|
||||
{
|
||||
bool foundNewFilter = false;
|
||||
@ -1046,7 +1047,7 @@ virNWFilterUpdateInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
}
|
||||
|
||||
static int
|
||||
virNWFilterRollbackUpdateFilter(const virDomainNetDefPtr net)
|
||||
virNWFilterRollbackUpdateFilter(const virDomainNetDef *net)
|
||||
{
|
||||
const char *drvname = EBIPTABLES_DRIVER_ID;
|
||||
int ifindex;
|
||||
@ -1130,7 +1131,7 @@ _virNWFilterTeardownFilter(const char *ifname)
|
||||
|
||||
|
||||
int
|
||||
virNWFilterTeardownFilter(const virDomainNetDefPtr net)
|
||||
virNWFilterTeardownFilter(const virDomainNetDef *net)
|
||||
{
|
||||
return _virNWFilterTeardownFilter(net->ifname);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* nwfilter_gentech_driver.h: generic technology driver include file
|
||||
*
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2010 IBM Corp.
|
||||
* Copyright (C) 2010 Stefan Berger
|
||||
*
|
||||
@ -41,10 +42,10 @@ enum instCase {
|
||||
|
||||
int virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
const unsigned char *vmuuid,
|
||||
const virDomainNetDefPtr net);
|
||||
const virDomainNetDef *net);
|
||||
int virNWFilterUpdateInstantiateFilter(virNWFilterDriverStatePtr driver,
|
||||
const unsigned char *vmuuid,
|
||||
const virDomainNetDefPtr net,
|
||||
const virDomainNetDef *net,
|
||||
bool *skipIface);
|
||||
|
||||
int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
|
||||
@ -53,14 +54,14 @@ int virNWFilterInstantiateFilterLate(virNWFilterDriverStatePtr driver,
|
||||
int ifindex,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams);
|
||||
|
||||
int virNWFilterTeardownFilter(const virDomainNetDefPtr net);
|
||||
int virNWFilterTeardownFilter(const virDomainNetDef *net);
|
||||
|
||||
virNWFilterHashTablePtr virNWFilterCreateVarHashmap(char *macaddr,
|
||||
const virNWFilterVarValuePtr);
|
||||
const virNWFilterVarValue *value);
|
||||
|
||||
int virNWFilterDomainFWUpdateCB(virDomainObjPtr vm,
|
||||
void *data);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* nwfilter_learnipaddr.c: support for learning IP address used by a VM
|
||||
* on an interface
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
* Copyright (C) 2011, 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2010 IBM Corp.
|
||||
* Copyright (C) 2010 Stefan Berger
|
||||
*
|
||||
@ -677,7 +677,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
||||
int ifindex,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams,
|
||||
virNWFilterDriverStatePtr driver,
|
||||
@ -766,11 +766,12 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
|
||||
int ifindex ATTRIBUTE_UNUSED,
|
||||
const char *linkdev ATTRIBUTE_UNUSED,
|
||||
enum virDomainNetType nettype ATTRIBUTE_UNUSED,
|
||||
const virMacAddrPtr macaddr ATTRIBUTE_UNUSED,
|
||||
const virMacAddr *macaddr ATTRIBUTE_UNUSED,
|
||||
const char *filtername ATTRIBUTE_UNUSED,
|
||||
virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
|
||||
virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
|
||||
enum howDetect howDetect ATTRIBUTE_UNUSED) {
|
||||
enum howDetect howDetect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("IP parameter must be given since libvirt "
|
||||
"was not compiled with IP address learning "
|
||||
|
@ -2,7 +2,7 @@
|
||||
* nwfilter_learnipaddr.h: support for learning IP address used by a VM
|
||||
* on an interface
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2012-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2010 IBM Corp.
|
||||
* Copyright (C) 2010 Stefan Berger
|
||||
*
|
||||
@ -58,7 +58,7 @@ int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
||||
int ifindex,
|
||||
const char *linkdev,
|
||||
enum virDomainNetType nettype,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const char *filtername,
|
||||
virNWFilterHashTablePtr filterparams,
|
||||
virNWFilterDriverStatePtr driver,
|
||||
|
Loading…
Reference in New Issue
Block a user