mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-11 15:41:41 +02:00
compilers include error and warning messages in generated scripts and config files
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
2008-06-05 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* All compilers: all compilers include error and warning messages
|
||||
produced during compilation in the generated script. Messages are
|
||||
grouped by corresponding section (Policy, NAT, all branches
|
||||
etc.). Normally only warnings will be included because compilers
|
||||
stop when they encounter an error condition, however if compiler
|
||||
is being ran with "-xt" command line option, it does not stop and
|
||||
includes error messages in the output as well. This helps catch
|
||||
changes that generate warnings but do not translate into
|
||||
differences in generated configuration.
|
||||
|
||||
2008-06-02 Vadim Kurland <vadim@vk.crocodile.org>
|
||||
|
||||
* PolicyCompiler_PrintRule.cpp (PrintRule::_printTimeInterval):
|
||||
|
||||
@@ -393,6 +393,14 @@ int main(int argc, char * const * argv)
|
||||
|
||||
ofile << oscnf->getCompiledScript();
|
||||
ofile << endl;
|
||||
|
||||
if (c->haveErrorsAndWarnings())
|
||||
{
|
||||
ofile << "! Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
ofile << c->getErrors();
|
||||
}
|
||||
|
||||
ofile << c->getCompiledScript();
|
||||
ofile << endl;
|
||||
|
||||
|
||||
@@ -513,6 +513,14 @@ int main(int argc, char * const *argv)
|
||||
#else
|
||||
ipf_file.open(ipf_file_name.c_str());
|
||||
#endif
|
||||
|
||||
if (c.haveErrorsAndWarnings())
|
||||
{
|
||||
ipf_file << "# Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
ipf_file << c.getErrors();
|
||||
}
|
||||
|
||||
ipf_file << c.getCompiledScript();
|
||||
ipf_file.close();
|
||||
|
||||
@@ -540,6 +548,15 @@ int main(int argc, char * const *argv)
|
||||
#else
|
||||
nat_file.open(nat_file_name.c_str());
|
||||
#endif
|
||||
|
||||
if (n.haveErrorsAndWarnings())
|
||||
{
|
||||
nat_file << "# NAT compiler errors and warnings:"
|
||||
<< endl;
|
||||
nat_file << n.getErrors();
|
||||
}
|
||||
|
||||
|
||||
nat_file << n.getCompiledScript();
|
||||
nat_file.close();
|
||||
|
||||
|
||||
@@ -445,6 +445,13 @@ int main(int argc, char * const *argv)
|
||||
|
||||
if (have_ipfw)
|
||||
{
|
||||
if (c.haveErrorsAndWarnings())
|
||||
{
|
||||
fw_file << "# Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
fw_file << c.getErrors();
|
||||
}
|
||||
|
||||
fw_file << c.getCompiledScript();
|
||||
}
|
||||
|
||||
|
||||
@@ -610,6 +610,13 @@ _("Dynamic interface %s should not have an IP address object attached to it. Thi
|
||||
n_str << "# ================ Table 'nat', rule set "
|
||||
<< branch_name << endl;
|
||||
|
||||
if (n.haveErrorsAndWarnings())
|
||||
{
|
||||
n_str << "# NAT compiler errors and warnings:"
|
||||
<< endl;
|
||||
n_str << n.getErrors();
|
||||
}
|
||||
|
||||
if (Compiler::isRootRuleSet(nat))
|
||||
n_str << n.flushAndSetDefaultPolicy();
|
||||
|
||||
@@ -657,6 +664,13 @@ _("Dynamic interface %s should not have an IP address object attached to it. Thi
|
||||
}
|
||||
m_str << "# ================ Table 'mangle', rule set "
|
||||
<< branch_name << endl;
|
||||
if (m.haveErrorsAndWarnings())
|
||||
{
|
||||
m_str << "# Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
m_str << m.getErrors();
|
||||
}
|
||||
|
||||
m_str << m.getCompiledScript();
|
||||
m_str << m.commit();
|
||||
m_str << endl;
|
||||
@@ -687,6 +701,12 @@ _("Dynamic interface %s should not have an IP address object attached to it. Thi
|
||||
{
|
||||
c_str << "# ================ Table 'filter', rule set "
|
||||
<< branch_name << endl;
|
||||
if (c.haveErrorsAndWarnings())
|
||||
{
|
||||
c_str << "# Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
c_str << c.getErrors();
|
||||
}
|
||||
c_str << c.getCompiledScript();
|
||||
c_str << c.commit();
|
||||
c_str << endl;
|
||||
|
||||
@@ -716,6 +716,13 @@ int main(int argc, char * const *argv)
|
||||
|
||||
if (n.getCompiledScriptLength() > 0)
|
||||
{
|
||||
if (n.haveErrorsAndWarnings())
|
||||
{
|
||||
*(generated_scripts[ruleset_name])
|
||||
<< "# NAT compiler errors and warnings:"
|
||||
<< endl;
|
||||
*(generated_scripts[ruleset_name]) << n.getErrors();
|
||||
}
|
||||
*(generated_scripts[ruleset_name]) << n.getCompiledScript();
|
||||
*(generated_scripts[ruleset_name]) << endl;
|
||||
}
|
||||
@@ -770,6 +777,13 @@ int main(int argc, char * const *argv)
|
||||
|
||||
if (c.getCompiledScriptLength() > 0)
|
||||
{
|
||||
if (c.haveErrorsAndWarnings())
|
||||
{
|
||||
*(generated_scripts[ruleset_name])
|
||||
<< "# Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
*(generated_scripts[ruleset_name]) << c.getErrors();
|
||||
}
|
||||
*(generated_scripts[ruleset_name]) << c.getCompiledScript();
|
||||
*(generated_scripts[ruleset_name]) << endl;
|
||||
}
|
||||
|
||||
@@ -606,8 +606,24 @@ int main(int argc, char * const * argv)
|
||||
|
||||
ofile << oscnf->getCompiledScript();
|
||||
ofile << endl;
|
||||
|
||||
if (c->haveErrorsAndWarnings())
|
||||
{
|
||||
ofile << "! Policy compiler errors and warnings:"
|
||||
<< endl;
|
||||
ofile << c->getErrors();
|
||||
}
|
||||
|
||||
ofile << c->getCompiledScript();
|
||||
ofile << endl;
|
||||
|
||||
if (n->haveErrorsAndWarnings())
|
||||
{
|
||||
ofile << "! NAT compiler errors and warnings:"
|
||||
<< endl;
|
||||
ofile << n->getErrors();
|
||||
}
|
||||
|
||||
ofile << n->getCompiledScript();
|
||||
|
||||
ofile << endl;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ while (<>) {
|
||||
$fw=$1;
|
||||
printf "\n";
|
||||
printf "echo '***** $fw'\n";
|
||||
printf "fwb_ipt -4 -v -f $XMLFILE $fw\n";
|
||||
printf "fwb_ipt -4 -v -f $XMLFILE -xt $fw\n";
|
||||
$str=~ s/^.*<Firewall [^>]+name="$fw"[^>]+>//;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user