提交 c2fbdf10 编写于 作者: S Stefan Berger

nwfilter: avoid dir. enforcement for certain types of rules

 Avoid the enforcement of direction if
- icmp rules specify the type/code information
- the 'skipMatch' variable is set to 'true'
上级 956e3c58
......@@ -1159,6 +1159,7 @@ _iptablesCreateRuleInstance(int directionIn,
bool srcMacSkipped = false;
bool skipRule = false;
bool skipMatch = false;
bool hasICMPType = false;
if (!iptables_cmd) {
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -1399,6 +1400,8 @@ _iptablesCreateRuleInstance(int directionIn,
if (HAS_ENTRY_ITEM(&rule->p.icmpHdrFilter.dataICMPType)) {
const char *parm;
hasICMPType = true;
if (maySkipICMP)
goto exit_no_error;
......@@ -1507,7 +1510,7 @@ _iptablesCreateRuleInstance(int directionIn,
if (match && !skipMatch)
virBufferVSprintf(&buf, " %s", match);
if (defMatch && match != NULL)
if (defMatch && match != NULL && !skipMatch && !hasICMPType)
iptablesEnforceDirection(directionIn,
rule,
&buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册