mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-20 10:17:16 +01:00
fixes #2460 resetting nat rule type in the importer; when rule type setting was left over, it affected the behavior of the compiler and broke it if user tried to single-rule compile some rules
This commit is contained in:
parent
5180b43427
commit
f330822c8c
@ -283,6 +283,8 @@ public:
|
|||||||
static QString getConfFileNameFromFwFileName(const QString &file_name,
|
static QString getConfFileNameFromFwFileName(const QString &file_name,
|
||||||
const QString &ext);
|
const QString &ext);
|
||||||
|
|
||||||
|
void setDebugRule(int dr) { drp = drn = dr; rule_debug_on = true; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -848,6 +848,8 @@ void PFImporter::pushNATRule()
|
|||||||
if (action=="rdr") rule->setRuleType(NATRule::DNAT);
|
if (action=="rdr") rule->setRuleType(NATRule::DNAT);
|
||||||
if (action=="nonat") rule->setRuleType(NATRule::NONAT);
|
if (action=="nonat") rule->setRuleType(NATRule::NONAT);
|
||||||
|
|
||||||
|
rule->setAction(NATRule::Translate);
|
||||||
|
|
||||||
// remember that even though NATRule has two interface rule elements
|
// remember that even though NATRule has two interface rule elements
|
||||||
// ("in" and "out"), compiler for PF only uses one, the "outbound" one.
|
// ("in" and "out"), compiler for PF only uses one, the "outbound" one.
|
||||||
QStringList interfaces;
|
QStringList interfaces;
|
||||||
@ -895,6 +897,13 @@ void PFImporter::pushNATRule()
|
|||||||
|
|
||||||
if (nat_rule_opt_2 == "static-port") ropt->setBool("pf_static_port", true);
|
if (nat_rule_opt_2 == "static-port") ropt->setBool("pf_static_port", true);
|
||||||
|
|
||||||
|
// reset rule type. Rule type is used internally by the compilers
|
||||||
|
// and is not stored in the object permanently. Rule type assigned
|
||||||
|
// by the compiler may actually differ from what we use here
|
||||||
|
// (e.g. some DNAT rules are identified as LB -- load balancing --
|
||||||
|
// rules by compilers)
|
||||||
|
rule->setRuleType(NATRule::Unknown);
|
||||||
|
|
||||||
// then add it to the current ruleset
|
// then add it to the current ruleset
|
||||||
ruleset->add(current_rule);
|
ruleset->add(current_rule);
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,11 @@ void CompilerOutputPanel::loadFWObject(FWObject *obj)
|
|||||||
|
|
||||||
// run in test mode to prevent fatal errors from causing exit
|
// run in test mode to prevent fatal errors from causing exit
|
||||||
dr->setTestMode();
|
dr->setTestMode();
|
||||||
dr->setEmbeddedMode();
|
|
||||||
|
if (fwbdebug)
|
||||||
|
dr->setDebugRule(rule->getPosition());
|
||||||
|
else
|
||||||
|
dr->setEmbeddedMode();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@ -209,6 +209,7 @@ QString CompilerDriver_pf::run(const std::string &cluster_id,
|
|||||||
Cluster *cluster = NULL;
|
Cluster *cluster = NULL;
|
||||||
Firewall *fw = NULL;
|
Firewall *fw = NULL;
|
||||||
|
|
||||||
|
|
||||||
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user