mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
Remove pointless return values in nwfilter methods
Many nwfilter methods have an int return value but only ever return 0 and their callers never check the return value either. These methods can all be void. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
2b42e17c7e
commit
741c855e0e
@ -208,7 +208,7 @@ static const char *m_physdev_out_old_str = "-m physdev " PHYSDEV_OUT_OLD;
|
|||||||
static int ebtablesRemoveBasicRules(const char *ifname);
|
static int ebtablesRemoveBasicRules(const char *ifname);
|
||||||
static int ebiptablesDriverInit(bool privileged);
|
static int ebiptablesDriverInit(bool privileged);
|
||||||
static void ebiptablesDriverShutdown(void);
|
static void ebiptablesDriverShutdown(void);
|
||||||
static int ebtablesCleanAll(const char *ifname);
|
static void ebtablesCleanAll(const char *ifname);
|
||||||
static int ebiptablesAllTeardown(const char *ifname);
|
static int ebiptablesAllTeardown(const char *ifname);
|
||||||
|
|
||||||
static virMutex execCLIMutex;
|
static virMutex execCLIMutex;
|
||||||
@ -584,10 +584,11 @@ ebtablesHandleEthHdr(virBufferPtr buf,
|
|||||||
|
|
||||||
/************************ iptables support ************************/
|
/************************ iptables support ************************/
|
||||||
|
|
||||||
static int iptablesLinkIPTablesBaseChain(virBufferPtr buf,
|
static void
|
||||||
const char *udchain,
|
iptablesLinkIPTablesBaseChain(virBufferPtr buf,
|
||||||
const char *syschain,
|
const char *udchain,
|
||||||
unsigned int pos)
|
const char *syschain,
|
||||||
|
unsigned int pos)
|
||||||
{
|
{
|
||||||
virBufferAsprintf(buf,
|
virBufferAsprintf(buf,
|
||||||
"res=$($IPT -L %s -n --line-number | %s '%s')\n"
|
"res=$($IPT -L %s -n --line-number | %s '%s')\n"
|
||||||
@ -617,11 +618,11 @@ static int iptablesLinkIPTablesBaseChain(virBufferPtr buf,
|
|||||||
|
|
||||||
syschain,
|
syschain,
|
||||||
CMD_STOPONERR(true));
|
CMD_STOPONERR(true));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int iptablesCreateBaseChains(virBufferPtr buf)
|
static void
|
||||||
|
iptablesCreateBaseChains(virBufferPtr buf)
|
||||||
{
|
{
|
||||||
virBufferAddLit(buf, "$IPT -N " VIRT_IN_CHAIN CMD_SEPARATOR
|
virBufferAddLit(buf, "$IPT -N " VIRT_IN_CHAIN CMD_SEPARATOR
|
||||||
"$IPT -N " VIRT_OUT_CHAIN CMD_SEPARATOR
|
"$IPT -N " VIRT_OUT_CHAIN CMD_SEPARATOR
|
||||||
@ -635,12 +636,10 @@ static int iptablesCreateBaseChains(virBufferPtr buf)
|
|||||||
VIRT_IN_POST_CHAIN, "FORWARD", 3);
|
VIRT_IN_POST_CHAIN, "FORWARD", 3);
|
||||||
iptablesLinkIPTablesBaseChain(buf,
|
iptablesLinkIPTablesBaseChain(buf,
|
||||||
HOST_IN_CHAIN, "INPUT", 1);
|
HOST_IN_CHAIN, "INPUT", 1);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesCreateTmpRootChain(virBufferPtr buf,
|
iptablesCreateTmpRootChain(virBufferPtr buf,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
@ -660,23 +659,20 @@ iptablesCreateTmpRootChain(virBufferPtr buf,
|
|||||||
"%s",
|
"%s",
|
||||||
chain,
|
chain,
|
||||||
CMD_STOPONERR(true));
|
CMD_STOPONERR(true));
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesCreateTmpRootChains(virBufferPtr buf,
|
iptablesCreateTmpRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesCreateTmpRootChain(buf, 'F', false, ifname);
|
iptablesCreateTmpRootChain(buf, 'F', false, ifname);
|
||||||
iptablesCreateTmpRootChain(buf, 'F', true, ifname);
|
iptablesCreateTmpRootChain(buf, 'F', true, ifname);
|
||||||
iptablesCreateTmpRootChain(buf, 'H', true, ifname);
|
iptablesCreateTmpRootChain(buf, 'H', true, ifname);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
_iptablesRemoveRootChain(virBufferPtr buf,
|
_iptablesRemoveRootChain(virBufferPtr buf,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming, const char *ifname,
|
bool incoming, const char *ifname,
|
||||||
@ -701,55 +697,51 @@ _iptablesRemoveRootChain(virBufferPtr buf,
|
|||||||
"$IPT -X %s" CMD_SEPARATOR,
|
"$IPT -X %s" CMD_SEPARATOR,
|
||||||
chain,
|
chain,
|
||||||
chain);
|
chain);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesRemoveRootChain(virBufferPtr buf,
|
iptablesRemoveRootChain(virBufferPtr buf,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming,
|
bool incoming,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
return _iptablesRemoveRootChain(buf, prefix, incoming, ifname, 0);
|
_iptablesRemoveRootChain(buf, prefix, incoming, ifname, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesRemoveTmpRootChain(virBufferPtr buf,
|
iptablesRemoveTmpRootChain(virBufferPtr buf,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming,
|
bool incoming,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
return _iptablesRemoveRootChain(buf, prefix,
|
_iptablesRemoveRootChain(buf, prefix,
|
||||||
incoming, ifname, 1);
|
incoming, ifname, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesRemoveTmpRootChains(virBufferPtr buf,
|
iptablesRemoveTmpRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesRemoveTmpRootChain(buf, 'F', false, ifname);
|
iptablesRemoveTmpRootChain(buf, 'F', false, ifname);
|
||||||
iptablesRemoveTmpRootChain(buf, 'F', true, ifname);
|
iptablesRemoveTmpRootChain(buf, 'F', true, ifname);
|
||||||
iptablesRemoveTmpRootChain(buf, 'H', true, ifname);
|
iptablesRemoveTmpRootChain(buf, 'H', true, ifname);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesRemoveRootChains(virBufferPtr buf,
|
iptablesRemoveRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesRemoveRootChain(buf, 'F', false, ifname);
|
iptablesRemoveRootChain(buf, 'F', false, ifname);
|
||||||
iptablesRemoveRootChain(buf, 'F', true, ifname);
|
iptablesRemoveRootChain(buf, 'F', true, ifname);
|
||||||
iptablesRemoveRootChain(buf, 'H', true, ifname);
|
iptablesRemoveRootChain(buf, 'H', true, ifname);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesLinkTmpRootChain(virBufferPtr buf,
|
iptablesLinkTmpRootChain(virBufferPtr buf,
|
||||||
const char *basechain,
|
const char *basechain,
|
||||||
char prefix,
|
char prefix,
|
||||||
@ -775,24 +767,20 @@ iptablesLinkTmpRootChain(virBufferPtr buf,
|
|||||||
match, ifname, chain,
|
match, ifname, chain,
|
||||||
|
|
||||||
CMD_STOPONERR(true));
|
CMD_STOPONERR(true));
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesLinkTmpRootChains(virBufferPtr buf,
|
iptablesLinkTmpRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesLinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', false, ifname);
|
iptablesLinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', false, ifname);
|
||||||
iptablesLinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', true, ifname);
|
iptablesLinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', true, ifname);
|
||||||
iptablesLinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', true, ifname);
|
iptablesLinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', true, ifname);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesSetupVirtInPost(virBufferPtr buf,
|
iptablesSetupVirtInPost(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
@ -810,11 +798,10 @@ iptablesSetupVirtInPost(virBufferPtr buf,
|
|||||||
PHYSDEV_IN, ifname,
|
PHYSDEV_IN, ifname,
|
||||||
match, ifname,
|
match, ifname,
|
||||||
CMD_STOPONERR(1));
|
CMD_STOPONERR(1));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesClearVirtInPost(virBufferPtr buf,
|
iptablesClearVirtInPost(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
@ -823,10 +810,9 @@ iptablesClearVirtInPost(virBufferPtr buf,
|
|||||||
"$IPT -D " VIRT_IN_POST_CHAIN
|
"$IPT -D " VIRT_IN_POST_CHAIN
|
||||||
" %s %s -j ACCEPT" CMD_SEPARATOR,
|
" %s %s -j ACCEPT" CMD_SEPARATOR,
|
||||||
match, ifname);
|
match, ifname);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
_iptablesUnlinkRootChain(virBufferPtr buf,
|
_iptablesUnlinkRootChain(virBufferPtr buf,
|
||||||
const char *basechain,
|
const char *basechain,
|
||||||
char prefix,
|
char prefix,
|
||||||
@ -867,57 +853,52 @@ _iptablesUnlinkRootChain(virBufferPtr buf,
|
|||||||
"%s %s -g %s" CMD_SEPARATOR,
|
"%s %s -g %s" CMD_SEPARATOR,
|
||||||
basechain,
|
basechain,
|
||||||
old_match, ifname, chain);
|
old_match, ifname, chain);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesUnlinkRootChain(virBufferPtr buf,
|
iptablesUnlinkRootChain(virBufferPtr buf,
|
||||||
const char *basechain,
|
const char *basechain,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
return _iptablesUnlinkRootChain(buf,
|
_iptablesUnlinkRootChain(buf,
|
||||||
basechain, prefix, incoming, ifname, 0);
|
basechain, prefix, incoming, ifname, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesUnlinkTmpRootChain(virBufferPtr buf,
|
iptablesUnlinkTmpRootChain(virBufferPtr buf,
|
||||||
const char *basechain,
|
const char *basechain,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
return _iptablesUnlinkRootChain(buf,
|
_iptablesUnlinkRootChain(buf,
|
||||||
basechain, prefix, incoming, ifname, 1);
|
basechain, prefix, incoming, ifname, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesUnlinkRootChains(virBufferPtr buf,
|
iptablesUnlinkRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesUnlinkRootChain(buf, VIRT_OUT_CHAIN, 'F', false, ifname);
|
iptablesUnlinkRootChain(buf, VIRT_OUT_CHAIN, 'F', false, ifname);
|
||||||
iptablesUnlinkRootChain(buf, VIRT_IN_CHAIN, 'F', true, ifname);
|
iptablesUnlinkRootChain(buf, VIRT_IN_CHAIN, 'F', true, ifname);
|
||||||
iptablesUnlinkRootChain(buf, HOST_IN_CHAIN, 'H', true, ifname);
|
iptablesUnlinkRootChain(buf, HOST_IN_CHAIN, 'H', true, ifname);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesUnlinkTmpRootChains(virBufferPtr buf,
|
iptablesUnlinkTmpRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesUnlinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', false, ifname);
|
iptablesUnlinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', false, ifname);
|
||||||
iptablesUnlinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', true, ifname);
|
iptablesUnlinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', true, ifname);
|
||||||
iptablesUnlinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', true, ifname);
|
iptablesUnlinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', true, ifname);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesRenameTmpRootChain(virBufferPtr buf,
|
iptablesRenameTmpRootChain(virBufferPtr buf,
|
||||||
char prefix,
|
char prefix,
|
||||||
bool incoming,
|
bool incoming,
|
||||||
@ -942,18 +923,16 @@ iptablesRenameTmpRootChain(virBufferPtr buf,
|
|||||||
"$IPT -E %s %s" CMD_SEPARATOR,
|
"$IPT -E %s %s" CMD_SEPARATOR,
|
||||||
tmpchain,
|
tmpchain,
|
||||||
chain);
|
chain);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
iptablesRenameTmpRootChains(virBufferPtr buf,
|
iptablesRenameTmpRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
iptablesRenameTmpRootChain(buf, 'F', false, ifname);
|
iptablesRenameTmpRootChain(buf, 'F', false, ifname);
|
||||||
iptablesRenameTmpRootChain(buf, 'F', true, ifname);
|
iptablesRenameTmpRootChain(buf, 'F', true, ifname);
|
||||||
iptablesRenameTmpRootChain(buf, 'H', true, ifname);
|
iptablesRenameTmpRootChain(buf, 'H', true, ifname);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2865,7 +2844,7 @@ ebiptablesExecCLI(virBufferPtr buf, bool ignoreNonzero, char **outbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesCreateTmpRootChain(virBufferPtr buf,
|
ebtablesCreateTmpRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
@ -2882,11 +2861,10 @@ ebtablesCreateTmpRootChain(virBufferPtr buf,
|
|||||||
chain,
|
chain,
|
||||||
CMD_STOPONERR(true));
|
CMD_STOPONERR(true));
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesLinkTmpRootChain(virBufferPtr buf,
|
ebtablesLinkTmpRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
@ -2906,12 +2884,10 @@ ebtablesLinkTmpRootChain(virBufferPtr buf,
|
|||||||
iodev, ifname, chain,
|
iodev, ifname, chain,
|
||||||
|
|
||||||
CMD_STOPONERR(true));
|
CMD_STOPONERR(true));
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
_ebtablesRemoveRootChain(virBufferPtr buf,
|
_ebtablesRemoveRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname,
|
bool incoming, const char *ifname,
|
||||||
int isTempChain)
|
int isTempChain)
|
||||||
@ -2932,28 +2908,26 @@ _ebtablesRemoveRootChain(virBufferPtr buf,
|
|||||||
"$EBT -t nat -X %s" CMD_SEPARATOR,
|
"$EBT -t nat -X %s" CMD_SEPARATOR,
|
||||||
chain,
|
chain,
|
||||||
chain);
|
chain);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRemoveRootChain(virBufferPtr buf,
|
ebtablesRemoveRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
return _ebtablesRemoveRootChain(buf, incoming, ifname, 0);
|
_ebtablesRemoveRootChain(buf, incoming, ifname, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRemoveTmpRootChain(virBufferPtr buf,
|
ebtablesRemoveTmpRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
return _ebtablesRemoveRootChain(buf, incoming, ifname, 1);
|
_ebtablesRemoveRootChain(buf, incoming, ifname, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
_ebtablesUnlinkRootChain(virBufferPtr buf,
|
_ebtablesUnlinkRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname,
|
bool incoming, const char *ifname,
|
||||||
int isTempChain)
|
int isTempChain)
|
||||||
@ -2977,24 +2951,22 @@ _ebtablesUnlinkRootChain(virBufferPtr buf,
|
|||||||
incoming ? EBTABLES_CHAIN_INCOMING
|
incoming ? EBTABLES_CHAIN_INCOMING
|
||||||
: EBTABLES_CHAIN_OUTGOING,
|
: EBTABLES_CHAIN_OUTGOING,
|
||||||
iodev, ifname, chain);
|
iodev, ifname, chain);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesUnlinkRootChain(virBufferPtr buf,
|
ebtablesUnlinkRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
return _ebtablesUnlinkRootChain(buf, incoming, ifname, 0);
|
_ebtablesUnlinkRootChain(buf, incoming, ifname, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesUnlinkTmpRootChain(virBufferPtr buf,
|
ebtablesUnlinkTmpRootChain(virBufferPtr buf,
|
||||||
bool incoming, const char *ifname)
|
bool incoming, const char *ifname)
|
||||||
{
|
{
|
||||||
return _ebtablesUnlinkRootChain(buf, incoming, ifname, 1);
|
_ebtablesUnlinkRootChain(buf, incoming, ifname, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3079,7 +3051,7 @@ ebtablesCreateTmpSubChain(ebiptablesRuleInstPtr *inst,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
_ebtablesRemoveSubChains(virBufferPtr buf,
|
_ebtablesRemoveSubChains(virBufferPtr buf,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
const char *chains)
|
const char *chains)
|
||||||
@ -3108,11 +3080,9 @@ _ebtablesRemoveSubChains(virBufferPtr buf,
|
|||||||
rootchain);
|
rootchain);
|
||||||
}
|
}
|
||||||
virBufferAddLit(buf, "rm_chains $chains\n");
|
virBufferAddLit(buf, "rm_chains $chains\n");
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRemoveSubChains(virBufferPtr buf,
|
ebtablesRemoveSubChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
@ -3122,10 +3092,10 @@ ebtablesRemoveSubChains(virBufferPtr buf,
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
return _ebtablesRemoveSubChains(buf, ifname, chains);
|
_ebtablesRemoveSubChains(buf, ifname, chains);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRemoveTmpSubChains(virBufferPtr buf,
|
ebtablesRemoveTmpSubChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
@ -3135,10 +3105,10 @@ ebtablesRemoveTmpSubChains(virBufferPtr buf,
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
return _ebtablesRemoveSubChains(buf, ifname, chains);
|
_ebtablesRemoveSubChains(buf, ifname, chains);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRenameTmpSubChain(virBufferPtr buf,
|
ebtablesRenameTmpSubChain(virBufferPtr buf,
|
||||||
bool incoming,
|
bool incoming,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
@ -3161,18 +3131,17 @@ ebtablesRenameTmpSubChain(virBufferPtr buf,
|
|||||||
virBufferAsprintf(buf,
|
virBufferAsprintf(buf,
|
||||||
"$EBT -t nat -E %s %s" CMD_SEPARATOR,
|
"$EBT -t nat -E %s %s" CMD_SEPARATOR,
|
||||||
tmpchain, chain);
|
tmpchain, chain);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRenameTmpRootChain(virBufferPtr buf,
|
ebtablesRenameTmpRootChain(virBufferPtr buf,
|
||||||
bool incoming,
|
bool incoming,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
return ebtablesRenameTmpSubChain(buf, incoming, ifname, NULL);
|
ebtablesRenameTmpSubChain(buf, incoming, ifname, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebtablesRenameTmpSubAndRootChains(virBufferPtr buf,
|
ebtablesRenameTmpSubAndRootChains(virBufferPtr buf,
|
||||||
const char *ifname)
|
const char *ifname)
|
||||||
{
|
{
|
||||||
@ -3205,8 +3174,6 @@ ebtablesRenameTmpSubAndRootChains(virBufferPtr buf,
|
|||||||
|
|
||||||
ebtablesRenameTmpRootChain(buf, true, ifname);
|
ebtablesRenameTmpRootChain(buf, true, ifname);
|
||||||
ebtablesRenameTmpRootChain(buf, false, ifname);
|
ebtablesRenameTmpRootChain(buf, false, ifname);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3545,16 +3512,18 @@ tear_down_tmpebchains:
|
|||||||
static int
|
static int
|
||||||
ebtablesRemoveBasicRules(const char *ifname)
|
ebtablesRemoveBasicRules(const char *ifname)
|
||||||
{
|
{
|
||||||
return ebtablesCleanAll(ifname);
|
ebtablesCleanAll(ifname);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int ebtablesCleanAll(const char *ifname)
|
static void
|
||||||
|
ebtablesCleanAll(const char *ifname)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (!ebtables_cmd_path)
|
if (!ebtables_cmd_path)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
NWFILTER_SET_EBTABLES_SHELLVAR(&buf);
|
NWFILTER_SET_EBTABLES_SHELLVAR(&buf);
|
||||||
|
|
||||||
@ -3571,7 +3540,6 @@ static int ebtablesCleanAll(const char *ifname)
|
|||||||
ebtablesRemoveTmpRootChain(&buf, false, ifname);
|
ebtablesRemoveTmpRootChain(&buf, false, ifname);
|
||||||
|
|
||||||
ebiptablesExecCLI(&buf, true, NULL);
|
ebiptablesExecCLI(&buf, true, NULL);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3687,8 +3655,7 @@ ebtablesCreateTmpRootAndSubChains(virBufferPtr buf,
|
|||||||
virHashKeyValuePairPtr filter_names;
|
virHashKeyValuePairPtr filter_names;
|
||||||
const virNWFilterChainPriority *priority;
|
const virNWFilterChainPriority *priority;
|
||||||
|
|
||||||
if (ebtablesCreateTmpRootChain(buf, incoming, ifname) < 0)
|
ebtablesCreateTmpRootChain(buf, incoming, ifname);
|
||||||
return -1;
|
|
||||||
|
|
||||||
filter_names = virHashGetItems(chains,
|
filter_names = virHashGetItems(chains,
|
||||||
ebiptablesFilterOrderSort);
|
ebiptablesFilterOrderSort);
|
||||||
@ -4248,7 +4215,7 @@ err_exit:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ebiptablesDriverInitCLITools(void)
|
ebiptablesDriverInitCLITools(void)
|
||||||
{
|
{
|
||||||
ebtables_cmd_path = virFindFileInPath("ebtables");
|
ebtables_cmd_path = virFindFileInPath("ebtables");
|
||||||
@ -4262,8 +4229,6 @@ ebiptablesDriverInitCLITools(void)
|
|||||||
ip6tables_cmd_path = virFindFileInPath("ip6tables");
|
ip6tables_cmd_path = virFindFileInPath("ip6tables");
|
||||||
if (!ip6tables_cmd_path)
|
if (!ip6tables_cmd_path)
|
||||||
VIR_WARN("Could not find 'ip6tables' executable");
|
VIR_WARN("Could not find 'ip6tables' executable");
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user