This helps to bring down the frame size of virNWFilterRuleDefFixup, as it
exceeds 8192 bytes when libvirt is build with sanitizers enabled, in debug
mode, on clang.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/nwfilter_conf.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 2448e4b70b..ad1edc98dd 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2191,6 +2191,7 @@ virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
{
ethHdrDataDef *ethHdr;
ipHdrDataDef *ipHdr;
+ portDataDef *portData;
#define COPY_NEG_SIGN(A, B) \
(A).flags = ((A).flags & ~NWFILTER_ENTRY_ITEM_FLAG_IS_NEG) | \
@@ -2262,32 +2263,28 @@ virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
case VIR_NWFILTER_RULE_PROTOCOL_TCP:
case VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6:
ipHdr = &rule->p.tcpHdrFilter.ipHdr;
+ portData = &rule->p.tcpHdrFilter.portData;
COPY_NEG_SIGN(ipHdr->dataSrcIPMask, ipHdr->dataSrcIPAddr);
COPY_NEG_SIGN(ipHdr->dataDstIPMask, ipHdr->dataDstIPAddr);
COPY_NEG_SIGN(ipHdr->dataSrcIPTo, ipHdr->dataSrcIPFrom);
COPY_NEG_SIGN(ipHdr->dataDstIPTo, ipHdr->dataDstIPFrom);
- COPY_NEG_SIGN(rule->p.tcpHdrFilter.portData.dataSrcPortEnd,
- rule->p.tcpHdrFilter.portData.dataSrcPortStart);
- COPY_NEG_SIGN(rule->p.tcpHdrFilter.portData.dataDstPortStart,
- rule->p.tcpHdrFilter.portData.dataSrcPortStart);
- COPY_NEG_SIGN(rule->p.tcpHdrFilter.portData.dataDstPortEnd,
- rule->p.tcpHdrFilter.portData.dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataSrcPortEnd, portData->dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataDstPortStart, portData->dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataDstPortEnd, portData->dataSrcPortStart);
virNWFilterRuleDefFixupIPSet(&rule->p.tcpHdrFilter.ipHdr);
break;
case VIR_NWFILTER_RULE_PROTOCOL_UDP:
case VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6:
ipHdr = &rule->p.udpHdrFilter.ipHdr;
+ portData = &rule->p.udpHdrFilter.portData;
COPY_NEG_SIGN(ipHdr->dataSrcIPMask, ipHdr->dataSrcIPAddr);
COPY_NEG_SIGN(ipHdr->dataDstIPMask, ipHdr->dataDstIPAddr);
COPY_NEG_SIGN(ipHdr->dataSrcIPTo, ipHdr->dataSrcIPFrom);
COPY_NEG_SIGN(ipHdr->dataDstIPTo, ipHdr->dataDstIPFrom);
- COPY_NEG_SIGN(rule->p.udpHdrFilter.portData.dataSrcPortEnd,
- rule->p.udpHdrFilter.portData.dataSrcPortStart);
- COPY_NEG_SIGN(rule->p.udpHdrFilter.portData.dataDstPortStart,
- rule->p.udpHdrFilter.portData.dataSrcPortStart);
- COPY_NEG_SIGN(rule->p.udpHdrFilter.portData.dataDstPortEnd,
- rule->p.udpHdrFilter.portData.dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataSrcPortEnd, portData->dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataDstPortStart, portData->dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataDstPortEnd, portData->dataSrcPortStart);
virNWFilterRuleDefFixupIPSet(&rule->p.udpHdrFilter.ipHdr);
break;
@@ -2324,16 +2321,14 @@ virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
case VIR_NWFILTER_RULE_PROTOCOL_SCTP:
case VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6:
ipHdr = &rule->p.sctpHdrFilter.ipHdr;
+ portData = &rule->p.sctpHdrFilter.portData;
COPY_NEG_SIGN(ipHdr->dataSrcIPMask, ipHdr->dataSrcIPAddr);
COPY_NEG_SIGN(ipHdr->dataDstIPMask, ipHdr->dataDstIPAddr);
COPY_NEG_SIGN(ipHdr->dataSrcIPTo, ipHdr->dataSrcIPFrom);
COPY_NEG_SIGN(ipHdr->dataDstIPTo, ipHdr->dataDstIPFrom);
- COPY_NEG_SIGN(rule->p.sctpHdrFilter.portData.dataSrcPortEnd,
- rule->p.sctpHdrFilter.portData.dataSrcPortStart);
- COPY_NEG_SIGN(rule->p.sctpHdrFilter.portData.dataDstPortStart,
- rule->p.sctpHdrFilter.portData.dataSrcPortStart);
- COPY_NEG_SIGN(rule->p.sctpHdrFilter.portData.dataDstPortEnd,
- rule->p.sctpHdrFilter.portData.dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataSrcPortEnd, portData->dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataDstPortStart, portData->dataSrcPortStart);
+ COPY_NEG_SIGN(portData->dataDstPortEnd, portData->dataSrcPortStart);
virNWFilterRuleDefFixupIPSet(&rule->p.sctpHdrFilter.ipHdr);
break;
--
2.31.1