mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-13 08:29:32 +02:00
skip "-p all" for ipv6 to avoid warning
This commit is contained in:
+5
-1
@@ -1,8 +1,12 @@
|
|||||||
2008-06-27 Vadim Kurland <vadim@vk.crocodile.org>
|
2008-06-27 Vadim Kurland <vadim@vk.crocodile.org>
|
||||||
|
|
||||||
* ../src/ipt/PolicyCompiler_PrintRule.cpp (PrintRule::_printProtocol):
|
* PolicyCompiler_PrintRule.cpp (PrintRule::_printProtocol):
|
||||||
should use "-p ipv6-icmp" for ipv6 rules.
|
should use "-p ipv6-icmp" for ipv6 rules.
|
||||||
|
|
||||||
|
* PolicyCompiler_PrintRule.cpp (PrintRule::_printProtocol): skip
|
||||||
|
"-p all" for ipv6 to avoid warning "Warning: never matched
|
||||||
|
protocol: all. use exension match instead"
|
||||||
|
|
||||||
2008-06-26 Vadim Kurland <vadim@vk.crocodile.org>
|
2008-06-26 Vadim Kurland <vadim@vk.crocodile.org>
|
||||||
|
|
||||||
* PolicyCompiler_PrintRule.cpp (PrintRule::_printIP): using
|
* PolicyCompiler_PrintRule.cpp (PrintRule::_printIP): using
|
||||||
|
|||||||
@@ -593,32 +593,39 @@ string PolicyCompiler_ipt::PrintRule::_printProtocol(libfwbuilder::Service *srv)
|
|||||||
PolicyCompiler_ipt *ipt_comp = dynamic_cast<PolicyCompiler_ipt*>(compiler);
|
PolicyCompiler_ipt *ipt_comp = dynamic_cast<PolicyCompiler_ipt*>(compiler);
|
||||||
string version = compiler->fw->getStr("version");
|
string version = compiler->fw->getStr("version");
|
||||||
string s;
|
string s;
|
||||||
if (! srv->isAny() &&
|
if (! srv->isAny() && !CustomService::isA(srv) &&
|
||||||
!CustomService::isA(srv) &&
|
!TagService::isA(srv) && !UserService::isA(srv))
|
||||||
!TagService::isA(srv) &&
|
|
||||||
!UserService::isA(srv)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
string pn = srv->getProtocolName();
|
string pn = srv->getProtocolName();
|
||||||
if (pn=="ip") pn = "all";
|
if (pn=="ip") pn = "all";
|
||||||
|
|
||||||
|
if (ipt_comp->ipv6)
|
||||||
|
{
|
||||||
if (pn == "icmp")
|
if (pn == "icmp")
|
||||||
{
|
{
|
||||||
if (ipt_comp->ipv6) s = "-p ipv6-icmp ";
|
s = "-p ipv6-icmp ";
|
||||||
else s = "-p icmp ";
|
if (ipt_comp->newIptables(version)) s += " -m icmp6";
|
||||||
|
} else
|
||||||
if (ipt_comp->newIptables(version))
|
|
||||||
{
|
{
|
||||||
if (ipt_comp->ipv6) s += " -m icmp6";
|
// ip6tables issues warning for commands using "-p all"
|
||||||
else s += " -m icmp ";
|
// Warning: never matched protocol: all. use exension match instead
|
||||||
|
// Skip "-p all" if ipv6
|
||||||
|
if (pn!="all") s = "-p " + pn + " ";
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
{
|
||||||
|
if (pn == "icmp")
|
||||||
|
{
|
||||||
|
s = "-p icmp ";
|
||||||
|
if (ipt_comp->newIptables(version)) s += " -m icmp ";
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
s = "-p " + pn + " ";
|
s = "-p " + pn + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pn == "tcp") s += "-m tcp ";
|
if (pn == "tcp") s += "-m tcp ";
|
||||||
if (pn == "udp") s += "-m udp ";
|
if (pn == "udp") s += "-m udp ";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user