diff --git a/doc/ChangeLog b/doc/ChangeLog index 510f67df6..8fc601e8e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,11 @@ 2010-11-10 Vadim Kurland + * NATCompiler_ipt.cpp (processNext): fixed SF bug 3103582 "Cant + create redirect rule in cluster firewall object". Iptables nat + rule with target REDIRECT could not be built in a cluster + configuration. It should be possible to do this by putting cluster + object in Translated Destination. + * OSConfigurator_linux24_interfaces.cpp (printDynamicAddressesConfigurationCommands): fixed #1838 "function configure_interfaces() does not manage ip addresses of vlan interfaces". This function used to take into diff --git a/src/iptlib/NATCompiler_ipt.cpp b/src/iptlib/NATCompiler_ipt.cpp index 7dbe80465..d0a0e6354 100644 --- a/src/iptlib/NATCompiler_ipt.cpp +++ b/src/iptlib/NATCompiler_ipt.cpp @@ -736,12 +736,26 @@ bool NATCompiler_ipt::portTranslationRules::processNext() bool NATCompiler_ipt::specialCaseWithRedirect::processNext() { - NATRule *rule=getNext(); if (rule==NULL) return false; + NATRule *rule = getNext(); if (rule==NULL) return false; - Address *tdst=compiler->getFirstTDst(rule); + Address *tdst = compiler->getFirstTDst(rule); -/* we consider rule redirect only if TDst is a firewall object */ - if (rule->getRuleType() == NATRule::DNAT && tdst->getId()==compiler->fw->getId()) +/* we consider rule redirect only if TDst is a firewall object + * + */ + int fw_id = compiler->fw->getId(); + int cluster_id = -1; + bool cluster_member = compiler->fw->getOptionsObject()->getBool("cluster_member"); + Cluster *cluster = NULL; + if (cluster_member) + { + cluster = Cluster::cast( + compiler->dbcopy->findInIndex(compiler->fw->getInt("parent_cluster_id"))); + cluster_id = cluster->getId(); + } + + if (rule->getRuleType() == NATRule::DNAT && + (tdst->getId() == fw_id || tdst->getId() == cluster_id)) rule->setRuleType(NATRule::Redirect); tmp_queue.push_back(rule); diff --git a/test/ipt/cluster-tests.fwb b/test/ipt/cluster-tests.fwb index 4ce6b4cbd..ec276aec8 100644 --- a/test/ipt/cluster-tests.fwb +++ b/test/ipt/cluster-tests.fwb @@ -105,6 +105,7 @@ established -m state --state ESTABLISHED,RELATED + established @@ -112,6 +113,7 @@ established -m state --state ESTABLISHED,RELATED + established @@ -141,6 +143,12 @@ + + + + + + @@ -203,6 +211,7 @@ + @@ -1279,7 +1288,7 @@ - + @@ -1302,6 +1311,27 @@ + + + + + + + + + + + + + + + + + + + + +