1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-21 02:37:16 +01:00

nat and ipv6 in fwb_ipt

This commit is contained in:
Vadim Kurland 2008-05-27 18:12:58 +00:00
parent 122300a7bf
commit 08a8e20052
5 changed files with 675 additions and 90 deletions

View File

@ -342,8 +342,13 @@ void instDialog::prepareInstallerOptions()
if (!aaddr.isEmpty())
cnf.maddr = aaddr;
else
cnf.maddr =
cnf.fwobj->getManagementAddress().toString().c_str();
{
const InetAddr *mgmt_addr = cnf.fwobj->getManagementAddress();
if (mgmt_addr)
cnf.maddr = mgmt_addr->toString().c_str();
else
cnf.maddr = "";
}
}
setReady(true);
@ -718,8 +723,13 @@ bool instDialog::doInstallPage(Firewall* f)
if (!aaddr.isEmpty())
cnf.maddr = aaddr;
else
cnf.maddr =
cnf.fwobj->getManagementAddress().toString().c_str();
{
const InetAddr *mgmt_addr = cnf.fwobj->getManagementAddress();
if (mgmt_addr)
cnf.maddr = mgmt_addr->toString().c_str();
else
cnf.maddr = "";
}
}
if (fwbdebug)

View File

@ -217,7 +217,10 @@ void iptAdvancedDialog::accept()
/********************* data for fwbd and install script **************/
PolicyInstallScript *pis = mgmt->getPolicyInstallScript();
mgmt->setAddress( *((Firewall::cast(obj))->getAddressPtr()) );
// find first interface marked as "management"
const InetAddr *mgmt_addr = Firewall::cast(obj)->getManagementAddress();
if (mgmt_addr)
mgmt->setAddress(*mgmt_addr);
pis->setCommand( m_dialog->installScript->text().toLatin1().constData() );
pis->setArguments( m_dialog->installScriptArgs->text().toLatin1().constData() );

View File

@ -2165,6 +2165,11 @@ void NATCompiler_ipt::compile()
// empty rule element.
add( new dropRuleWithEmptyRE("drop rules with empty rule elements"));
if (ipv6)
add( new DropIPv4Rules("drop ipv4 rules"));
else
add( new DropIPv6Rules("drop ipv6 rules"));
add( new eliminateDuplicatesInOSRC("eliminate duplicates in OSRC"));
add( new eliminateDuplicatesInODST("eliminate duplicates in ODST"));
add( new eliminateDuplicatesInOSRV("eliminate duplicates in OSRV"));
@ -2229,6 +2234,7 @@ void NATCompiler_ipt::compile()
add( new DropIPv4Rules("drop ipv4 rules"));
else
add( new DropIPv6Rules("drop ipv6 rules"));
add( new dropRuleWithEmptyRE("drop rules with empty rule elements"));
add( new specialCaseWithUnnumberedInterface(

View File

@ -3008,25 +3008,28 @@ bool PolicyCompiler_ipt::removeFW::processNext()
if (compiler->osconfigurator->getNumOfVirtualAddressesForNat()==0 &&
! rule->getBool("upstream_rule_neg") )
{
RuleElementSrc *srcrel=rule->getSrc();
Address *src =compiler->getFirstSrc(rule);
if (src==NULL)
compiler->abort(string("removeFW: Empty Source rule element in rule ") +
rule->getLabel());
RuleElementDst *dstrel=rule->getDst();
Address *dst =compiler->getFirstDst(rule);
if (dst==NULL)
compiler->abort(string("removeFW: Empty Destination rule element in rule ") +
rule->getLabel());
RuleElementSrc *srcrel = rule->getSrc();
Address *src = compiler->getFirstSrc(rule);
if (src==NULL) compiler->abort(
string("removeFW: Empty Source rule element in rule ") +
rule->getLabel());
RuleElementDst *dstrel = rule->getDst();
Address *dst = compiler->getFirstDst(rule);
if (dst==NULL) compiler->abort(
string("removeFW: Empty Destination rule element in rule ") +
rule->getLabel());
if (( rule->getStr("ipt_chain")=="INPUT" ||
rule->getStr("upstream_rule_chain")=="INPUT") && dst->getId()==compiler->getFwId() )
rule->getStr("upstream_rule_chain")=="INPUT") &&
dst->getId()==compiler->getFwId() )
{
dstrel->reset();
}
if (( rule->getStr("ipt_chain")=="OUTPUT" ||
rule->getStr("upstream_rule_chain")=="OUTPUT") && src->getId()==compiler->getFwId() )
rule->getStr("upstream_rule_chain")=="OUTPUT") &&
src->getId()==compiler->getFwId() )
{
srcrel->reset();
}

File diff suppressed because it is too large Load Diff