From 873aed4eabec7194de28db653e997bb57bd2a9ba Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Fri, 27 Jun 2008 18:50:25 +0000 Subject: [PATCH] should use "-p ipv6-icmp" for ipv6 rules --- doc/ChangeLog | 5 +++ src/ipt/PolicyCompiler_PrintRule.cpp | 8 ++-- test/ipt/objects-for-regression-tests.fwb | 48 ++++++++++++++++++++++- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 544f2a137..98cc769cb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2008-06-27 Vadim Kurland + + * ../src/ipt/PolicyCompiler_PrintRule.cpp (PrintRule::_printProtocol): + should use "-p ipv6-icmp" for ipv6 rules. + 2008-06-26 Vadim Kurland * PolicyCompiler_PrintRule.cpp (PrintRule::_printIP): using diff --git a/src/ipt/PolicyCompiler_PrintRule.cpp b/src/ipt/PolicyCompiler_PrintRule.cpp index a67410118..cdc51a2f2 100644 --- a/src/ipt/PolicyCompiler_PrintRule.cpp +++ b/src/ipt/PolicyCompiler_PrintRule.cpp @@ -599,13 +599,14 @@ string PolicyCompiler_ipt::PrintRule::_printProtocol(libfwbuilder::Service *srv) !UserService::isA(srv) ) { - string pn=srv->getProtocolName(); + string pn = srv->getProtocolName(); if (pn=="ip") pn="all"; - s= "-p " + pn + " "; - if (pn == "icmp") { + if (ipt_comp->ipv6) s = "-p ipv6-icmp "; + else s = "-p icmp "; + if (ipt_comp->newIptables(version)) { if (ipt_comp->ipv6) s += " -m icmp6"; @@ -613,6 +614,7 @@ string PolicyCompiler_ipt::PrintRule::_printProtocol(libfwbuilder::Service *srv) } } else { + s = "-p " + pn + " "; if (pn == "tcp") s += "-m tcp "; if (pn == "udp") s += "-m udp "; } diff --git a/test/ipt/objects-for-regression-tests.fwb b/test/ipt/objects-for-regression-tests.fwb index 9a9882ba6..bcd956e43 100644 --- a/test/ipt/objects-for-regression-tests.fwb +++ b/test/ipt/objects-for-regression-tests.fwb @@ -1,6 +1,6 @@ - + @@ -24375,7 +24375,7 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% - + @@ -24599,6 +24599,46 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -26626,6 +26666,10 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% + + + +