mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-25 12:47:44 +01:00
see #2220 removing old addMgmtRule method
This commit is contained in:
parent
72f75c8f9b
commit
a1e48d58cd
@ -1175,68 +1175,3 @@ string PolicyCompiler::debugPrintRule(Rule *r)
|
||||
return str.str();
|
||||
}
|
||||
|
||||
PolicyRule* PolicyCompiler::addMgmtRule(Address* src,
|
||||
Address* dst,
|
||||
Service* service,
|
||||
Interface* iface,
|
||||
const PolicyRule::Direction direction,
|
||||
const PolicyRule::Action action,
|
||||
const string &label)
|
||||
{
|
||||
assert(source_ruleset != NULL);
|
||||
|
||||
/* Insert PolicyRules at top so they do not get shadowed by other
|
||||
* rules. Call insertRuleAtTop() with hidden_rule argument true to
|
||||
* make sure this rule gets negative position number and does not
|
||||
* shift positions of other rules. See ticket #16. Also, hidden
|
||||
* rules are not considered for shadowing.
|
||||
*/
|
||||
|
||||
PolicyRule* rule = PolicyRule::cast(source_ruleset->insertRuleAtTop(true));
|
||||
assert(rule != NULL);
|
||||
|
||||
ostringstream str;
|
||||
str << rule->getPosition() << " " << label << " (automatic)" ;
|
||||
rule->setLabel(str.str());
|
||||
|
||||
FWObject *re;
|
||||
re = rule->getSrc(); assert(re!=NULL);
|
||||
RuleElementSrc::cast(re)->reset();
|
||||
if(src != NULL)
|
||||
re->addRef(src);
|
||||
|
||||
re = rule->getDst(); assert(re!=NULL);
|
||||
RuleElementDst::cast(re)->reset();
|
||||
if(dst != NULL)
|
||||
re->addRef(dst);
|
||||
|
||||
re = rule->getSrv(); assert(re!=NULL);
|
||||
RuleElementSrv::cast(re)->reset();
|
||||
if(service != NULL)
|
||||
re->addRef(service);
|
||||
|
||||
re = rule->getWhen(); assert(re!=NULL);
|
||||
RuleElementInterval::cast(re)->reset();
|
||||
|
||||
re = rule->getItf(); assert(re!=NULL);
|
||||
RuleElementItf::cast(re)->reset();
|
||||
if(iface != NULL)
|
||||
{
|
||||
re->addRef(iface);
|
||||
// rule->setInterfaceId(iface->getId());
|
||||
}
|
||||
|
||||
rule->add(dbcopy->create(PolicyRuleOptions::TYPENAME));
|
||||
rule->setLogging(false);
|
||||
rule->enable();
|
||||
rule->setAction(action);
|
||||
rule->setDirection(direction);
|
||||
// Use firewall object ID to generate uique ID for this management rule
|
||||
// to make it stable across different runs of the compiler
|
||||
rule->setUniqueId(
|
||||
dbcopy->getPredictableId(
|
||||
FWObjectDatabase::getStringId(fw->getId()) + "."
|
||||
));
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
@ -143,19 +143,6 @@ namespace fwcompiler {
|
||||
bool cmpRules(libfwbuilder::PolicyRule &r1,
|
||||
libfwbuilder::PolicyRule &r2);
|
||||
|
||||
/**
|
||||
* Insert rule on top of the policy. Use this to add implied
|
||||
* rules.
|
||||
*/
|
||||
libfwbuilder::PolicyRule* addMgmtRule(libfwbuilder::Address* src,
|
||||
libfwbuilder::Address* dst,
|
||||
libfwbuilder::Service* service,
|
||||
libfwbuilder::Interface* iface,
|
||||
const libfwbuilder::PolicyRule::Direction direction,
|
||||
const libfwbuilder::PolicyRule::Action action,
|
||||
const std::string &label);
|
||||
|
||||
|
||||
/**
|
||||
* this processor checks if the rule is associated with an
|
||||
* interface and uses setInterfaceId to record its id. If the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user