From 1037ff3b0ad37fd83624c3890e8bd672e86a7de6 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Tue, 16 Dec 2008 05:15:07 +0000 Subject: [PATCH] properly using IP6TABLES in NAT rules --- build_num | 2 +- src/ipt/NATCompiler_PrintRule.cpp | 7 +++-- test/ipt/objects-for-regression-tests.fwb | 32 ++++++++++++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/build_num b/build_num index 8de368f66..ac50b326f 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 691 +#define BUILD_NUM 692 diff --git a/src/ipt/NATCompiler_PrintRule.cpp b/src/ipt/NATCompiler_PrintRule.cpp index 18e75fa89..e67c892c8 100644 --- a/src/ipt/NATCompiler_PrintRule.cpp +++ b/src/ipt/NATCompiler_PrintRule.cpp @@ -96,7 +96,8 @@ string NATCompiler_ipt::PrintRule::_createChain(const string &chain) if ( ipt_comp->minus_n_commands->count(chain)==0 ) { - res << "$IPTABLES -t nat -N " << chain << endl; + res << (ipt_comp->ipv6) ? "$IP6TABLES " : "$IPTABLES "; + res << "-t nat -N " << chain << endl; (*(ipt_comp->minus_n_commands))[chain] = true; } return res.str(); @@ -104,7 +105,9 @@ string NATCompiler_ipt::PrintRule::_createChain(const string &chain) string NATCompiler_ipt::PrintRule::_startRuleLine() { - return string("$IPTABLES -t nat -A "); + NATCompiler_ipt *ipt_comp = dynamic_cast(compiler); + string res = (ipt_comp->ipv6) ? "$IP6TABLES " : "$IPTABLES "; + return res + string("-t nat -A "); } string NATCompiler_ipt::PrintRule::_endRuleLine() diff --git a/test/ipt/objects-for-regression-tests.fwb b/test/ipt/objects-for-regression-tests.fwb index cb6ba23e6..9d3e94771 100644 --- a/test/ipt/objects-for-regression-tests.fwb +++ b/test/ipt/objects-for-regression-tests.fwb @@ -1,6 +1,6 @@ - + @@ -790,6 +790,8 @@ + + @@ -35610,8 +35612,31 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35819,6 +35844,7 @@ echo '%FWBPROMPT%'; sh /tmp/%FWSCRIPT% +