diff --git a/VERSION b/VERSION index 65dc28a1b..c8c44d4d6 100644 --- a/VERSION +++ b/VERSION @@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0 # build number is like "nano" version number. I am incrementing build # number during development cycle # -BUILD_NUM="3557" +BUILD_NUM="3559" VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM" diff --git a/VERSION.h b/VERSION.h index 29e63cd86..f8b2665b6 100644 --- a/VERSION.h +++ b/VERSION.h @@ -1,2 +1,2 @@ -#define VERSION "5.0.0.3557" +#define VERSION "5.0.0.3559" #define GENERATION "5.0" diff --git a/doc/ChangeLog b/doc/ChangeLog index 95692807d..c4e5b0e00 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,55 @@ +2011-07-07 Vadim Kurland + + * RoutingCompiler.cpp (processNext): see #2191 "Crash when + compiling a route with table object". Compiler for PF crashed + when run-time AddressTable object was used in RDst of a routing + rule. + + * PFImporter.cpp (makeAddressObj): see #2546 "PF import - negation + inside of inline tables is ignored". Since we can not import + address lists or tables that contain a mix of negated and + non-negated items, importer should display an error when it + enounters one of these and mark all rules that use it as "broken" + (rule is colored red and error message is added to the comment). + + * PFImporter.cpp (makeAddressObj): see #2556 "PF import: impor of + rules referring to undefined macros". If pf.conf file uses an + undefined macro (there is $macro somewhere but the macro has never + been defined), importer issues a warning, creates run-time DNSName + object with the name "$macro" and marks all rules where it is used + as broken, that is, rules are colored red and the error message is + added to the comment field. Using run-time DNSName object makes + compiler use "$macro" in the generated pf rule which means + fwbuilder generates exactly the same pf rule as the one it tried + to import. + + * PFImporterRun.cpp (run): see #2554 "PF import: create groups of + address objects for macros where possible". Importer for PF + recognizes macros that define lists of ip addresses, interfaces or + host names and creates object groups with the same name from them. + Only macros that contain at least one ip address in the list are + recognized. + + * PF import: check if a macro used somewhere in the file to be + imported is actually defined and abort if not + + * PF import: see #2551 making sure rules that have route-to option + get the call to setRoute() in the importer + 2011-07-06 Vadim Kurland + * applied two patches by Vadim Zhukov persgray@gmail.com to + replace calls to sprintf with safer calls to snprintf and fix some + compiler warnings. + + * Importer.cpp (addStandardImportComment): see #2552 "PF import: + add ability to suppress comments referring to line numbers in the + original file". + + * PFImporter.cpp (pushPolicyRule): see #2551 "PF Import - source + routing rules are not imported with rule options set". Importer + should import "route-to" rule parameters. + * PFImporter.cpp (newAddressTableObject): see #2546 "PF import - negation inside of inline tables is ignored". We can not import PF table definition that has some addresses negated. diff --git a/packaging/fwbuilder-static-qt.spec b/packaging/fwbuilder-static-qt.spec index 02536c3dd..849b49537 100644 --- a/packaging/fwbuilder-static-qt.spec +++ b/packaging/fwbuilder-static-qt.spec @@ -3,7 +3,7 @@ %define name fwbuilder -%define version 5.0.0.3557 +%define version 5.0.0.3559 %define release 1 %if "%_vendor" == "MandrakeSoft" diff --git a/packaging/fwbuilder.control b/packaging/fwbuilder.control index 585b32549..da2a38a19 100644 --- a/packaging/fwbuilder.control +++ b/packaging/fwbuilder.control @@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu Priority: extra Section: checkinstall Maintainer: vadim@fwbuilder.org -Version: 5.0.0.3557-1 +Version: 5.0.0.3559-1 Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15 Description: Firewall Builder GUI and policy compilers diff --git a/packaging/fwbuilder.spec b/packaging/fwbuilder.spec index 24c32dda9..09dd6431c 100644 --- a/packaging/fwbuilder.spec +++ b/packaging/fwbuilder.spec @@ -1,6 +1,6 @@ %define name fwbuilder -%define version 5.0.0.3557 +%define version 5.0.0.3559 %define release 1 %if "%_vendor" == "MandrakeSoft" diff --git a/src/antlr/String.cpp b/src/antlr/String.cpp index ae70f4797..526b0a1bf 100644 --- a/src/antlr/String.cpp +++ b/src/antlr/String.cpp @@ -21,24 +21,25 @@ namespace antlr { // wh: hack for Borland C++ 5.6 #if __BORLANDC__ - using std::sprintf; + using std::snprintf; #endif // RK: should be using snprintf actually... (or stringstream) -ANTLR_C_USING(sprintf) +ANTLR_C_USING(snprintf) ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ) { char tmp[100]; - sprintf(tmp,"%d",rhs); + snprintf(tmp, sizeof(tmp), "%d", rhs); return lhs+tmp; } ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ) { char tmp[100]; - sprintf(tmp,"%u",rhs); + snprintf(tmp, sizeof(tmp), "%zu", rhs); +// sprintf(tmp,"%u",rhs); return lhs+tmp; } diff --git a/src/cisco_lib/CompilerDriver_iosacl_run.cpp b/src/cisco_lib/CompilerDriver_iosacl_run.cpp index 4b04f9e9b..d6a528687 100644 --- a/src/cisco_lib/CompilerDriver_iosacl_run.cpp +++ b/src/cisco_lib/CompilerDriver_iosacl_run.cpp @@ -110,6 +110,11 @@ QString CompilerDriver_iosacl::assembleFwScript(Cluster *cluster, options->setStr("prolog_script", options->getStr("iosacl_prolog_script")); options->setStr("epilog_script", options->getStr("iosacl_epilog_script")); + // we do not offer user a choice of the place where to put prolog + // lines, therefore we can reset this attribute to make sure it + // does not interfere + options->setStr("prolog_place", ""); + assembleFwScriptInternal(cluster, fw, cluster_member, oscnf, &script_skeleton, &top_comment, "!", true); return script_skeleton.expand(); diff --git a/src/import/Importer.cpp b/src/import/Importer.cpp index c152a6a65..d55990ca0 100644 --- a/src/import/Importer.cpp +++ b/src/import/Importer.cpp @@ -167,6 +167,8 @@ Importer::~Importer() void Importer::clear() { + last_comment.clear(); + action = ""; protocol = ""; @@ -560,6 +562,13 @@ void Importer::pushRule() // then add it to the current ruleset current_ruleset->ruleset->add(current_rule); + if (error_tracker->hasWarnings()) + { + QStringList warn = error_tracker->getWarnings(); + addMessageToLog("Warning: " + warn.join("\n")); + markCurrentRuleBad(); + } + if (error_tracker->hasErrors()) { QStringList err = error_tracker->getErrors(); @@ -789,6 +798,9 @@ void Importer::markCurrentRuleBad() if ( ! current_rule->getComment().empty()) comment.append(QString::fromUtf8(current_rule->getComment().c_str())); + foreach(QString err, error_tracker->getWarnings()) + comment.append(err); + foreach(QString err, error_tracker->getErrors()) comment.append(err); @@ -898,6 +910,16 @@ void Importer::addMessageToLog(const QString &msg) } } +/** + * This function adds "standard" comment to the object, plus text + * passed as @additional_comment argument. If the object already has + * some comment, it is preserved and new text is appended to it. If + * flag add_standard_comments is false, then comment referring to the + * line number in the original file is not added, but + * @additional_comment is added anyway. Note that we also add comments + * to rules in case of errors but those are not suppressed by the flag + * add_standard_comments + */ void Importer::addStandardImportComment(FWObject *obj, const QString &additional_comment) { @@ -916,10 +938,13 @@ void Importer::addStandardImportComment(FWObject *obj, if ( ! additional_comment.isEmpty()) comment << additional_comment; - QString file_and_line("Created during import of %1 line %2"); - comment << file_and_line - .arg(QString::fromUtf8(input_file_name.c_str())) - .arg(getCurrentLineNumber()); + if (add_standard_comments) + { + QString file_and_line("Created during import of %1 line %2"); + comment << file_and_line + .arg(QString::fromUtf8(input_file_name.c_str())) + .arg(getCurrentLineNumber()); + } obj->setComment(comment.join("\n").toUtf8().constData()); obj->setBool(".import-commited", true); @@ -991,3 +1016,18 @@ void Importer::rearrangeVlanInterfaces() } +void Importer::registerBrokenObject(FWObject *obj, const QString &err) +{ + broken_objects[obj] = err; +} + +bool Importer::isObjectBroken(FWObject *obj) +{ + return broken_objects.count(obj) != 0; +} + +QString Importer::getBrokenObjectError(FWObject *obj) +{ + return broken_objects[obj]; +} + diff --git a/src/import/Importer.h b/src/import/Importer.h index b0acefba2..9700fb7db 100644 --- a/src/import/Importer.h +++ b/src/import/Importer.h @@ -142,6 +142,13 @@ protected: // use this to quickly find objects to avoid creating duplicates std::map all_objects; + // registry of broken objects. Sometimes we create an AddressTable + // or a group object during import that may have some kind of a problem + // that we leave for the user to fix manually. In order to be able to mark + // all rules that use this object as "broken", we should register these + // broken objects somewhere. + std::map broken_objects; + UnidirectionalRuleSet* current_ruleset; libfwbuilder::Rule* current_rule; @@ -203,6 +210,10 @@ protected: virtual void addOSrv(); virtual void addLogging(); + + void registerBrokenObject(libfwbuilder::FWObject *o, const QString &err); + bool isObjectBroken(libfwbuilder::FWObject*); + QString getBrokenObjectError(libfwbuilder::FWObject*); public: @@ -211,6 +222,9 @@ public: // making logger public so I can access it from the code in the grammar libfwbuilder::Logger *logger; + QStringList last_comment; + bool add_standard_comments; + // temporary variables used by parser to store values // Importer converts these into a proper rule using method // pushRule() @@ -298,6 +312,7 @@ public: void setUserChoiceHostOS(const std::string &s) { user_choice_host_os = s; } void setUserChoiceVersion(const std::string &s) { user_choice_version = s; } + void setAddStandardCommentsFlag(bool f) { add_standard_comments = f; } virtual void setHostName(const std::string &hn); virtual void newInterface(const std::string &interface_name); diff --git a/src/import/PFImporter.cpp b/src/import/PFImporter.cpp index 6accd5cee..4cf12d90c 100644 --- a/src/import/PFImporter.cpp +++ b/src/import/PFImporter.cpp @@ -507,11 +507,25 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as) return intf; } else { - // TODO: create and return DNSName object + QString name = QString::fromUtf8(as.address.c_str()); + if (name.startsWith('$')) + { + /* + * We perform macro substitutions in + * PFImporter::substituteMacros(), however if we get a + * host name that starts with a '$' here, then this is + * an undefined macro that could not be substituted. + * Mark rule as bad but still create run-time DNSName + * object. + */ + error_tracker->registerWarning( + QObject::tr("Macro '%1' was undefined, rule may be broken") + .arg(name)); + } ObjectSignature sig(error_tracker); sig.type_name = DNSName::TYPENAME; - sig.object_name = QString::fromUtf8(as.address.c_str()); - sig.dns_name = QString::fromUtf8(as.address.c_str()); + sig.object_name = name; + sig.dns_name = name; return address_maker->createObject(sig); } } @@ -573,7 +587,12 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as) if (as.at == AddressSpec::TABLE) { - return address_table_registry[as.address.c_str()]; + FWObject *at = address_table_registry[as.address.c_str()]; + if (isObjectBroken(at)) + { + error_tracker->registerError(getBrokenObjectError(at)); + } + return at; } return NULL; @@ -651,6 +670,13 @@ void PFImporter::pushRule() assert(current_rule!=NULL); + if (error_tracker->hasWarnings()) + { + QStringList warn = error_tracker->getWarnings(); + addMessageToLog("Warning: " + warn.join("\n")); + markCurrentRuleBad(); + } + if (error_tracker->hasErrors()) { QStringList err = error_tracker->getErrors(); @@ -828,6 +854,52 @@ void PFImporter::pushPolicyRule() */ if (! queue.empty()) ropt->setStr("pf_classify_str", queue); + /* + * route-to options + * + */ + if (route_type != UNKNOWN && route_group.size() != 0) + { + switch (route_type) + { + case ROUTE_TO: + ropt->setStr("pf_route_option", "route_through"); break; + + case REPLY_TO: + ropt->setStr("pf_route_option", "route_reply_through"); break; + + case DUP_TO: + ropt->setStr("pf_route_option", "route_copy_through"); break; + + default: ; + } + + QStringList route_opt_addr; + list::iterator it; + for (it=route_group.begin(); it!=route_group.end(); ++it) + { + RouteSpec &rs = *it; + + Interface *intf = getInterfaceByName(rs.iface); + if (intf == NULL) + { + // this interface was never used in "on " clause before + newInterface(rs.iface); + } + + ropt->setStr("pf_route_opt_if", rs.iface); + + if (rs.netmask.empty()) + route_opt_addr << rs.address.c_str(); + else + route_opt_addr << QString("%1/%2") + .arg(rs.address.c_str()).arg(rs.netmask.c_str()); + } + ropt->setStr("pf_route_opt_addr", route_opt_addr.join(",").toStdString()); + + rule->setRouting( ! ropt->getStr("pf_route_option").empty()); + } + /* * Protocols are in proto_list * Source addresses are in src_group @@ -1308,21 +1380,28 @@ void PFImporter::newAddressTableObject(const string &name, .arg(QString::fromUtf8(name.c_str())) .arg(addr_list.join(", "))); - if (has_negations) - { - // can not use error_tracker->registerError() here because - // tables are created before importer encounters any rules and - // so this error can not be associated with a rule. - addMessageToLog( - QObject::tr("Error: import of table definition with negated addresses is not supported.")); - } - ObjectMaker maker(Library::cast(library), error_tracker); FWObject *og = commitObject(maker.createObject(ObjectGroup::TYPENAME, name.c_str())); assert(og!=NULL); address_table_registry[name.c_str()] = og; + if (has_negations) + { + // can not use error_tracker->registerError() here because + // tables are created before importer encounters any rules and + // so this error can not be associated with a rule. + QString err = + QObject::tr("Error: import of table definition with negated " + "addresses is not supported."); + addMessageToLog(err); + + err = + QObject::tr("Address table '%1' has a mix of negated and non-negated " + "addresses in the original file."); + registerBrokenObject(og, err.arg(QString::fromUtf8(name.c_str()))); + } + for (it=addresses.begin(); it!=addresses.end(); ++it) { FWObject *obj = makeAddressObj(*it); diff --git a/src/import/PFImporter.h b/src/import/PFImporter.h index 97d5c48ee..5400ae3de 100644 --- a/src/import/PFImporter.h +++ b/src/import/PFImporter.h @@ -61,7 +61,10 @@ class PFImporter : public Importer const std::list< PortSpec > &src_port_spec_list, const std::list< PortSpec > &dst_port_spec_list, bool for_nat_rhs); - + + void substituteMacros(const QMap ¯os, + QString &buffer); + public: typedef enum { diff --git a/src/import/PFImporterRun.cpp b/src/import/PFImporterRun.cpp index 6e5ac4b36..d019cc74c 100644 --- a/src/import/PFImporterRun.cpp +++ b/src/import/PFImporterRun.cpp @@ -23,6 +23,8 @@ #include "../../config.h" +#include "fwbuilder/InetAddr.h" + #include "PFImporter.h" #include @@ -42,6 +44,7 @@ extern int fwbdebug; using namespace std; +using namespace libfwbuilder; /* @@ -81,7 +84,10 @@ void PFImporter::run() QRegExp inline_comment("#.*$"); QRegExp macro_definition("^\\s*(\\S+)\\s*=\\s*(.*)$"); + QRegExp list_of_items("^\\{\\s*((\\S+,?\\s*)+)\\s*\\}$"); + QMap macros; + QMap macros_source_lines; foreach(QString str, whole_input.split("\n")) { @@ -91,32 +97,110 @@ void PFImporter::run() if (macro_definition.indexIn(work_str) != -1) { + QString macro_name = macro_definition.cap(1); QString value = macro_definition.cap(2); - macros[macro_definition.cap(1)] = value.replace("\"", "").trimmed(); + value.replace('\"', ""); + value = value.simplified(); + + macros[macro_name] = value; + macros_source_lines[macro_name] = macro_definition.cap(0); + } + } + + QMapIterator it(macros); + while (it.hasNext()) + { + it.next(); + QString macro_name = it.key(); + QString value = it.value(); + substituteMacros(macros, value); + macros[macro_name] = value; + } + + it = macros; + while (it.hasNext()) + { + it.next(); + QString macro_name = it.key(); + QString value = it.value(); + + qDebug() << "Macro: name=" << macro_name << "value=" << value; + + /* + * Special case: if this macro defines list of addresses + * in '{' '}', we convert it to a table with the same name + * so that importer later on can create object group for + * it. + * + * RegExp list_of_items assumes the string has been + * stripped of any quotes and trimmed. + */ + if (list_of_items.indexIn(value) != -1) + { + qDebug() << "This macro defines a list"; + + /* + * we only convert to table if the list contains at + * least one ip address. We assume that if there is an + * address there, then all items in the list must + * represent addresses, host names or interface names + * because pf does not allow mixed address/service + * lists anywhere. + */ + QString list_str = list_of_items.cap(1); + list_str.replace(",", ""); + QStringList items = list_str.split(QRegExp("\\s"), + QString::SkipEmptyParts); + qDebug() << items; + + bool has_address = false; + foreach(QString item, items) + { + qDebug() << "Item:" << item; + if (!item.isEmpty() && (item.contains(':') || item.contains('.'))) + { + try + { + InetAddr(item.toStdString()); + // stop the loop if string successfully + // converts to an ip address + has_address = true; + break; + } catch(FWException &ex) + { + ; + } + } + } + + if (has_address) + { + /* + * Convert as follows: + * Macro: + * name = "{ 1.1.1.1 2.2.2.2 }" + * to a table: + * table "{ 1.1.1.1 2.2.2.2 }" + */ + QString table_def("table <%1> %2"); + whole_input.replace(macros_source_lines[macro_name], + table_def.arg(macro_name).arg(value)); + /* + * And add a macro to the dictionary to map macro_name to + * the table + */ + macros[macro_name] = "<" + macro_name + ">"; + + qDebug() << "Replacing macro definition with table:"; + qDebug() << table_def.arg(macro_name).arg(value); + } } } if (fwbdebug) qDebug() << "Macros defined in this file: " << macros; - // make several passes: sometimes macros can use other macros - int pass = 0; - while (1) - { - QMapIterator it(macros); - while (it.hasNext()) - { - it.next(); - QString macro_name = it.key(); - QString macro_value = it.value(); - QRegExp macro_instance(QString("\\$%1(?=\\W)").arg(macro_name)); - - whole_input.replace(macro_instance, macro_value); - } - QRegExp any_macro_instance("\\$\\w+\\W"); - if (! whole_input.contains(any_macro_instance)) break; - pass++; - } + substituteMacros(macros, whole_input); if (fwbdebug) { @@ -171,3 +255,38 @@ void PFImporter::run() *logger << err.join("\n").toUtf8().constData(); } +void PFImporter::substituteMacros(const QMap ¯os, + QString &buffer) +{ + // make several passes: sometimes macros can use other macros + QRegExp any_macro_instance("\\$(\\w+)\\W"); + + for (;;) + { + QMapIterator it(macros); + while (it.hasNext()) + { + it.next(); + QString macro_name = it.key(); + QString macro_value = it.value(); + QRegExp macro_instance(QString("\\$%1(?=\\W)").arg(macro_name)); + + buffer.replace(macro_instance, macro_value); + } + + bool has_known_macros = false; + if (any_macro_instance.indexIn(buffer) != -1) + { + QString macro_name = any_macro_instance.cap(1); + if (macros.contains(macro_name)) has_known_macros = true; + else + { + QString err; + err = QObject::tr("Warning: Macro %1 is undefined").arg(macro_name); + *logger << err.toUtf8().constData(); + } + } + if (!has_known_macros) break; + } +} + diff --git a/src/import/objectMaker.cpp b/src/import/objectMaker.cpp index 440a61c70..c903f6f52 100644 --- a/src/import/objectMaker.cpp +++ b/src/import/objectMaker.cpp @@ -81,6 +81,12 @@ void ObjectMakerErrorTracker::registerError(const QString &msg) error_status = true; } +void ObjectMakerErrorTracker::registerWarning(const QString &msg) +{ + if ( ! warnings.contains(msg)) warnings.append(msg); + warning_status = true; +} + ObjectSignature::ObjectSignature(ObjectMakerErrorTracker *et) { @@ -317,6 +323,7 @@ ObjectSignature::ObjectSignature(ObjectMakerErrorTracker *et) } ObjectSignature::ObjectSignature(const ObjectSignature &other) + : libfwbuilder::Dispatch(other) { error_tracker = other.error_tracker; diff --git a/src/import/objectMaker.h b/src/import/objectMaker.h index 51023ed8a..2a4cbc3a5 100644 --- a/src/import/objectMaker.h +++ b/src/import/objectMaker.h @@ -76,15 +76,21 @@ class ObjectMakerErrorTracker { QStringList errors; bool error_status; + QStringList warnings; + bool warning_status; public: - ObjectMakerErrorTracker() { error_status = false; } + ObjectMakerErrorTracker() { error_status = false; warning_status = false; } - void clear() { error_status = false; errors.clear(); } + void clear() { error_status = false; warning_status = false; errors.clear(); warnings.clear(); } void registerError(const QString &msg); bool hasErrors() { return error_status; } QStringList getErrors() { return errors; } + + void registerWarning(const QString &msg); + bool hasWarnings() { return warning_status; } + QStringList getWarnings() { return warnings; } }; diff --git a/src/libfwbuilder/src/fwcompiler/RoutingCompiler.cpp b/src/libfwbuilder/src/fwcompiler/RoutingCompiler.cpp index d739fcb77..9c78ecbbf 100644 --- a/src/libfwbuilder/src/fwcompiler/RoutingCompiler.cpp +++ b/src/libfwbuilder/src/fwcompiler/RoutingCompiler.cpp @@ -32,6 +32,7 @@ #include "RoutingCompiler.h" +#include "fwbuilder/AddressTable.h" #include "fwbuilder/AddressRange.h" #include "fwbuilder/RuleElement.h" #include "fwbuilder/Network.h" @@ -53,6 +54,7 @@ #include "fwbuilder/XMLTools.h" #include "fwbuilder/FWException.h" #include "fwbuilder/Group.h" +#include "fwbuilder/MultiAddress.h" #include #include @@ -831,4 +833,35 @@ bool RoutingCompiler::createSortedDstIdsLabel::processNext() return true; } +/* + * This is identical to + * PolicyCompiler_ipf::processMultiAddressObjectsInRE::processNext() + * TODO: move the code to the class Compiler so it can be reused. + */ +bool RoutingCompiler::processMultiAddressObjectsInRE::processNext() +{ + RoutingRule *rule = getNext(); if (rule==NULL) return false; + RuleElement *re = RuleElement::cast( rule->getFirstByType(re_type) ); + + for (FWObject::iterator i=re->begin(); i!=re->end(); i++) + { + FWObject *o= *i; + if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer(); + MultiAddressRunTime *atrt = MultiAddressRunTime::cast(o); + if (atrt!=NULL && atrt->getSubstitutionTypeName()==AddressTable::TYPENAME) + compiler->abort( + rule, + "Run-time AddressTable objects are not supported."); + + AddressTable *at = AddressTable::cast(o); + if (at && at->isRunTime()) + compiler->abort( + rule, + "Run-time AddressTable objects are not supported."); + } + + tmp_queue.push_back(rule); + return true; +} + diff --git a/src/libfwbuilder/src/fwcompiler/RoutingCompiler.h b/src/libfwbuilder/src/fwcompiler/RoutingCompiler.h index cc546fb16..dbbf237bf 100644 --- a/src/libfwbuilder/src/fwcompiler/RoutingCompiler.h +++ b/src/libfwbuilder/src/fwcompiler/RoutingCompiler.h @@ -230,6 +230,26 @@ namespace fwcompiler }; friend class RoutingCompiler::classifyRoutingRules; + /** + * Placeholders for MultiAddressRunTime objects + */ + class processMultiAddressObjectsInRE : public RoutingRuleProcessor + { + std::string re_type; + public: + processMultiAddressObjectsInRE(const std::string &name, + const std::string &t) : RoutingRuleProcessor(name) { re_type=t; } + virtual bool processNext(); + }; + + class processMultiAddressObjectsInRDst : public processMultiAddressObjectsInRE + { + public: + processMultiAddressObjectsInRDst(const std::string &n) : + processMultiAddressObjectsInRE( + n, libfwbuilder::RuleElementRDst::TYPENAME) {} + }; + /** * detects if rules r1 and r2 are identical (that is, have the * same effect, rather than use the same objects) diff --git a/src/libgui/importFirewallConfigurationWizard/IC_PlatformWarningPage.cpp b/src/libgui/importFirewallConfigurationWizard/IC_PlatformWarningPage.cpp index 1bc2fc5f6..c286db8cc 100644 --- a/src/libgui/importFirewallConfigurationWizard/IC_PlatformWarningPage.cpp +++ b/src/libgui/importFirewallConfigurationWizard/IC_PlatformWarningPage.cpp @@ -52,8 +52,9 @@ IC_PlatformWarningPage::IC_PlatformWarningPage(QWidget *parent) : QWizardPage(pa // user-chosen host os and version, so far we only show these for PF registerField("hostOS*", m_dialog->hostOS); registerField("version*", m_dialog->version); + registerField("addStandardComments", m_dialog->addStandardComments); - m_dialog->hostOSAndVersionFrame->hide(); + m_dialog->importOptionsFrame->hide(); platformOk = false; } @@ -242,7 +243,7 @@ void IC_PlatformWarningPage::initializePage() wz->version_list.append(i1->first); } - m_dialog->hostOSAndVersionFrame->show(); + m_dialog->importOptionsFrame->show(); break; } diff --git a/src/libgui/importFirewallConfigurationWizard/IC_ProgressPage.cpp b/src/libgui/importFirewallConfigurationWizard/IC_ProgressPage.cpp index 0e64e718c..e151d1b67 100644 --- a/src/libgui/importFirewallConfigurationWizard/IC_ProgressPage.cpp +++ b/src/libgui/importFirewallConfigurationWizard/IC_ProgressPage.cpp @@ -158,9 +158,11 @@ void IC_ProgressPage::initializePage() { int host_os_idx = field("hostOS").toInt(); int version_idx = field("version").toInt(); + bool add_standard_comments = field("addStandardComments").toBool(); importer->setUserChoiceHostOS( wz->host_os_list.at( host_os_idx )); importer->setUserChoiceVersion( wz->version_list.at( version_idx )); + importer->setAddStandardCommentsFlag(add_standard_comments); } connect(importer, SIGNAL(destroyed(QObject*)), diff --git a/src/libgui/importFirewallConfigurationWizard/ImporterThread.cpp b/src/libgui/importFirewallConfigurationWizard/ImporterThread.cpp index a504b6838..0cb2bb0bc 100644 --- a/src/libgui/importFirewallConfigurationWizard/ImporterThread.cpp +++ b/src/libgui/importFirewallConfigurationWizard/ImporterThread.cpp @@ -66,6 +66,7 @@ ImporterThread::ImporterThread(QWidget *ui, this->deduplicate = deduplicate; importer = NULL; stopFlag = false; + addStandardComments = false; } ImporterThread::~ImporterThread() @@ -83,6 +84,11 @@ void ImporterThread::setUserChoiceVersion(const QString &s) userChoiceVersion = s; } +void ImporterThread::setAddStandardCommentsFlag(bool f) +{ + addStandardComments = f; +} + void ImporterThread::run() { QThreadLogger *logger = new QThreadLogger(); @@ -114,6 +120,8 @@ void ImporterThread::run() if ( ! userChoiceVersion.isEmpty()) importer->setUserChoiceVersion(userChoiceVersion.toStdString()); + importer->setAddStandardCommentsFlag(addStandardComments); + importer->setFileName(fileName.toUtf8().constData()); if (deduplicate) importer->prepareForDeduplication(); diff --git a/src/libgui/importFirewallConfigurationWizard/ImporterThread.h b/src/libgui/importFirewallConfigurationWizard/ImporterThread.h index 73a4e8450..e9b212bd9 100644 --- a/src/libgui/importFirewallConfigurationWizard/ImporterThread.h +++ b/src/libgui/importFirewallConfigurationWizard/ImporterThread.h @@ -56,6 +56,7 @@ class ImporterThread : public QThread bool stopFlag; QString userChoiceHostOS; QString userChoiceVersion; + bool addStandardComments; public: ImporterThread(QWidget *ui, @@ -74,6 +75,7 @@ public: void setUserChoiceHostOS(const QString &s); void setUserChoiceVersion(const QString &s); + void setAddStandardCommentsFlag(bool f); signals: void finished(); diff --git a/src/libgui/importFirewallConfigurationWizard/ic_platformwarningpage_q.ui b/src/libgui/importFirewallConfigurationWizard/ic_platformwarningpage_q.ui index be954939c..0cb847d53 100644 --- a/src/libgui/importFirewallConfigurationWizard/ic_platformwarningpage_q.ui +++ b/src/libgui/importFirewallConfigurationWizard/ic_platformwarningpage_q.ui @@ -13,97 +13,103 @@ WizardPage - - - - - - - TextLabel - - - true - - - - - - - Firewall Platform: - - - - - - - TextLabel - - - - - - - Qt::Horizontal - - - - 388 - 20 - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - - - Host OS: - - - - - - - - - - Version: - - - - - - - - - - - - - Qt::Horizontal - - - - 258 - 20 - - - - - + + + + + TextLabel + + + true + + + + + Firewall Platform: + + + + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 442 + 20 + + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + + + Host OS: + + + + + + + + + + Version: + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 329 + 20 + + + + + + + + Add line numbers in the original file to comments in rules and objects + + + + + + + diff --git a/src/libgui/ruleoptionsdialog_q.ui b/src/libgui/ruleoptionsdialog_q.ui index 1b7d4fffd..f59339617 100644 --- a/src/libgui/ruleoptionsdialog_q.ui +++ b/src/libgui/ruleoptionsdialog_q.ui @@ -1719,7 +1719,7 @@ p, li { white-space: pre-wrap; } QTabWidget::Triangular - 6 + 0 @@ -2429,7 +2429,14 @@ p, li { white-space: pre-wrap; } - + + + + 300 + 0 + + + @@ -2564,7 +2571,7 @@ p, li { white-space: pre-wrap; } QTabWidget::Triangular - 1 + 0 diff --git a/src/libgui/utils.cpp b/src/libgui/utils.cpp index f0e3f43f9..3b6e0150d 100644 --- a/src/libgui/utils.cpp +++ b/src/libgui/utils.cpp @@ -503,7 +503,8 @@ void doSetObjectIcon(FWObject *obj, QPixmap *pm, int icon_size) default: icn_sfx = "icon"; break; } - if (obj->getRO()) + // note that we do not have "locked" version of large icons + if (obj->getRO() && icon_size != 2) icn_alias = ":/Icons/lock"; else { diff --git a/src/parsers/PFCfgLexer.cpp b/src/parsers/PFCfgLexer.cpp index b33837de9..95937e554 100644 --- a/src/parsers/PFCfgLexer.cpp +++ b/src/parsers/PFCfgLexer.cpp @@ -1,4 +1,4 @@ -/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgLexer.cpp"$ */ +/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgLexer.cpp"$ */ #line 43 "pf.g" // gets inserted before the antlr generated includes in the cpp @@ -44,92 +44,92 @@ PFCfgLexer::PFCfgLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& st void PFCfgLexer::initLiterals() { - literals["badhead"] = 199; - literals["notifications"] = 233; + literals["badhead"] = 201; + literals["notifications"] = 235; literals["state-policy"] = 26; literals["floating"] = 28; literals["no"] = 84; literals["counters"] = 72; literals["esp"] = 126; - literals["routersol"] = 158; + literals["routersol"] = 160; literals["frags"] = 60; - literals["reply-to"] = 139; + literals["reply-to"] = 140; literals["icmp.first"] = 49; literals["string-key"] = 99; literals["gre"] = 125; literals["pass"] = 86; literals["scrub"] = 65; - literals["warnings"] = 234; + literals["warnings"] = 236; literals["include"] = 6; literals["skip"] = 32; literals["timeout"] = 13; literals["eigrp"] = 128; - literals["icmp-type"] = 149; - literals["transit"] = 197; + literals["icmp-type"] = 151; + literals["transit"] = 199; literals["inet"] = 115; - literals["no-df"] = 144; + literals["no-df"] = 146; literals["network"] = 77; - literals["photuris"] = 174; + literals["photuris"] = 176; literals["igmp"] = 120; - literals["unreach"] = 152; - literals["range"] = 226; + literals["unreach"] = 154; + literals["range"] = 228; literals["rsvp"] = 124; - literals["debugging"] = 229; - literals["host-tos"] = 187; - literals["paramprob"] = 160; + literals["debugging"] = 231; + literals["host-tos"] = 189; + literals["paramprob"] = 162; literals["user"] = 113; - literals["interface"] = 215; + literals["interface"] = 217; literals["adaptive.end"] = 58; literals["limit"] = 21; literals["state-defaults"] = 29; literals["hex-key"] = 98; - literals["net-unk"] = 181; + literals["net-unk"] = 183; literals["antispoof"] = 9; literals["udp.single"] = 47; - literals["inforeq"] = 163; - literals["ipv6-here"] = 171; - literals["redir"] = 154; + literals["inforeq"] = 165; + literals["ipv6-here"] = 173; + literals["redir"] = 156; literals["static-port"] = 88; - literals["common-adv"] = 196; + literals["common-adv"] = 198; literals["loginterface"] = 22; literals["ip"] = 118; - literals["mobregreq"] = 172; + literals["mobregreq"] = 174; literals["conservative"] = 17; literals["ospf"] = 129; - literals["proto-unr"] = 177; + literals["proto-unr"] = 179; literals["peer"] = 79; - literals["inforep"] = 164; - literals["errors"] = 231; + literals["inforep"] = 166; + literals["errors"] = 233; literals["tables-entries"] = 64; literals["any"] = 136; - literals["mobregrep"] = 173; - literals["label"] = 212; - literals["pptp"] = 222; - literals["synproxy"] = 210; + literals["mobregrep"] = 175; + literals["label"] = 214; + literals["pptp"] = 224; + literals["synproxy"] = 212; literals["debug"] = 37; - literals["alerts"] = 227; + literals["alerts"] = 229; literals["all"] = 112; - literals["state"] = 211; - literals["tag"] = 207; + literals["state"] = 213; + literals["tag"] = 209; literals["in"] = 108; literals["tables"] = 63; literals["file"] = 73; - literals["nos"] = 219; + literals["nos"] = 221; literals["src-nodes"] = 62; - literals["ipv6-where"] = 170; + literals["ipv6-where"] = 172; literals["require-order"] = 30; literals["udp"] = 122; literals["states"] = 61; literals["sticky-address"] = 101; literals["return-icmp"] = 106; - literals["redir-tos-net"] = 193; - literals["pim"] = 221; - literals["emergencies"] = 230; - literals["squench"] = 153; - literals["disable"] = 235; - literals["flags"] = 148; + literals["redir-tos-net"] = 195; + literals["pim"] = 223; + literals["emergencies"] = 232; + literals["squench"] = 155; + literals["disable"] = 237; + literals["flags"] = 150; literals["tcp"] = 121; - literals["net-tos"] = 186; + literals["net-tos"] = 188; literals["reassemble"] = 38; literals["adaptive.start"] = 57; literals["frag"] = 54; @@ -137,58 +137,59 @@ void PFCfgLexer::initLiterals() literals["icmp"] = 119; literals["to"] = 114; literals["return-rst"] = 104; - literals["normal-adv"] = 195; + literals["normal-adv"] = 197; literals["optimization"] = 15; literals["log"] = 110; - literals["fragment"] = 141; - literals["snp"] = 224; + literals["fragment"] = 143; + literals["snp"] = 226; literals["broadcast"] = 78; - literals["icmp6-type"] = 205; + literals["icmp6-type"] = 207; literals["normal"] = 19; - literals["code"] = 150; + literals["code"] = 152; literals["if-bound"] = 27; literals["src.track"] = 56; - literals["drop-ovl"] = 143; - literals["routeradv"] = 157; + literals["drop-ovl"] = 145; + literals["routeradv"] = 159; literals["other.single"] = 52; + literals["dup-to"] = 141; literals["bitmask"] = 95; - literals["maskreq"] = 165; + literals["maskreq"] = 167; literals["ipip"] = 130; literals["tcp.closed"] = 45; literals["block"] = 103; literals["high-latency"] = 18; literals["udp.first"] = 46; - literals["badlen"] = 201; + literals["badlen"] = 203; literals["tcp.first"] = 40; - literals["host-unr"] = 176; + literals["host-unr"] = 178; literals["ah"] = 127; - literals["random-id"] = 147; - literals["modulate"] = 209; + literals["random-id"] = 149; + literals["modulate"] = 211; literals["interval"] = 55; - literals["maskrep"] = 166; + literals["maskrep"] = 168; literals["ruleset-optimization"] = 14; - literals["trace"] = 167; - literals["rip"] = 223; + literals["trace"] = 169; + literals["rip"] = 225; literals["urpf-failed"] = 135; literals["set"] = 12; literals["source-hash"] = 97; - literals["critical"] = 228; - literals["quit"] = 214; + literals["critical"] = 230; + literals["quit"] = 216; literals["icmp.error"] = 50; literals["const"] = 71; literals["altq"] = 10; literals["tcp.closing"] = 43; - literals["port-unr"] = 178; + literals["port-unr"] = 180; literals["table"] = 67; - literals["redir-tos-host"] = 194; + literals["redir-tos-host"] = 196; literals["fingerprints"] = 31; literals["return"] = 25; - literals["optmiss"] = 200; + literals["optmiss"] = 202; literals["match"] = 66; - literals["keep"] = 208; - literals["net-prohib"] = 184; + literals["keep"] = 210; + literals["net-prohib"] = 186; literals["inet6"] = 116; - literals["group"] = 140; + literals["group"] = 142; literals["from"] = 134; literals["tcp.finwait"] = 44; literals["hostid"] = 39; @@ -196,64 +197,64 @@ void PFCfgLexer::initLiterals() literals["vrrp"] = 131; literals["drop"] = 24; literals["l2tp"] = 132; - literals["max-mss"] = 146; - literals["isolate"] = 183; - literals["timereq"] = 161; + literals["max-mss"] = 148; + literals["isolate"] = 185; + literals["timereq"] = 163; literals["aggressive"] = 16; - literals["icmp6"] = 216; - literals["echoreq"] = 156; + literals["icmp6"] = 218; + literals["echoreq"] = 158; literals["tcp.established"] = 42; - literals["decrypt-fail"] = 204; - literals["mobredir"] = 169; + literals["decrypt-fail"] = 206; + literals["mobredir"] = 171; literals["other.first"] = 51; - literals["ipsec"] = 218; + literals["ipsec"] = 220; literals["no-route"] = 137; literals["random"] = 96; literals["binat"] = 102; - literals["srcfail"] = 180; + literals["srcfail"] = 182; literals["self"] = 80; - literals["timerep"] = 162; - literals["crop"] = 142; - literals["host-preced"] = 189; - literals["host"] = 225; - literals["echorep"] = 151; + literals["timerep"] = 164; + literals["crop"] = 144; + literals["host-preced"] = 191; + literals["host"] = 227; + literals["echorep"] = 153; literals["other.multiple"] = 53; - literals["althost"] = 155; + literals["althost"] = 157; literals["udp.multiple"] = 48; - literals["cutoff-preced"] = 190; - literals["redir-host"] = 192; + literals["cutoff-preced"] = 192; + literals["redir-host"] = 194; literals["rdr"] = 89; - literals["tagged"] = 206; + literals["tagged"] = 208; literals["on"] = 33; literals["round-robin"] = 100; - literals["pcp"] = 220; + literals["pcp"] = 222; literals["block-policy"] = 23; literals["persist"] = 70; - literals["unknown-ind"] = 202; - literals["redir-net"] = 191; - literals["filter-prohib"] = 188; + literals["unknown-ind"] = 204; + literals["redir-net"] = 193; + literals["filter-prohib"] = 190; literals["nat"] = 85; literals["satellite"] = 20; - literals["informational"] = 232; - literals["needfrag"] = 179; + literals["informational"] = 234; + literals["needfrag"] = 181; literals["tcp.opening"] = 41; - literals["igrp"] = 217; + literals["igrp"] = 219; literals["quick"] = 111; - literals["timex"] = 159; - literals["host-unk"] = 182; - literals["route-to"] = 138; - literals["dataconv"] = 168; + literals["timex"] = 161; + literals["host-unk"] = 184; + literals["route-to"] = 139; + literals["dataconv"] = 170; literals["rdp"] = 123; - literals["net-unr"] = 175; + literals["net-unr"] = 177; literals["queue"] = 11; literals["isis"] = 133; - literals["reassemb"] = 198; - literals["inactive"] = 236; + literals["reassemb"] = 200; + literals["inactive"] = 238; literals["out"] = 109; - literals["min-ttl"] = 145; - literals["auth-fail"] = 203; - literals["exit"] = 213; - literals["host-prohib"] = 185; + literals["min-ttl"] = 147; + literals["auth-fail"] = 205; + literals["exit"] = 215; + literals["host-prohib"] = 187; } ANTLR_USE_NAMESPACE(antlr)RefToken PFCfgLexer::nextToken() @@ -265,6 +266,12 @@ ANTLR_USE_NAMESPACE(antlr)RefToken PFCfgLexer::nextToken() resetText(); try { // for lexical and char stream error handling switch ( LA(1)) { + case 0x23 /* '#' */ : + { + mCOMMENT_START(true); + theRetToken=_returnToken; + break; + } case 0xa /* '\n' */ : case 0xd /* '\r' */ : { @@ -272,6 +279,7 @@ ANTLR_USE_NAMESPACE(antlr)RefToken PFCfgLexer::nextToken() theRetToken=_returnToken; break; } + case 0x24 /* '$' */ : case 0x30 /* '0' */ : case 0x31 /* '1' */ : case 0x32 /* '2' */ : @@ -497,11 +505,7 @@ ANTLR_USE_NAMESPACE(antlr)RefToken PFCfgLexer::nextToken() break; } default: - if ((LA(1) == 0x23 /* '#' */ ) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff))) { - mLINE_COMMENT(true); - theRetToken=_returnToken; - } - else if ((LA(1) == 0x22 /* '\"' */ ) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff))) { + if ((LA(1) == 0x22 /* '\"' */ ) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff))) { mSTRING(true); theRetToken=_returnToken; } @@ -509,10 +513,6 @@ ANTLR_USE_NAMESPACE(antlr)RefToken PFCfgLexer::nextToken() mWhitespace(true); theRetToken=_returnToken; } - else if ((LA(1) == 0x23 /* '#' */ ) && (true)) { - mNUMBER_SIGN(true); - theRetToken=_returnToken; - } else if ((LA(1) == 0x22 /* '\"' */ ) && (true)) { mDOUBLE_QUOTE(true); theRetToken=_returnToken; @@ -547,68 +547,6 @@ tryAgain:; } } -void PFCfgLexer::mLINE_COMMENT(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = LINE_COMMENT; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match("#"); - { // ( ... )* - for (;;) { - if ((_tokenSet_1.member(LA(1)))) { - { - match(_tokenSet_1); - } - } - else { - goto _loop275; - } - - } - _loop275:; - } // ( ... )* - mNEWLINE(false); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void PFCfgLexer::mNEWLINE(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NEWLINE; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - { - if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ )) { - match("\r\n"); - } - else if ((LA(1) == 0xd /* '\r' */ ) && (true)) { - match('\r' /* charlit */ ); - } - else if ((LA(1) == 0xa /* '\n' */ )) { - match('\n' /* charlit */ ); - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - - } - if ( inputState->guessing==0 ) { -#line 1982 "pf.g" - newline(); -#line 603 "PFCfgLexer.cpp" - } - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - void PFCfgLexer::mWhitespace(bool _createToken) { int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); _ttype = Whitespace; @@ -678,9 +616,56 @@ void PFCfgLexer::mWhitespace(bool _createToken) { } } if ( inputState->guessing==0 ) { -#line 1977 "pf.g" +#line 1996 "pf.g" _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; -#line 684 "PFCfgLexer.cpp" +#line 622 "PFCfgLexer.cpp" + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PFCfgLexer::mCOMMENT_START(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMENT_START; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('#' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PFCfgLexer::mNEWLINE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NEWLINE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ )) { + match("\r\n"); + } + else if ((LA(1) == 0xd /* '\r' */ ) && (true)) { + match('\r' /* charlit */ ); + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + if ( inputState->guessing==0 ) { +#line 2001 "pf.g" + newline(); +#line 669 "PFCfgLexer.cpp" } if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { _token = makeToken(_ttype); @@ -865,17 +850,17 @@ void PFCfgLexer::mNUM_HEX_4DIGIT(bool _createToken) { mHEX_DIGIT(false); { - if ((_tokenSet_2.member(LA(1)))) { + if ((_tokenSet_1.member(LA(1)))) { { mHEX_DIGIT(false); } { - if ((_tokenSet_2.member(LA(1)))) { + if ((_tokenSet_1.member(LA(1)))) { { mHEX_DIGIT(false); } { - if ((_tokenSet_2.member(LA(1)))) { + if ((_tokenSet_1.member(LA(1)))) { mHEX_DIGIT(false); } else { @@ -905,330 +890,485 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { _ttype = NUMBER_ADDRESS_OR_WORD; ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - bool synPredMatched328 = false; - if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_3.member(LA(2))) && (_tokenSet_3.member(LA(3))))) { - int _m328 = mark(); - synPredMatched328 = true; - inputState->guessing++; - try { - { - mNUM_3DIGIT(false); - match('.' /* charlit */ ); - mNUM_3DIGIT(false); - match('.' /* charlit */ ); - } - } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched328 = false; - } - rewind(_m328); - inputState->guessing--; - } - if ( synPredMatched328 ) { + switch ( LA(1)) { + case 0x3a /* ':' */ : + { { - mNUM_3DIGIT(false); - match('.' /* charlit */ ); - mNUM_3DIGIT(false); - match('.' /* charlit */ ); - mNUM_3DIGIT(false); - match('.' /* charlit */ ); - mNUM_3DIGIT(false); - } - if ( inputState->guessing==0 ) { -#line 2037 "pf.g" - _ttype = IPV4; -#line 941 "PFCfgLexer.cpp" - } - } - else { - bool synPredMatched335 = false; - if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_3.member(LA(2))) && (_tokenSet_3.member(LA(3))))) { - int _m335 = mark(); - synPredMatched335 = true; + bool synPredMatched318 = false; + if (((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && (_tokenSet_1.member(LA(3))))) { + int _m318 = mark(); + synPredMatched318 = true; inputState->guessing++; try { { + match(':' /* charlit */ ); + match(':' /* charlit */ ); { // ( ... )+ - int _cnt332=0; + int _cnt317=0; for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); + if ((_tokenSet_1.member(LA(1)))) { + mHEX_DIGIT(false); } else { - if ( _cnt332>=1 ) { goto _loop332; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt317>=1 ) { goto _loop317; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt332++; + _cnt317++; } - _loop332:; - } // ( ... )+ - match('.' /* charlit */ ); - { // ( ... )+ - int _cnt334=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt334>=1 ) { goto _loop334; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt334++; - } - _loop334:; + _loop317:; } // ( ... )+ } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched335 = false; + synPredMatched318 = false; } - rewind(_m335); + rewind(_m318); inputState->guessing--; } - if ( synPredMatched335 ) { + if ( synPredMatched318 ) { { + match(':' /* charlit */ ); + match(':' /* charlit */ ); { // ( ... )+ - int _cnt338=0; + int _cnt321=0; for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); + if ((_tokenSet_1.member(LA(1)))) { + mHEX_DIGIT(false); } else { - if ( _cnt338>=1 ) { goto _loop338; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt321>=1 ) { goto _loop321; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt338++; + _cnt321++; } - _loop338:; + _loop321:; } // ( ... )+ - match('.' /* charlit */ ); - { // ( ... )+ - int _cnt340=0; + { // ( ... )* for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); + if ((LA(1) == 0x3a /* ':' */ )) { + match(':' /* charlit */ ); + { // ( ... )+ + int _cnt324=0; + for (;;) { + if ((_tokenSet_1.member(LA(1)))) { + mHEX_DIGIT(false); + } + else { + if ( _cnt324>=1 ) { goto _loop324; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt324++; + } + _loop324:; + } // ( ... )+ } else { - if ( _cnt340>=1 ) { goto _loop340; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + goto _loop325; } - _cnt340++; } - _loop340:; - } // ( ... )+ + _loop325:; + } // ( ... )* } if ( inputState->guessing==0 ) { -#line 2040 "pf.g" - _ttype = NUMBER; -#line 1024 "PFCfgLexer.cpp" +#line 2047 "pf.g" + _ttype = IPV6; +#line 977 "PFCfgLexer.cpp" + } + } + else if ((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && (true)) { + { + match(':' /* charlit */ ); + match(':' /* charlit */ ); + } + if ( inputState->guessing==0 ) { +#line 2049 "pf.g" + _ttype = IPV6; +#line 988 "PFCfgLexer.cpp" + } + } + else if ((LA(1) == 0x3a /* ':' */ ) && (true)) { + match(':' /* charlit */ ); + if ( inputState->guessing==0 ) { +#line 2051 "pf.g" + _ttype = COLON; +#line 996 "PFCfgLexer.cpp" } } else { - bool synPredMatched303 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_4.member(LA(2))) && (true))) { - int _m303 = mark(); - synPredMatched303 = true; + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + case 0x24 /* '$' */ : + { + match('$' /* charlit */ ); + { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + default: + { + goto _loop348; + } + } + } + _loop348:; + } // ( ... )* + if ( inputState->guessing==0 ) { +#line 2075 "pf.g" + _ttype = MACRO; +#line 1170 "PFCfgLexer.cpp" + } + break; + } + default: + bool synPredMatched328 = false; + if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))))) { + int _m328 = mark(); + synPredMatched328 = true; + inputState->guessing++; + try { + { + mNUM_3DIGIT(false); + match('.' /* charlit */ ); + mNUM_3DIGIT(false); + match('.' /* charlit */ ); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched328 = false; + } + rewind(_m328); + inputState->guessing--; + } + if ( synPredMatched328 ) { + { + mNUM_3DIGIT(false); + match('.' /* charlit */ ); + mNUM_3DIGIT(false); + match('.' /* charlit */ ); + mNUM_3DIGIT(false); + match('.' /* charlit */ ); + mNUM_3DIGIT(false); + } + if ( inputState->guessing==0 ) { +#line 2056 "pf.g" + _ttype = IPV4; +#line 1207 "PFCfgLexer.cpp" + } + } + else { + bool synPredMatched335 = false; + if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))))) { + int _m335 = mark(); + synPredMatched335 = true; inputState->guessing++; try { { { // ( ... )+ - int _cnt302=0; + int _cnt332=0; for (;;) { - if ((_tokenSet_2.member(LA(1)))) { - mHEX_DIGIT(false); + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); } else { - if ( _cnt302>=1 ) { goto _loop302; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt332>=1 ) { goto _loop332; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt302++; + _cnt332++; } - _loop302:; + _loop332:; + } // ( ... )+ + match('.' /* charlit */ ); + { // ( ... )+ + int _cnt334=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt334>=1 ) { goto _loop334; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt334++; + } + _loop334:; } // ( ... )+ - match(':' /* charlit */ ); } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched303 = false; + synPredMatched335 = false; } - rewind(_m303); + rewind(_m335); inputState->guessing--; } - if ( synPredMatched303 ) { - { + if ( synPredMatched335 ) { { { // ( ... )+ - int _cnt307=0; + int _cnt338=0; for (;;) { - if ((_tokenSet_2.member(LA(1)))) { - mHEX_DIGIT(false); + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); } else { - if ( _cnt307>=1 ) { goto _loop307; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt338>=1 ) { goto _loop338; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt307++; + _cnt338++; } - _loop307:; + _loop338:; } // ( ... )+ + match('.' /* charlit */ ); { // ( ... )+ - int _cnt311=0; + int _cnt340=0; for (;;) { - if ((LA(1) == 0x3a /* ':' */ )) { - match(':' /* charlit */ ); - { // ( ... )* - for (;;) { - if ((_tokenSet_2.member(LA(1)))) { - mHEX_DIGIT(false); - } - else { - goto _loop310; - } - - } - _loop310:; - } // ( ... )* + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); } else { - if ( _cnt311>=1 ) { goto _loop311; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt340>=1 ) { goto _loop340; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt311++; + _cnt340++; } - _loop311:; + _loop340:; } // ( ... )+ } if ( inputState->guessing==0 ) { -#line 2022 "pf.g" - _ttype = IPV6; -#line 1105 "PFCfgLexer.cpp" - } +#line 2059 "pf.g" + _ttype = NUMBER; +#line 1290 "PFCfgLexer.cpp" } } else { - bool synPredMatched313 = false; - if (((LA(1) == 0x3a /* ':' */ ))) { - int _m313 = mark(); - synPredMatched313 = true; + bool synPredMatched303 = false; + if (((_tokenSet_1.member(LA(1))) && (_tokenSet_3.member(LA(2))) && (true))) { + int _m303 = mark(); + synPredMatched303 = true; inputState->guessing++; try { { + { // ( ... )+ + int _cnt302=0; + for (;;) { + if ((_tokenSet_1.member(LA(1)))) { + mHEX_DIGIT(false); + } + else { + if ( _cnt302>=1 ) { goto _loop302; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt302++; + } + _loop302:; + } // ( ... )+ match(':' /* charlit */ ); } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched313 = false; + synPredMatched303 = false; } - rewind(_m313); + rewind(_m303); inputState->guessing--; } - if ( synPredMatched313 ) { + if ( synPredMatched303 ) { { - bool synPredMatched318 = false; - if (((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && (_tokenSet_2.member(LA(3))))) { - int _m318 = mark(); - synPredMatched318 = true; - inputState->guessing++; - try { - { + { + { // ( ... )+ + int _cnt307=0; + for (;;) { + if ((_tokenSet_1.member(LA(1)))) { + mHEX_DIGIT(false); + } + else { + if ( _cnt307>=1 ) { goto _loop307; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt307++; + } + _loop307:; + } // ( ... )+ + { // ( ... )+ + int _cnt311=0; + for (;;) { + if ((LA(1) == 0x3a /* ':' */ )) { match(':' /* charlit */ ); - match(':' /* charlit */ ); - { // ( ... )+ - int _cnt317=0; + { // ( ... )* for (;;) { - if ((_tokenSet_2.member(LA(1)))) { + if ((_tokenSet_1.member(LA(1)))) { mHEX_DIGIT(false); } else { - if ( _cnt317>=1 ) { goto _loop317; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + goto _loop310; } - _cnt317++; - } - _loop317:; - } // ( ... )+ } + _loop310:; + } // ( ... )* } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched318 = false; + else { + if ( _cnt311>=1 ) { goto _loop311; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - rewind(_m318); - inputState->guessing--; + + _cnt311++; } - if ( synPredMatched318 ) { - { - match(':' /* charlit */ ); - match(':' /* charlit */ ); - { // ( ... )+ - int _cnt321=0; - for (;;) { - if ((_tokenSet_2.member(LA(1)))) { - mHEX_DIGIT(false); - } - else { - if ( _cnt321>=1 ) { goto _loop321; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt321++; - } - _loop321:; - } // ( ... )+ - { // ( ... )* - for (;;) { - if ((LA(1) == 0x3a /* ':' */ )) { - match(':' /* charlit */ ); - { // ( ... )+ - int _cnt324=0; - for (;;) { - if ((_tokenSet_2.member(LA(1)))) { - mHEX_DIGIT(false); - } - else { - if ( _cnt324>=1 ) { goto _loop324; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt324++; - } - _loop324:; - } // ( ... )+ - } - else { - goto _loop325; - } - - } - _loop325:; - } // ( ... )* - } - if ( inputState->guessing==0 ) { -#line 2028 "pf.g" - _ttype = IPV6; -#line 1207 "PFCfgLexer.cpp" - } + _loop311:; + } // ( ... )+ } - else if ((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && (true)) { - { - match(':' /* charlit */ ); - match(':' /* charlit */ ); - } - if ( inputState->guessing==0 ) { -#line 2030 "pf.g" - _ttype = IPV6; -#line 1218 "PFCfgLexer.cpp" - } + if ( inputState->guessing==0 ) { +#line 2041 "pf.g" + _ttype = IPV6; +#line 1371 "PFCfgLexer.cpp" } - else if ((LA(1) == 0x3a /* ':' */ ) && (true)) { - match(':' /* charlit */ ); - if ( inputState->guessing==0 ) { -#line 2032 "pf.g" - _ttype = COLON; -#line 1226 "PFCfgLexer.cpp" - } - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } } else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true)) { @@ -1247,12 +1387,12 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { _loop342:; } // ( ... )+ if ( inputState->guessing==0 ) { -#line 2042 "pf.g" +#line 2061 "pf.g" _ttype = INT_CONST; -#line 1253 "PFCfgLexer.cpp" +#line 1393 "PFCfgLexer.cpp" } } - else if ((_tokenSet_5.member(LA(1))) && (true) && (true)) { + else if ((_tokenSet_4.member(LA(1))) && (true) && (true)) { { switch ( LA(1)) { case 0x61 /* 'a' */ : @@ -1472,9 +1612,9 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { _loop345:; } // ( ... )* if ( inputState->guessing==0 ) { -#line 2053 "pf.g" +#line 2072 "pf.g" _ttype = WORD; -#line 1478 "PFCfgLexer.cpp" +#line 1618 "PFCfgLexer.cpp" } } else { @@ -1498,15 +1638,15 @@ void PFCfgLexer::mSTRING(bool _createToken) { match('\"' /* charlit */ ); { // ( ... )* for (;;) { - if ((_tokenSet_6.member(LA(1)))) { + if ((_tokenSet_5.member(LA(1)))) { matchNot('\"' /* charlit */ ); } else { - goto _loop348; + goto _loop351; } } - _loop348:; + _loop351:; } // ( ... )* match('\"' /* charlit */ ); if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { @@ -1531,20 +1671,6 @@ void PFCfgLexer::mPIPE_CHAR(bool _createToken) { _saveIndex=0; } -void PFCfgLexer::mNUMBER_SIGN(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NUMBER_SIGN; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - match('#' /* charlit */ ); - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - void PFCfgLexer::mPERCENT(bool _createToken) { int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); _ttype = PERCENT; @@ -1923,36 +2049,20 @@ const unsigned long PFCfgLexer::_tokenSet_0_data_[] = { 4294958072UL, 1UL, 0UL, // 0xe4 0xe5 0xe6 0xe7 0xe8 0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0 0xf1 // 0xf2 0xf3 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_0(_tokenSet_0_data_,16); -const unsigned long PFCfgLexer::_tokenSet_1_data_[] = { 4294958072UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14 -// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # $ % -// & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G -// H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g h -// i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 -// 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 -// 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f -// 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad -// 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb -// 0xbc 0xbd 0xbe 0xbf 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 0xc8 0xc9 -// 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0 0xd1 0xd2 0xd3 0xd4 0xd5 0xd6 0xd7 -// 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf 0xe0 0xe1 0xe2 0xe3 0xe4 0xe5 -// 0xe6 0xe7 0xe8 0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf3 -// 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_1(_tokenSet_1_data_,16); -const unsigned long PFCfgLexer::_tokenSet_2_data_[] = { 0UL, 67043328UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgLexer::_tokenSet_1_data_[] = { 0UL, 67043328UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_2(_tokenSet_2_data_,10); -const unsigned long PFCfgLexer::_tokenSet_3_data_[] = { 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_1(_tokenSet_1_data_,10); +const unsigned long PFCfgLexer::_tokenSet_2_data_[] = { 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // . 0 1 2 3 4 5 6 7 8 9 -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_3(_tokenSet_3_data_,10); -const unsigned long PFCfgLexer::_tokenSet_4_data_[] = { 0UL, 134152192UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_2(_tokenSet_2_data_,10); +const unsigned long PFCfgLexer::_tokenSet_3_data_[] = { 0UL, 134152192UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // 0 1 2 3 4 5 6 7 8 9 : A B C D E F a b c d e f -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_4(_tokenSet_4_data_,10); -const unsigned long PFCfgLexer::_tokenSet_5_data_[] = { 0UL, 0UL, 134217726UL, 134217726UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_3(_tokenSet_3_data_,10); +const unsigned long PFCfgLexer::_tokenSet_4_data_[] = { 0UL, 0UL, 134217726UL, 134217726UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h // i j k l m n o p q r s t u v w x y z -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_5(_tokenSet_5_data_,10); -const unsigned long PFCfgLexer::_tokenSet_6_data_[] = { 4294967288UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_4(_tokenSet_4_data_,10); +const unsigned long PFCfgLexer::_tokenSet_5_data_[] = { 4294967288UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 // 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! # $ // % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F @@ -1967,5 +2077,5 @@ const unsigned long PFCfgLexer::_tokenSet_6_data_[] = { 4294967288UL, 4294967291 // 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf 0xe0 0xe1 0xe2 0xe3 0xe4 0xe5 // 0xe6 0xe7 0xe8 0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf3 // 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_6(_tokenSet_6_data_,16); +const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_5(_tokenSet_5_data_,16); diff --git a/src/parsers/PFCfgLexer.hpp b/src/parsers/PFCfgLexer.hpp index a2eec961c..37c434224 100644 --- a/src/parsers/PFCfgLexer.hpp +++ b/src/parsers/PFCfgLexer.hpp @@ -9,7 +9,7 @@ #line 11 "PFCfgLexer.hpp" #include -/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgLexer.hpp"$ */ +/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgLexer.hpp"$ */ #include #include #include @@ -48,9 +48,9 @@ public: PFCfgLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); PFCfgLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); - public: void mLINE_COMMENT(bool _createToken); - public: void mNEWLINE(bool _createToken); public: void mWhitespace(bool _createToken); + public: void mCOMMENT_START(bool _createToken); + public: void mNEWLINE(bool _createToken); protected: void mINT_CONST(bool _createToken); protected: void mHEX_CONST(bool _createToken); protected: void mNUMBER(bool _createToken); @@ -63,7 +63,6 @@ public: public: void mNUMBER_ADDRESS_OR_WORD(bool _createToken); public: void mSTRING(bool _createToken); public: void mPIPE_CHAR(bool _createToken); - public: void mNUMBER_SIGN(bool _createToken); public: void mPERCENT(bool _createToken); public: void mAMPERSAND(bool _createToken); public: void mAPOSTROPHE(bool _createToken); @@ -104,8 +103,6 @@ private: static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; static const unsigned long _tokenSet_5_data_[]; static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; - static const unsigned long _tokenSet_6_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; }; #endif /*INC_PFCfgLexer_hpp_*/ diff --git a/src/parsers/PFCfgParser.cpp b/src/parsers/PFCfgParser.cpp index 706125d25..58bb44bc5 100644 --- a/src/parsers/PFCfgParser.cpp +++ b/src/parsers/PFCfgParser.cpp @@ -1,4 +1,4 @@ -/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgParser.cpp"$ */ +/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgParser.cpp"$ */ #line 43 "pf.g" // gets inserted before the antlr generated includes in the cpp @@ -51,7 +51,7 @@ void PFCfgParser::cfgfile() { { // ( ... )* for (;;) { switch ( LA(1)) { - case LINE_COMMENT: + case COMMENT_START: { comment(); break; @@ -155,7 +155,18 @@ void PFCfgParser::comment() { Tracer traceInOut(this, "comment"); try { // for error handling - match(LINE_COMMENT); + match(COMMENT_START); +#line 156 "pf.g" + + QStringList str; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + str << QString::fromUtf8(LT(1)->getText().c_str()); + consume(); + } + importer->last_comment << str.join(" "); + +#line 170 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -168,7 +179,7 @@ void PFCfgParser::include_command() { try { // for error handling match(INCLUDE_COMMAND); -#line 158 "pf.g" +#line 169 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -176,7 +187,7 @@ void PFCfgParser::include_command() { QString("Error: import of 'include' commands is not supported.")); consumeUntil(NEWLINE); -#line 180 "PFCfgParser.cpp" +#line 191 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -190,13 +201,13 @@ void PFCfgParser::macro_definition() { try { // for error handling match(WORD); match(EQUAL); -#line 169 "pf.g" +#line 180 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); consumeUntil(NEWLINE); -#line 200 "PFCfgParser.cpp" +#line 211 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -209,7 +220,7 @@ void PFCfgParser::altq_rule() { try { // for error handling match(ALTQ); -#line 189 "pf.g" +#line 200 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -217,7 +228,7 @@ void PFCfgParser::altq_rule() { QString("import of 'altq' commands is not supported.")); consumeUntil(NEWLINE); -#line 221 "PFCfgParser.cpp" +#line 232 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -230,7 +241,7 @@ void PFCfgParser::antispoof_rule() { try { // for error handling match(ANTISPOOF); -#line 178 "pf.g" +#line 189 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -238,7 +249,7 @@ void PFCfgParser::antispoof_rule() { QString("Warning: import of 'antispoof' commands has not been implemented yet.")); consumeUntil(NEWLINE); -#line 242 "PFCfgParser.cpp" +#line 253 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -251,7 +262,7 @@ void PFCfgParser::queue_rule() { try { // for error handling match(QUEUE); -#line 200 "pf.g" +#line 211 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -259,7 +270,7 @@ void PFCfgParser::queue_rule() { QString("import of 'queue' commands is not supported.")); consumeUntil(NEWLINE); -#line 263 "PFCfgParser.cpp" +#line 274 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -272,12 +283,12 @@ void PFCfgParser::set_rule() { try { // for error handling match(SET); -#line 211 "pf.g" +#line 222 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); -#line 281 "PFCfgParser.cpp" +#line 292 "PFCfgParser.cpp" { switch ( LA(1)) { case TIMEOUT: @@ -368,7 +379,7 @@ void PFCfgParser::scrub_rule() { try { // for error handling match(SCRUB); -#line 510 "pf.g" +#line 521 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -376,7 +387,7 @@ void PFCfgParser::scrub_rule() { importer->action = "scrub"; *dbg << LT(1)->getLine() << ":" << " scrub "; -#line 380 "PFCfgParser.cpp" +#line 391 "PFCfgParser.cpp" rule_extended(); match(NEWLINE); } @@ -391,7 +402,7 @@ void PFCfgParser::match_rule() { try { // for error handling match(MATCH); -#line 525 "pf.g" +#line 536 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -399,13 +410,13 @@ void PFCfgParser::match_rule() { importer->action = "match"; *dbg << LT(1)->getLine() << ":" << " match "; -#line 403 "PFCfgParser.cpp" +#line 414 "PFCfgParser.cpp" rule_extended(); -#line 533 "pf.g" +#line 544 "pf.g" if ( ! importer->scrub_rule) importer->pushRule(); -#line 409 "PFCfgParser.cpp" +#line 420 "PFCfgParser.cpp" match(NEWLINE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -421,12 +432,12 @@ void PFCfgParser::table_rule() { try { // for error handling match(TABLE); -#line 542 "pf.g" +#line 553 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); -#line 430 "PFCfgParser.cpp" +#line 441 "PFCfgParser.cpp" match(LESS_THAN); name = LT(1); match(WORD); @@ -457,12 +468,12 @@ void PFCfgParser::table_rule() { case CONST_WORD: { match(CONST_WORD); -#line 554 "pf.g" +#line 565 "pf.g" importer->addMessageToLog( QString("Warning: attribute \"const\" will be dropped from table configuration since this attribute is not supported at this time")); -#line 466 "PFCfgParser.cpp" +#line 477 "PFCfgParser.cpp" break; } case NEWLINE: @@ -483,12 +494,12 @@ void PFCfgParser::table_rule() { case COUNTERS: { match(COUNTERS); -#line 561 "pf.g" +#line 572 "pf.g" importer->addMessageToLog( QString("Warning: attribute \"counters\" will be dropped from table configuration since this attribute is not supported at this time")); -#line 492 "PFCfgParser.cpp" +#line 503 "PFCfgParser.cpp" break; } case NEWLINE: @@ -510,12 +521,12 @@ void PFCfgParser::table_rule() { match(FILE); file = LT(1); match(STRING); -#line 568 "pf.g" +#line 579 "pf.g" importer->newAddressTableObject( name->getText(), file->getText()); -#line 519 "PFCfgParser.cpp" +#line 530 "PFCfgParser.cpp" break; } case OPENING_BRACE: @@ -557,24 +568,24 @@ void PFCfgParser::table_rule() { _loop58:; } // ( ... )* match(CLOSING_BRACE); -#line 580 "pf.g" +#line 591 "pf.g" importer->newAddressTableObject( name->getText(), importer->tmp_group); -#line 566 "PFCfgParser.cpp" +#line 577 "PFCfgParser.cpp" break; } case NEWLINE: { match(NEWLINE); -#line 586 "pf.g" +#line 597 "pf.g" // Special case: table definition without file name or list of addresses. // Create run-time AddressTable object with name but no file spec. importer->newAddressTableObject(name->getText(), ""); -#line 578 "PFCfgParser.cpp" +#line 589 "PFCfgParser.cpp" break; } default: @@ -595,7 +606,7 @@ void PFCfgParser::no_nat_rule() { try { // for error handling match(NO); -#line 661 "pf.g" +#line 672 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -603,7 +614,7 @@ void PFCfgParser::no_nat_rule() { importer->action = "nonat"; *dbg << LT(1)->getLine() << ":" << " nonat "; -#line 607 "PFCfgParser.cpp" +#line 618 "PFCfgParser.cpp" { switch ( LA(1)) { case NAT: @@ -634,7 +645,7 @@ void PFCfgParser::nat_rule() { try { // for error handling match(NAT); -#line 678 "pf.g" +#line 689 "pf.g" if ( importer->action != "nonat" ) { @@ -645,18 +656,18 @@ void PFCfgParser::nat_rule() { *dbg << LT(1)->getLine() << ":" << " nat "; } -#line 649 "PFCfgParser.cpp" +#line 660 "PFCfgParser.cpp" { switch ( LA(1)) { case PASS: { match(PASS); -#line 690 "pf.g" +#line 701 "pf.g" importer->error_tracker->registerError( QString("import of 'nat pass' commands is not supported.")); -#line 660 "PFCfgParser.cpp" +#line 671 "PFCfgParser.cpp" { switch ( LA(1)) { case LOG: @@ -811,12 +822,12 @@ void PFCfgParser::nat_rule() { case TAG: { tag_clause(); -#line 703 "pf.g" +#line 714 "pf.g" importer->error_tracker->registerError( QString("import of 'nat ... tag' commands is not supported.")); -#line 820 "PFCfgParser.cpp" +#line 831 "PFCfgParser.cpp" break; } case NEWLINE: @@ -856,21 +867,21 @@ void PFCfgParser::nat_rule() { } } } -#line 711 "pf.g" +#line 722 "pf.g" importer->nat_group = importer->tmp_group; -#line 864 "PFCfgParser.cpp" +#line 875 "PFCfgParser.cpp" { switch ( LA(1)) { case PORT: { portspec(); -#line 716 "pf.g" +#line 727 "pf.g" importer->nat_port_group = importer->tmp_port_group; -#line 874 "PFCfgParser.cpp" +#line 885 "PFCfgParser.cpp" break; } case NEWLINE: @@ -914,9 +925,9 @@ void PFCfgParser::nat_rule() { case STATIC_PORT: { match(STATIC_PORT); -#line 722 "pf.g" +#line 733 "pf.g" importer->nat_rule_opt_2 = "static-port"; -#line 920 "PFCfgParser.cpp" +#line 931 "PFCfgParser.cpp" break; } case NEWLINE: @@ -941,11 +952,11 @@ void PFCfgParser::nat_rule() { } } } -#line 725 "pf.g" +#line 736 "pf.g" importer->pushRule(); -#line 949 "PFCfgParser.cpp" +#line 960 "PFCfgParser.cpp" match(NEWLINE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -959,7 +970,7 @@ void PFCfgParser::rdr_rule() { try { // for error handling match(RDR); -#line 734 "pf.g" +#line 745 "pf.g" if ( importer->action != "nonat" ) { @@ -970,18 +981,18 @@ void PFCfgParser::rdr_rule() { *dbg << LT(1)->getLine() << ":" << " rdr "; } -#line 974 "PFCfgParser.cpp" +#line 985 "PFCfgParser.cpp" { switch ( LA(1)) { case PASS: { match(PASS); -#line 746 "pf.g" +#line 757 "pf.g" importer->error_tracker->registerError( QString("import of 'nat pass' commands is not supported.")); -#line 985 "PFCfgParser.cpp" +#line 996 "PFCfgParser.cpp" { switch ( LA(1)) { case LOG: @@ -1136,12 +1147,12 @@ void PFCfgParser::rdr_rule() { case TAG: { tag_clause(); -#line 759 "pf.g" +#line 770 "pf.g" importer->error_tracker->registerError( QString("import of 'nat ... tag' commands is not supported.")); -#line 1145 "PFCfgParser.cpp" +#line 1156 "PFCfgParser.cpp" break; } case NEWLINE: @@ -1181,21 +1192,21 @@ void PFCfgParser::rdr_rule() { } } } -#line 767 "pf.g" +#line 778 "pf.g" importer->nat_group = importer->tmp_group; -#line 1189 "PFCfgParser.cpp" +#line 1200 "PFCfgParser.cpp" { switch ( LA(1)) { case PORT: { portspec(); -#line 772 "pf.g" +#line 783 "pf.g" importer->nat_port_group = importer->tmp_port_group; -#line 1199 "PFCfgParser.cpp" +#line 1210 "PFCfgParser.cpp" break; } case NEWLINE: @@ -1244,11 +1255,11 @@ void PFCfgParser::rdr_rule() { } } } -#line 778 "pf.g" +#line 789 "pf.g" importer->pushRule(); -#line 1252 "PFCfgParser.cpp" +#line 1263 "PFCfgParser.cpp" match(NEWLINE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -1262,7 +1273,7 @@ void PFCfgParser::binat_rule() { try { // for error handling match(BINAT); -#line 910 "pf.g" +#line 921 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1270,7 +1281,7 @@ void PFCfgParser::binat_rule() { QString("import of 'binat' commands is not supported.")); consumeUntil(NEWLINE); -#line 1274 "PFCfgParser.cpp" +#line 1285 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1283,7 +1294,7 @@ void PFCfgParser::pass_rule() { try { // for error handling match(PASS); -#line 933 "pf.g" +#line 944 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1291,13 +1302,13 @@ void PFCfgParser::pass_rule() { importer->action = "pass"; *dbg << LT(1)->getLine() << ":" << " pass "; -#line 1295 "PFCfgParser.cpp" +#line 1306 "PFCfgParser.cpp" rule_extended(); -#line 941 "pf.g" +#line 952 "pf.g" importer->pushRule(); -#line 1301 "PFCfgParser.cpp" +#line 1312 "PFCfgParser.cpp" match(NEWLINE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -1311,7 +1322,7 @@ void PFCfgParser::block_rule() { try { // for error handling match(BLOCK); -#line 948 "pf.g" +#line 959 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1319,7 +1330,7 @@ void PFCfgParser::block_rule() { importer->action = "block"; *dbg << LT(1)->getLine() << ":" << " block "; -#line 1323 "PFCfgParser.cpp" +#line 1334 "PFCfgParser.cpp" { switch ( LA(1)) { case DROP: @@ -1352,12 +1363,13 @@ void PFCfgParser::block_rule() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -1377,11 +1389,11 @@ void PFCfgParser::block_rule() { } } rule_extended(); -#line 957 "pf.g" +#line 968 "pf.g" importer->pushRule(); -#line 1385 "PFCfgParser.cpp" +#line 1397 "PFCfgParser.cpp" match(NEWLINE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -1443,7 +1455,7 @@ void PFCfgParser::set_ruleset_optimization() { try { // for error handling match(14); -#line 254 "pf.g" +#line 265 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1451,7 +1463,7 @@ void PFCfgParser::set_ruleset_optimization() { QString("Error: import of 'set ruleset-optimization' commands is not supported.")); consumeUntil(NEWLINE); -#line 1455 "PFCfgParser.cpp" +#line 1467 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1497,9 +1509,9 @@ void PFCfgParser::set_optimization() { } } } -#line 276 "pf.g" +#line 287 "pf.g" importer->set_optimization = LT(0)->getText(); -#line 1503 "PFCfgParser.cpp" +#line 1515 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1546,7 +1558,7 @@ void PFCfgParser::set_loginterface() { try { // for error handling match(LITERAL_loginterface); -#line 287 "pf.g" +#line 298 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1554,7 +1566,7 @@ void PFCfgParser::set_loginterface() { QString("Error: import of 'set loginterface' commands is not supported.")); consumeUntil(NEWLINE); -#line 1558 "PFCfgParser.cpp" +#line 1570 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1585,9 +1597,9 @@ void PFCfgParser::set_block_policy() { } } } -#line 299 "pf.g" +#line 310 "pf.g" importer->set_block_policy = LT(0)->getText(); -#line 1591 "PFCfgParser.cpp" +#line 1603 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1618,9 +1630,9 @@ void PFCfgParser::set_state_policy() { } } } -#line 305 "pf.g" +#line 316 "pf.g" importer->set_state_policy = LT(0)->getText(); -#line 1624 "PFCfgParser.cpp" +#line 1636 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1633,7 +1645,7 @@ void PFCfgParser::set_state_defaults() { try { // for error handling match(29); -#line 311 "pf.g" +#line 322 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1641,7 +1653,7 @@ void PFCfgParser::set_state_defaults() { QString("Error: import of 'set state-defaults' commands is not supported.")); consumeUntil(NEWLINE); -#line 1645 "PFCfgParser.cpp" +#line 1657 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1654,7 +1666,7 @@ void PFCfgParser::set_require_order() { try { // for error handling match(30); -#line 323 "pf.g" +#line 334 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1662,7 +1674,7 @@ void PFCfgParser::set_require_order() { QString("Error: import of 'set require-order' commands is not supported.")); consumeUntil(NEWLINE); -#line 1666 "PFCfgParser.cpp" +#line 1678 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1675,7 +1687,7 @@ void PFCfgParser::set_fingerprints() { try { // for error handling match(LITERAL_fingerprints); -#line 335 "pf.g" +#line 346 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1683,7 +1695,7 @@ void PFCfgParser::set_fingerprints() { QString("Error: import of 'set fingerprints' commands is not supported.")); consumeUntil(NEWLINE); -#line 1687 "PFCfgParser.cpp" +#line 1699 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1711,11 +1723,11 @@ void PFCfgParser::set_debug() { try { // for error handling match(LITERAL_debug); match(WORD); -#line 371 "pf.g" +#line 382 "pf.g" importer->set_debug = LT(0)->getText(); -#line 1719 "PFCfgParser.cpp" +#line 1731 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1728,7 +1740,7 @@ void PFCfgParser::set_reassemble() { try { // for error handling match(LITERAL_reassemble); -#line 379 "pf.g" +#line 390 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1736,7 +1748,7 @@ void PFCfgParser::set_reassemble() { QString("Error: import of 'set reassemble' commands is not supported.")); consumeUntil(NEWLINE); -#line 1740 "PFCfgParser.cpp" +#line 1752 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1749,7 +1761,7 @@ void PFCfgParser::set_hostid() { try { // for error handling match(LITERAL_hostid); -#line 391 "pf.g" +#line 402 "pf.g" importer->clear(); importer->setCurrentLineNumber(LT(0)->getLine()); @@ -1757,7 +1769,7 @@ void PFCfgParser::set_hostid() { QString("Error: import of 'set hostid' commands is not supported.")); consumeUntil(NEWLINE); -#line 1761 "PFCfgParser.cpp" +#line 1773 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1767,9 +1779,9 @@ void PFCfgParser::set_hostid() { void PFCfgParser::timeout_def() { Tracer traceInOut(this, "timeout_def"); -#line 409 "pf.g" +#line 420 "pf.g" std::string timeout_name, timeout_value; -#line 1773 "PFCfgParser.cpp" +#line 1785 "PFCfgParser.cpp" try { // for error handling { @@ -1875,19 +1887,19 @@ void PFCfgParser::timeout_def() { } } } -#line 450 "pf.g" +#line 461 "pf.g" timeout_name = LT(0)->getText(); -#line 1883 "PFCfgParser.cpp" +#line 1895 "PFCfgParser.cpp" match(INT_CONST); -#line 454 "pf.g" +#line 465 "pf.g" timeout_value = LT(0)->getText(); importer->timeouts.push_back( std::pair(timeout_name, timeout_value)); -#line 1891 "PFCfgParser.cpp" +#line 1903 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -1958,9 +1970,9 @@ void PFCfgParser::timeout_def_list() { void PFCfgParser::limit_def() { Tracer traceInOut(this, "limit_def"); -#line 472 "pf.g" +#line 483 "pf.g" std::string limit_name, limit_value; -#line 1964 "PFCfgParser.cpp" +#line 1976 "PFCfgParser.cpp" try { // for error handling { @@ -1996,19 +2008,19 @@ void PFCfgParser::limit_def() { } } } -#line 485 "pf.g" +#line 496 "pf.g" limit_name = LT(0)->getText(); -#line 2004 "PFCfgParser.cpp" +#line 2016 "PFCfgParser.cpp" match(INT_CONST); -#line 489 "pf.g" +#line 500 "pf.g" limit_value = LT(0)->getText(); importer->limits.push_back( std::pair(limit_name, limit_value)); -#line 2012 "PFCfgParser.cpp" +#line 2024 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -2071,9 +2083,9 @@ void PFCfgParser::skip_def() { case WORD: { match(WORD); -#line 351 "pf.g" +#line 362 "pf.g" importer->set_skip_on.push_back(LT(0)->getText()); -#line 2077 "PFCfgParser.cpp" +#line 2089 "PFCfgParser.cpp" break; } case OPENING_BRACE: @@ -2099,9 +2111,9 @@ void PFCfgParser::skip_list() { try { // for error handling match(OPENING_BRACE); match(WORD); -#line 360 "pf.g" +#line 371 "pf.g" importer->set_skip_on.push_back(LT(0)->getText()); -#line 2105 "PFCfgParser.cpp" +#line 2117 "PFCfgParser.cpp" { // ( ... )* for (;;) { if ((LA(1) == WORD || LA(1) == COMMA)) { @@ -2118,9 +2130,9 @@ void PFCfgParser::skip_list() { _loop32:; } // ( ... )* match(WORD); -#line 363 "pf.g" +#line 374 "pf.g" importer->set_skip_on.push_back(LT(0)->getText()); -#line 2124 "PFCfgParser.cpp" +#line 2136 "PFCfgParser.cpp" } else { goto _loop33; @@ -2168,12 +2180,13 @@ void PFCfgParser::rule_extended() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2217,12 +2230,13 @@ void PFCfgParser::rule_extended() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2264,12 +2278,13 @@ void PFCfgParser::rule_extended() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2292,6 +2307,7 @@ void PFCfgParser::rule_extended() { switch ( LA(1)) { case ROUTE_TO: case REPLY_TO: + case DUP_TO: { route(); break; @@ -2312,10 +2328,10 @@ void PFCfgParser::rule_extended() { case FROM: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2356,10 +2372,10 @@ void PFCfgParser::rule_extended() { case FROM: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2398,10 +2414,10 @@ void PFCfgParser::rule_extended() { case FROM: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2442,10 +2458,10 @@ void PFCfgParser::rule_extended() { case USER: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2478,9 +2494,9 @@ void PFCfgParser::rule_extended() { void PFCfgParser::tableaddr_spec() { Tracer traceInOut(this, "tableaddr_spec"); -#line 594 "pf.g" +#line 605 "pf.g" AddressSpec as; -#line 2484 "PFCfgParser.cpp" +#line 2500 "PFCfgParser.cpp" try { // for error handling { @@ -2488,9 +2504,9 @@ void PFCfgParser::tableaddr_spec() { case EXLAMATION: { match(EXLAMATION); -#line 595 "pf.g" +#line 606 "pf.g" as.neg = true; -#line 2494 "PFCfgParser.cpp" +#line 2510 "PFCfgParser.cpp" break; } case WORD: @@ -2512,13 +2528,13 @@ void PFCfgParser::tableaddr_spec() { case WORD: { match(WORD); -#line 598 "pf.g" +#line 609 "pf.g" // interface name or domain/host name as.at = AddressSpec::INTERFACE_OR_HOST_NAME; as.address = LT(0)->getText(); -#line 2522 "PFCfgParser.cpp" +#line 2538 "PFCfgParser.cpp" { switch ( LA(1)) { case COLON: @@ -2529,43 +2545,43 @@ void PFCfgParser::tableaddr_spec() { case NETWORK: { match(NETWORK); -#line 607 "pf.g" +#line 618 "pf.g" as.at = AddressSpec::INTERFACE_NETWORK; -#line 2537 "PFCfgParser.cpp" +#line 2553 "PFCfgParser.cpp" break; } case BROADCAST: { match(BROADCAST); -#line 612 "pf.g" +#line 623 "pf.g" as.at = AddressSpec::INTERFACE_BROADCAST; -#line 2547 "PFCfgParser.cpp" +#line 2563 "PFCfgParser.cpp" break; } case PEER: { match(PEER); -#line 617 "pf.g" +#line 628 "pf.g" importer->error_tracker->registerError( QString("import of 'interface:peer' is not supported.")); -#line 2558 "PFCfgParser.cpp" +#line 2574 "PFCfgParser.cpp" break; } case INT_CONST: { match(INT_CONST); -#line 623 "pf.g" +#line 634 "pf.g" importer->error_tracker->registerError( QString("import of 'interface:0' is not supported.")); -#line 2569 "PFCfgParser.cpp" +#line 2585 "PFCfgParser.cpp" break; } default: @@ -2598,12 +2614,12 @@ void PFCfgParser::tableaddr_spec() { case SELF: { match(SELF); -#line 631 "pf.g" +#line 642 "pf.g" as.at = AddressSpec::SPECIAL_ADDRESS; as.address = "self"; -#line 2607 "PFCfgParser.cpp" +#line 2623 "PFCfgParser.cpp" break; } case INT_CONST: @@ -2633,22 +2649,22 @@ void PFCfgParser::tableaddr_spec() { } } } -#line 638 "pf.g" +#line 649 "pf.g" as.at = AddressSpec::HOST_ADDRESS; as.address = LT(0)->getText(); -#line 2642 "PFCfgParser.cpp" +#line 2658 "PFCfgParser.cpp" { switch ( LA(1)) { case SLASH: { match(SLASH); -#line 644 "pf.g" +#line 655 "pf.g" as.at = AddressSpec::NETWORK_ADDRESS; -#line 2652 "PFCfgParser.cpp" +#line 2668 "PFCfgParser.cpp" { switch ( LA(1)) { case IPV4: @@ -2667,11 +2683,11 @@ void PFCfgParser::tableaddr_spec() { } } } -#line 648 "pf.g" +#line 659 "pf.g" as.netmask = LT(0)->getText(); -#line 2675 "PFCfgParser.cpp" +#line 2691 "PFCfgParser.cpp" break; } case WORD: @@ -2699,11 +2715,11 @@ void PFCfgParser::tableaddr_spec() { } } } -#line 653 "pf.g" +#line 664 "pf.g" importer->tmp_group.push_back(as); -#line 2707 "PFCfgParser.cpp" +#line 2723 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -2744,9 +2760,9 @@ void PFCfgParser::logging() { } } } -#line 1032 "pf.g" +#line 1043 "pf.g" importer->logging = true; -#line 2750 "PFCfgParser.cpp" +#line 2766 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -2798,11 +2814,11 @@ void PFCfgParser::address_family() { case INET6: { match(INET6); -#line 1076 "pf.g" +#line 1087 "pf.g" importer->address_family = LT(0)->getText(); -#line 2806 "PFCfgParser.cpp" +#line 2822 "PFCfgParser.cpp" break; } default: @@ -2838,14 +2854,14 @@ void PFCfgParser::hosts() { case ALL: { match(ALL); -#line 1119 "pf.g" +#line 1130 "pf.g" importer->src_group.push_back( AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0")); importer->dst_group.push_back( AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0")); -#line 2849 "PFCfgParser.cpp" +#line 2865 "PFCfgParser.cpp" break; } case NEWLINE: @@ -2861,10 +2877,10 @@ void PFCfgParser::hosts() { case FROM: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2894,10 +2910,10 @@ void PFCfgParser::hosts() { case TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2934,10 +2950,10 @@ void PFCfgParser::hosts() { case USER: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -2979,9 +2995,9 @@ void PFCfgParser::tagged() { case EXLAMATION: { match(EXLAMATION); -#line 1671 "pf.g" +#line 1689 "pf.g" importer->tagged_neg = true; -#line 2985 "PFCfgParser.cpp" +#line 3001 "PFCfgParser.cpp" break; } case TAGGED: @@ -2996,11 +3012,11 @@ void PFCfgParser::tagged() { } match(TAGGED); match(WORD); -#line 1673 "pf.g" +#line 1691 "pf.g" importer->tagged = LT(0)->getText(); -#line 3004 "PFCfgParser.cpp" +#line 3020 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -3014,11 +3030,11 @@ void PFCfgParser::tag_clause() { try { // for error handling match(TAG); match(WORD); -#line 1680 "pf.g" +#line 1698 "pf.g" importer->tag = LT(0)->getText(); -#line 3022 "PFCfgParser.cpp" +#line 3038 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -3028,9 +3044,9 @@ void PFCfgParser::tag_clause() { void PFCfgParser::redirhost() { Tracer traceInOut(this, "redirhost"); -#line 789 "pf.g" +#line 800 "pf.g" AddressSpec as; -#line 3034 "PFCfgParser.cpp" +#line 3050 "PFCfgParser.cpp" try { // for error handling { @@ -3038,22 +3054,22 @@ void PFCfgParser::redirhost() { case IPV4: { match(IPV4); -#line 792 "pf.g" +#line 803 "pf.g" as.at = AddressSpec::HOST_ADDRESS; as.address = LT(0)->getText(); -#line 3047 "PFCfgParser.cpp" +#line 3063 "PFCfgParser.cpp" { switch ( LA(1)) { case SLASH: { match(SLASH); -#line 798 "pf.g" +#line 809 "pf.g" as.at = AddressSpec::NETWORK_ADDRESS; -#line 3057 "PFCfgParser.cpp" +#line 3073 "PFCfgParser.cpp" { switch ( LA(1)) { case IPV4: @@ -3072,11 +3088,11 @@ void PFCfgParser::redirhost() { } } } -#line 802 "pf.g" +#line 813 "pf.g" as.netmask = LT(0)->getText(); -#line 3080 "PFCfgParser.cpp" +#line 3096 "PFCfgParser.cpp" break; } case NEWLINE: @@ -3106,26 +3122,26 @@ void PFCfgParser::redirhost() { { match(OPENING_PAREN); match(WORD); -#line 809 "pf.g" +#line 820 "pf.g" // interface name or domain/host name as.at = AddressSpec::INTERFACE_OR_HOST_NAME; as.address = LT(0)->getText(); -#line 3116 "PFCfgParser.cpp" +#line 3132 "PFCfgParser.cpp" match(CLOSING_PAREN); break; } case WORD: { match(WORD); -#line 817 "pf.g" +#line 828 "pf.g" // interface name or domain/host name as.at = AddressSpec::INTERFACE_OR_HOST_NAME; as.address = LT(0)->getText(); -#line 3129 "PFCfgParser.cpp" +#line 3145 "PFCfgParser.cpp" break; } default: @@ -3134,11 +3150,11 @@ void PFCfgParser::redirhost() { } } } -#line 823 "pf.g" +#line 834 "pf.g" importer->tmp_group.push_back(as); -#line 3142 "PFCfgParser.cpp" +#line 3158 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -3193,9 +3209,9 @@ void PFCfgParser::redirhost_list() { void PFCfgParser::portspec() { Tracer traceInOut(this, "portspec"); -#line 848 "pf.g" +#line 859 "pf.g" PortSpec ps; -#line 3199 "PFCfgParser.cpp" +#line 3215 "PFCfgParser.cpp" try { // for error handling match(PORT); @@ -3205,31 +3221,31 @@ void PFCfgParser::portspec() { case INT_CONST: { port_def(); -#line 852 "pf.g" +#line 863 "pf.g" ps.port1 = importer->tmp_port_def; ps.port2 = ps.port1; ps.port_op = "="; -#line 3215 "PFCfgParser.cpp" +#line 3231 "PFCfgParser.cpp" break; } case IPV6: { match(IPV6); -#line 861 "pf.g" +#line 872 "pf.g" ps.setFromPortRange(LT(0)->getText()); -#line 3225 "PFCfgParser.cpp" +#line 3241 "PFCfgParser.cpp" { switch ( LA(1)) { case STAR: { match(STAR); -#line 865 "pf.g" +#line 876 "pf.g" ps.port2 = "65535"; -#line 3233 "PFCfgParser.cpp" +#line 3249 "PFCfgParser.cpp" break; } case NEWLINE: @@ -3255,11 +3271,11 @@ void PFCfgParser::portspec() { } } } -#line 868 "pf.g" +#line 879 "pf.g" importer->tmp_port_group.push_back(ps); -#line 3263 "PFCfgParser.cpp" +#line 3279 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -3276,49 +3292,49 @@ void PFCfgParser::pooltype() { case BITMASK: { match(BITMASK); -#line 882 "pf.g" +#line 893 "pf.g" importer->nat_rule_opt_1 = "bitmask"; -#line 3282 "PFCfgParser.cpp" +#line 3298 "PFCfgParser.cpp" break; } case RANDOM: { match(RANDOM); -#line 884 "pf.g" +#line 895 "pf.g" importer->nat_rule_opt_1 = "random"; -#line 3290 "PFCfgParser.cpp" +#line 3306 "PFCfgParser.cpp" break; } case SOURCE_HASH: { match(SOURCE_HASH); -#line 886 "pf.g" +#line 897 "pf.g" importer->nat_rule_opt_1 = "source-hash"; -#line 3298 "PFCfgParser.cpp" +#line 3314 "PFCfgParser.cpp" { switch ( LA(1)) { case HEX_KEY: { match(HEX_KEY); -#line 889 "pf.g" +#line 900 "pf.g" importer->error_tracker->registerError( QString("import of 'nat' commands with 'source-hash hex-key' " "option is not supported")); -#line 3310 "PFCfgParser.cpp" +#line 3326 "PFCfgParser.cpp" break; } case STRING_KEY: { match(STRING_KEY); -#line 896 "pf.g" +#line 907 "pf.g" importer->error_tracker->registerError( QString("import of 'nat' commands with 'source-hash string-key' " "option is not supported")); -#line 3322 "PFCfgParser.cpp" +#line 3338 "PFCfgParser.cpp" break; } case NEWLINE: @@ -3338,9 +3354,9 @@ void PFCfgParser::pooltype() { case ROUND_ROBIN: { match(ROUND_ROBIN); -#line 903 "pf.g" +#line 914 "pf.g" importer->nat_rule_opt_1 = "round-robin"; -#line 3344 "PFCfgParser.cpp" +#line 3360 "PFCfgParser.cpp" break; } default: @@ -3396,11 +3412,11 @@ void PFCfgParser::port_def() { } } } -#line 1808 "pf.g" +#line 1826 "pf.g" importer->tmp_port_def = LT(0)->getText(); -#line 3404 "PFCfgParser.cpp" +#line 3420 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -3417,37 +3433,37 @@ void PFCfgParser::block_return() { case DROP: { match(DROP); -#line 965 "pf.g" +#line 976 "pf.g" importer->block_action_params.push_back("drop"); -#line 3423 "PFCfgParser.cpp" +#line 3439 "PFCfgParser.cpp" break; } case RETURN: { match(RETURN); -#line 967 "pf.g" +#line 978 "pf.g" importer->block_action_params.push_back("return"); -#line 3431 "PFCfgParser.cpp" +#line 3447 "PFCfgParser.cpp" break; } case RETURN_RST: { match(RETURN_RST); -#line 969 "pf.g" +#line 980 "pf.g" importer->block_action_params.push_back("return-rst"); -#line 3439 "PFCfgParser.cpp" +#line 3455 "PFCfgParser.cpp" { switch ( LA(1)) { case TTL: { match(TTL); match(INT_CONST); -#line 972 "pf.g" +#line 983 "pf.g" importer->error_tracker->registerError( QString("Import of \"block return-rst ttl number\" is not supported. ")); -#line 3451 "PFCfgParser.cpp" +#line 3467 "PFCfgParser.cpp" break; } case NEWLINE: @@ -3471,12 +3487,13 @@ void PFCfgParser::block_return() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -3500,25 +3517,23 @@ void PFCfgParser::block_return() { case RETURN_ICMP: { match(RETURN_ICMP); -#line 978 "pf.g" +#line 989 "pf.g" importer->block_action_params.push_back("return-icmp"); -#line 3506 "PFCfgParser.cpp" +#line 3523 "PFCfgParser.cpp" { if ((LA(1) == OPENING_PAREN) && (_tokenSet_25.member(LA(2)))) { match(OPENING_PAREN); { switch ( LA(1)) { - case 175: - case 176: case 177: case 178: + case 179: + case 180: case LITERAL_needfrag: case LITERAL_srcfail: - case 181: - case 182: - case LITERAL_isolate: + case 183: case 184: - case 185: + case LITERAL_isolate: case 186: case 187: case 188: @@ -3530,14 +3545,16 @@ void PFCfgParser::block_return() { case 194: case 195: case 196: + case 197: + case 198: case LITERAL_transit: case LITERAL_reassemb: case LITERAL_badhead: case LITERAL_optmiss: case LITERAL_badlen: - case 202: - case 203: case 204: + case 205: + case 206: { icmp_code_by_name(); break; @@ -3553,9 +3570,9 @@ void PFCfgParser::block_return() { } } } -#line 982 "pf.g" +#line 993 "pf.g" importer->block_action_params.push_back(LT(0)->getText()); -#line 3559 "PFCfgParser.cpp" +#line 3576 "PFCfgParser.cpp" { switch ( LA(1)) { case COMMA: @@ -3563,17 +3580,15 @@ void PFCfgParser::block_return() { match(COMMA); { switch ( LA(1)) { - case 175: - case 176: case 177: case 178: + case 179: + case 180: case LITERAL_needfrag: case LITERAL_srcfail: - case 181: - case 182: - case LITERAL_isolate: + case 183: case 184: - case 185: + case LITERAL_isolate: case 186: case 187: case 188: @@ -3585,14 +3600,16 @@ void PFCfgParser::block_return() { case 194: case 195: case 196: + case 197: + case 198: case LITERAL_transit: case LITERAL_reassemb: case LITERAL_badhead: case LITERAL_optmiss: case LITERAL_badlen: - case 202: - case 203: case 204: + case 205: + case 206: { icmp_code_by_name(); break; @@ -3608,12 +3625,12 @@ void PFCfgParser::block_return() { } } } -#line 986 "pf.g" +#line 997 "pf.g" importer->error_tracker->registerError( QString("Import of \"block return-icmp (icmp_code, icmp6_code)\" is not supported")); -#line 3617 "PFCfgParser.cpp" +#line 3634 "PFCfgParser.cpp" break; } case CLOSING_PAREN: @@ -3640,13 +3657,13 @@ void PFCfgParser::block_return() { case RETURN_ICMP6: { match(RETURN_ICMP6); -#line 995 "pf.g" +#line 1006 "pf.g" importer->error_tracker->registerError( QString("Import of \"block return-icmp6\" is not supported")); importer->block_action_params.push_back("return-icmp"); -#line 3650 "PFCfgParser.cpp" +#line 3667 "PFCfgParser.cpp" break; } default: @@ -3668,16 +3685,6 @@ void PFCfgParser::icmp_code_by_name() { try { // for error handling { switch ( LA(1)) { - case 175: - { - match(175); - break; - } - case 176: - { - match(176); - break; - } case 177: { match(177); @@ -3688,6 +3695,16 @@ void PFCfgParser::icmp_code_by_name() { match(178); break; } + case 179: + { + match(179); + break; + } + case 180: + { + match(180); + break; + } case LITERAL_needfrag: { match(LITERAL_needfrag); @@ -3698,19 +3715,9 @@ void PFCfgParser::icmp_code_by_name() { match(LITERAL_srcfail); break; } - case 181: + case 183: { - match(181); - break; - } - case 182: - { - match(182); - break; - } - case LITERAL_isolate: - { - match(LITERAL_isolate); + match(183); break; } case 184: @@ -3718,9 +3725,9 @@ void PFCfgParser::icmp_code_by_name() { match(184); break; } - case 185: + case LITERAL_isolate: { - match(185); + match(LITERAL_isolate); break; } case 186: @@ -3778,6 +3785,16 @@ void PFCfgParser::icmp_code_by_name() { match(196); break; } + case 197: + { + match(197); + break; + } + case 198: + { + match(198); + break; + } case LITERAL_transit: { match(LITERAL_transit); @@ -3803,21 +3820,21 @@ void PFCfgParser::icmp_code_by_name() { match(LITERAL_badlen); break; } - case 202: - { - match(202); - break; - } - case 203: - { - match(203); - break; - } case 204: { match(204); break; } + case 205: + { + match(205); + break; + } + case 206: + { + match(206); + break; + } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); @@ -3853,11 +3870,11 @@ void PFCfgParser::direction() { } } } -#line 1015 "pf.g" +#line 1026 "pf.g" importer->direction = LT(0)->getText(); -#line 3861 "PFCfgParser.cpp" +#line 3878 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -3885,17 +3902,17 @@ void PFCfgParser::quick_or_log() { } } -#line 1023 "pf.g" +#line 1034 "pf.g" importer->logging = true; -#line 3891 "PFCfgParser.cpp" +#line 3908 "PFCfgParser.cpp" { switch ( LA(1)) { case QUICK: { match(QUICK); -#line 1024 "pf.g" +#line 1035 "pf.g" importer->quick = true; -#line 3899 "PFCfgParser.cpp" +#line 3916 "PFCfgParser.cpp" break; } case NEWLINE: @@ -3915,12 +3932,13 @@ void PFCfgParser::quick_or_log() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -3944,9 +3962,9 @@ void PFCfgParser::quick_or_log() { case QUICK: { match(QUICK); -#line 1026 "pf.g" +#line 1037 "pf.g" importer->quick = true; -#line 3950 "PFCfgParser.cpp" +#line 3968 "PFCfgParser.cpp" { switch ( LA(1)) { case LOG: @@ -3963,9 +3981,9 @@ void PFCfgParser::quick_or_log() { } } -#line 1027 "pf.g" +#line 1038 "pf.g" importer->logging = true; -#line 3969 "PFCfgParser.cpp" +#line 3987 "PFCfgParser.cpp" break; } case NEWLINE: @@ -3985,12 +4003,13 @@ void PFCfgParser::quick_or_log() { case FROM: case ROUTE_TO: case REPLY_TO: + case DUP_TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -4039,6 +4058,11 @@ void PFCfgParser::route() { reply_to(); break; } + case DUP_TO: + { + dup_to(); + break; + } default: { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); @@ -4075,10 +4099,10 @@ void PFCfgParser::filteropts() { case USER: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -4100,11 +4124,11 @@ void PFCfgParser::filteropts() { filteropt(); } else { - goto _loop200; + goto _loop203; } } - _loop200:; + _loop203:; } // ( ... )* } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -4123,9 +4147,9 @@ void PFCfgParser::logopts() { for (;;) { if ((LA(1) == COMMA)) { match(COMMA); -#line 1039 "pf.g" +#line 1050 "pf.g" importer->logopts += ","; -#line 4129 "PFCfgParser.cpp" +#line 4153 "PFCfgParser.cpp" logopt(); } else { @@ -4162,11 +4186,11 @@ void PFCfgParser::logopt() { { match(TO); match(WORD); -#line 1046 "pf.g" +#line 1057 "pf.g" importer->logopts += LT(0)->getText(); -#line 4170 "PFCfgParser.cpp" +#line 4194 "PFCfgParser.cpp" break; } default: @@ -4183,9 +4207,9 @@ void PFCfgParser::logopt() { void PFCfgParser::ifspec() { Tracer traceInOut(this, "ifspec"); -#line 1054 "pf.g" +#line 1065 "pf.g" InterfaceSpec is; -#line 4189 "PFCfgParser.cpp" +#line 4213 "PFCfgParser.cpp" try { // for error handling { @@ -4193,9 +4217,9 @@ void PFCfgParser::ifspec() { case EXLAMATION: { match(EXLAMATION); -#line 1055 "pf.g" +#line 1066 "pf.g" is.neg = true; -#line 4199 "PFCfgParser.cpp" +#line 4223 "PFCfgParser.cpp" break; } case WORD: @@ -4209,13 +4233,13 @@ void PFCfgParser::ifspec() { } } match(WORD); -#line 1057 "pf.g" +#line 1068 "pf.g" is.name = LT(0)->getText(); importer->iface_group.push_back(is); importer->newInterface(is.name); -#line 4219 "PFCfgParser.cpp" +#line 4243 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4408,11 +4432,11 @@ void PFCfgParser::proto_name() { } } } -#line 1096 "pf.g" +#line 1107 "pf.g" importer->proto_list.push_back(LT(0)->getText()); -#line 4416 "PFCfgParser.cpp" +#line 4440 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4425,11 +4449,11 @@ void PFCfgParser::proto_number() { try { // for error handling match(INT_CONST); -#line 1102 "pf.g" +#line 1113 "pf.g" importer->proto_list.push_back(LT(0)->getText()); -#line 4433 "PFCfgParser.cpp" +#line 4457 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4522,10 +4546,10 @@ void PFCfgParser::hosts_from() { case TO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -4575,10 +4599,10 @@ void PFCfgParser::hosts_to() { case USER: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -4620,6 +4644,7 @@ void PFCfgParser::src_hosts_part() { case IPV6: case ANY: case NO_ROUTE: + case MACRO: { common_hosts_part(); break; @@ -4627,13 +4652,13 @@ void PFCfgParser::src_hosts_part() { case URPF_FAILED: { match(URPF_FAILED); -#line 1142 "pf.g" +#line 1153 "pf.g" importer->tmp_group.push_back( AddressSpec(AddressSpec::SPECIAL_ADDRESS, false, "urpf-failed", "")); -#line 4637 "PFCfgParser.cpp" +#line 4662 "PFCfgParser.cpp" break; } default: @@ -4642,13 +4667,13 @@ void PFCfgParser::src_hosts_part() { } } } -#line 1148 "pf.g" +#line 1159 "pf.g" importer->src_neg = importer->tmp_neg; importer->src_group.splice(importer->src_group.begin(), importer->tmp_group); -#line 4652 "PFCfgParser.cpp" +#line 4677 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4685,12 +4710,12 @@ void PFCfgParser::src_port_part() { } } } -#line 1729 "pf.g" +#line 1747 "pf.g" importer->src_port_group.splice(importer->src_port_group.begin(), importer->tmp_port_group); -#line 4694 "PFCfgParser.cpp" +#line 4719 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4703,13 +4728,13 @@ void PFCfgParser::dst_hosts_part() { try { // for error handling common_hosts_part(); -#line 1157 "pf.g" +#line 1168 "pf.g" importer->dst_neg = importer->tmp_neg; importer->dst_group.splice(importer->dst_group.begin(), importer->tmp_group); -#line 4713 "PFCfgParser.cpp" +#line 4738 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4746,12 +4771,12 @@ void PFCfgParser::dst_port_part() { } } } -#line 1742 "pf.g" +#line 1760 "pf.g" importer->dst_port_group.splice(importer->dst_port_group.begin(), importer->tmp_port_group); -#line 4755 "PFCfgParser.cpp" +#line 4780 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -4767,23 +4792,23 @@ void PFCfgParser::common_hosts_part() { case ANY: { match(ANY); -#line 1166 "pf.g" +#line 1177 "pf.g" importer->tmp_group.push_back( AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0")); -#line 4776 "PFCfgParser.cpp" +#line 4801 "PFCfgParser.cpp" break; } case NO_ROUTE: { match(NO_ROUTE); -#line 1172 "pf.g" +#line 1183 "pf.g" importer->tmp_group.push_back( AddressSpec(AddressSpec::SPECIAL_ADDRESS, false, "no-route", "")); -#line 4787 "PFCfgParser.cpp" +#line 4812 "PFCfgParser.cpp" break; } case WORD: @@ -4793,6 +4818,7 @@ void PFCfgParser::common_hosts_part() { case IPV4: case OPENING_PAREN: case IPV6: + case MACRO: { host(); break; @@ -4818,9 +4844,9 @@ void PFCfgParser::host() { Tracer traceInOut(this, "host"); ANTLR_USE_NAMESPACE(antlr)RefToken tn = ANTLR_USE_NAMESPACE(antlr)nullToken; ANTLR_USE_NAMESPACE(antlr)RefToken in = ANTLR_USE_NAMESPACE(antlr)nullToken; -#line 1182 "pf.g" +#line 1193 "pf.g" AddressSpec as; -#line 4824 "PFCfgParser.cpp" +#line 4850 "PFCfgParser.cpp" try { // for error handling { @@ -4828,9 +4854,9 @@ void PFCfgParser::host() { case EXLAMATION: { match(EXLAMATION); -#line 1183 "pf.g" +#line 1194 "pf.g" as.neg = true; -#line 4834 "PFCfgParser.cpp" +#line 4860 "PFCfgParser.cpp" break; } case WORD: @@ -4839,6 +4865,7 @@ void PFCfgParser::host() { case IPV4: case OPENING_PAREN: case IPV6: + case MACRO: { break; } @@ -4851,15 +4878,33 @@ void PFCfgParser::host() { { switch ( LA(1)) { case WORD: + case MACRO: { - match(WORD); -#line 1186 "pf.g" + { + switch ( LA(1)) { + case WORD: + { + match(WORD); + break; + } + case MACRO: + { + match(MACRO); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } +#line 1197 "pf.g" // interface name or domain/host name as.at = AddressSpec::INTERFACE_OR_HOST_NAME; as.address = LT(0)->getText(); -#line 4863 "PFCfgParser.cpp" +#line 4908 "PFCfgParser.cpp" { switch ( LA(1)) { case COLON: @@ -4870,43 +4915,43 @@ void PFCfgParser::host() { case NETWORK: { match(NETWORK); -#line 1195 "pf.g" +#line 1206 "pf.g" as.at = AddressSpec::INTERFACE_NETWORK; -#line 4878 "PFCfgParser.cpp" +#line 4923 "PFCfgParser.cpp" break; } case BROADCAST: { match(BROADCAST); -#line 1200 "pf.g" +#line 1211 "pf.g" as.at = AddressSpec::INTERFACE_BROADCAST; -#line 4888 "PFCfgParser.cpp" +#line 4933 "PFCfgParser.cpp" break; } case PEER: { match(PEER); -#line 1205 "pf.g" +#line 1216 "pf.g" importer->error_tracker->registerError( QString("import of 'interface:peer' is not supported.")); -#line 4899 "PFCfgParser.cpp" +#line 4944 "PFCfgParser.cpp" break; } case INT_CONST: { match(INT_CONST); -#line 1211 "pf.g" +#line 1222 "pf.g" importer->error_tracker->registerError( QString("import of 'interface:0' is not supported.")); -#line 4910 "PFCfgParser.cpp" +#line 4955 "PFCfgParser.cpp" break; } default: @@ -4935,12 +4980,13 @@ void PFCfgParser::host() { case IPV6: case USER: case TO: + case MACRO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -4964,45 +5010,45 @@ void PFCfgParser::host() { case SELF: { match(SELF); -#line 1219 "pf.g" +#line 1230 "pf.g" as.at = AddressSpec::SPECIAL_ADDRESS; as.address = "self"; -#line 4973 "PFCfgParser.cpp" +#line 5019 "PFCfgParser.cpp" break; } case IPV6: { match(IPV6); -#line 1225 "pf.g" +#line 1236 "pf.g" importer->error_tracker->registerError( QString("IPv6 import is not supported. ")); consumeUntil(NEWLINE); -#line 4985 "PFCfgParser.cpp" +#line 5031 "PFCfgParser.cpp" break; } case IPV4: { match(IPV4); -#line 1232 "pf.g" +#line 1243 "pf.g" as.at = AddressSpec::HOST_ADDRESS; as.address = LT(0)->getText(); -#line 4996 "PFCfgParser.cpp" +#line 5042 "PFCfgParser.cpp" { switch ( LA(1)) { case SLASH: { match(SLASH); -#line 1238 "pf.g" +#line 1249 "pf.g" as.at = AddressSpec::NETWORK_ADDRESS; -#line 5006 "PFCfgParser.cpp" +#line 5052 "PFCfgParser.cpp" { switch ( LA(1)) { case IPV4: @@ -5021,11 +5067,11 @@ void PFCfgParser::host() { } } } -#line 1242 "pf.g" +#line 1253 "pf.g" as.netmask = LT(0)->getText(); -#line 5029 "PFCfgParser.cpp" +#line 5075 "PFCfgParser.cpp" break; } case NEWLINE: @@ -5046,12 +5092,13 @@ void PFCfgParser::host() { case IPV6: case USER: case TO: + case MACRO: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -5078,12 +5125,12 @@ void PFCfgParser::host() { tn = LT(1); match(WORD); match(GREATER_THAN); -#line 1248 "pf.g" +#line 1259 "pf.g" as.at = AddressSpec::TABLE; as.address = tn->getText(); -#line 5087 "PFCfgParser.cpp" +#line 5134 "PFCfgParser.cpp" break; } case OPENING_PAREN: @@ -5092,13 +5139,13 @@ void PFCfgParser::host() { in = LT(1); match(WORD); match(CLOSING_PAREN); -#line 1254 "pf.g" +#line 1265 "pf.g" // interface name or domain/host name as.at = AddressSpec::INTERFACE_OR_HOST_NAME; as.address = in->getText(); -#line 5102 "PFCfgParser.cpp" +#line 5149 "PFCfgParser.cpp" break; } default: @@ -5107,11 +5154,11 @@ void PFCfgParser::host() { } } } -#line 1260 "pf.g" +#line 1271 "pf.g" importer->tmp_group.push_back(as); -#line 5115 "PFCfgParser.cpp" +#line 5162 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -5142,6 +5189,7 @@ void PFCfgParser::host_list() { case IPV4: case OPENING_PAREN: case IPV6: + case MACRO: { break; } @@ -5154,11 +5202,11 @@ void PFCfgParser::host_list() { host(); } else { - goto _loop183; + goto _loop184; } } - _loop183:; + _loop184:; } // ( ... )* match(CLOSING_BRACE); } @@ -5191,11 +5239,11 @@ void PFCfgParser::route_to() { } } } -#line 1282 "pf.g" +#line 1293 "pf.g" importer->route_type = PFImporter::ROUTE_TO; -#line 5199 "PFCfgParser.cpp" +#line 5247 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -5226,11 +5274,46 @@ void PFCfgParser::reply_to() { } } } -#line 1289 "pf.g" +#line 1300 "pf.g" importer->route_type = PFImporter::REPLY_TO; -#line 5234 "PFCfgParser.cpp" +#line 5282 "PFCfgParser.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + recover(ex,_tokenSet_34); + } +} + +void PFCfgParser::dup_to() { + Tracer traceInOut(this, "dup_to"); + + try { // for error handling + match(DUP_TO); + { + switch ( LA(1)) { + case OPENING_PAREN: + { + routehost(); + break; + } + case OPENING_BRACE: + { + routehost_list(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } +#line 1307 "pf.g" + + importer->route_type = PFImporter::DUP_TO; + +#line 5317 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -5244,16 +5327,16 @@ void PFCfgParser::routehost() { ANTLR_USE_NAMESPACE(antlr)RefToken v6 = ANTLR_USE_NAMESPACE(antlr)nullToken; ANTLR_USE_NAMESPACE(antlr)RefToken nm = ANTLR_USE_NAMESPACE(antlr)nullToken; ANTLR_USE_NAMESPACE(antlr)RefToken nm6 = ANTLR_USE_NAMESPACE(antlr)nullToken; -#line 1294 "pf.g" +#line 1312 "pf.g" RouteSpec rs; -#line 5250 "PFCfgParser.cpp" +#line 5333 "PFCfgParser.cpp" try { // for error handling match(OPENING_PAREN); match(WORD); -#line 1296 "pf.g" +#line 1314 "pf.g" rs.iface = LT(0)->getText(); -#line 5257 "PFCfgParser.cpp" +#line 5340 "PFCfgParser.cpp" { switch ( LA(1)) { case IPV4: @@ -5311,7 +5394,7 @@ void PFCfgParser::routehost() { } } } -#line 1298 "pf.g" +#line 1316 "pf.g" if (v6) { @@ -5325,7 +5408,7 @@ void PFCfgParser::routehost() { importer->route_group.push_back(rs); } -#line 5329 "PFCfgParser.cpp" +#line 5412 "PFCfgParser.cpp" match(CLOSING_PAREN); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -5363,11 +5446,11 @@ void PFCfgParser::routehost_list() { routehost(); } else { - goto _loop196; + goto _loop199; } } - _loop196:; + _loop199:; } // ( ... )* match(CLOSING_BRACE); } @@ -5444,10 +5527,10 @@ void PFCfgParser::filteropt() { case LITERAL_reassemble: case OPENING_PAREN: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: { scrub_options(); break; @@ -5492,12 +5575,12 @@ void PFCfgParser::user_match() { } } } -#line 1363 "pf.g" +#line 1381 "pf.g" importer->addMessageToLog( QString("Error: import of 'user' match is not supported.")); -#line 5501 "PFCfgParser.cpp" +#line 5584 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -5533,12 +5616,12 @@ void PFCfgParser::group_match() { } } } -#line 1372 "pf.g" +#line 1390 "pf.g" importer->addMessageToLog( QString("Error: import of 'group' match is not supported.")); -#line 5542 "PFCfgParser.cpp" +#line 5625 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -5558,12 +5641,12 @@ void PFCfgParser::tcp_flags() { case ANY: { match(ANY); -#line 1482 "pf.g" +#line 1500 "pf.g" importer->flags_check = "none"; importer->flags_mask = "none"; -#line 5567 "PFCfgParser.cpp" +#line 5650 "PFCfgParser.cpp" break; } case WORD: @@ -5607,10 +5690,10 @@ void PFCfgParser::tcp_flags() { case USER: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case ICMP6_TYPE: @@ -5629,7 +5712,7 @@ void PFCfgParser::tcp_flags() { } } } -#line 1488 "pf.g" +#line 1506 "pf.g" if (check) importer->flags_check = check->getText(); @@ -5640,7 +5723,7 @@ void PFCfgParser::tcp_flags() { else importer->flags_mask = "all"; -#line 5644 "PFCfgParser.cpp" +#line 5727 "PFCfgParser.cpp" break; } default: @@ -5684,8 +5767,8 @@ void PFCfgParser::icmp_type() { case LITERAL_trace: case LITERAL_dataconv: case LITERAL_mobredir: - case 170: - case 171: + case 172: + case 173: case LITERAL_mobregreq: case LITERAL_mobregrep: case LITERAL_photuris: @@ -5716,13 +5799,13 @@ void PFCfgParser::icmp6_type() { try { // for error handling match(ICMP6_TYPE); -#line 1663 "pf.g" +#line 1681 "pf.g" importer->error_tracker->registerError( QString("ICMP6 import is not supported. ")); consumeUntil(NEWLINE); -#line 5726 "PFCfgParser.cpp" +#line 5809 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -5762,11 +5845,11 @@ void PFCfgParser::state() { } } } -#line 1695 "pf.g" +#line 1713 "pf.g" importer->state_op = LT(0)->getText(); -#line 5770 "PFCfgParser.cpp" +#line 5853 "PFCfgParser.cpp" match(STATE); } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { @@ -5785,36 +5868,36 @@ void PFCfgParser::queue() { case WORD: { match(WORD); -#line 1704 "pf.g" +#line 1722 "pf.g" importer->queue += LT(0)->getText(); -#line 5791 "PFCfgParser.cpp" +#line 5874 "PFCfgParser.cpp" break; } case OPENING_PAREN: { match(OPENING_PAREN); match(WORD); -#line 1707 "pf.g" +#line 1725 "pf.g" importer->queue += LT(0)->getText(); -#line 5800 "PFCfgParser.cpp" +#line 5883 "PFCfgParser.cpp" { // ( ... )* for (;;) { if ((LA(1) == COMMA)) { match(COMMA); -#line 1709 "pf.g" +#line 1727 "pf.g" importer->queue += ","; -#line 5807 "PFCfgParser.cpp" +#line 5890 "PFCfgParser.cpp" match(WORD); -#line 1710 "pf.g" +#line 1728 "pf.g" importer->queue += LT(0)->getText(); -#line 5811 "PFCfgParser.cpp" +#line 5894 "PFCfgParser.cpp" } else { - goto _loop253; + goto _loop256; } } - _loop253:; + _loop256:; } // ( ... )* match(CLOSING_PAREN); break; @@ -5866,10 +5949,10 @@ void PFCfgParser::scrub_options() { switch ( LA(1)) { case LITERAL_reassemble: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: { scrub_option(); break; @@ -6023,11 +6106,11 @@ void PFCfgParser::user_group_op_list() { user_group_op(); } else { - goto _loop215; + goto _loop218; } } - _loop215:; + _loop218:; } // ( ... )* match(CLOSING_BRACE); } @@ -6046,46 +6129,46 @@ void PFCfgParser::unary_op() { case EQUAL: { match(EQUAL); -#line 1750 "pf.g" +#line 1768 "pf.g" importer->tmp_port_op = "="; -#line 6052 "PFCfgParser.cpp" +#line 6135 "PFCfgParser.cpp" break; } case EXLAMATION: { match(EXLAMATION); match(EQUAL); -#line 1752 "pf.g" +#line 1770 "pf.g" importer->tmp_port_op = "!="; -#line 6061 "PFCfgParser.cpp" +#line 6144 "PFCfgParser.cpp" break; } default: if ((LA(1) == LESS_THAN) && (LA(2) == WORD || LA(2) == INT_CONST)) { match(LESS_THAN); -#line 1754 "pf.g" +#line 1772 "pf.g" importer->tmp_port_op = "<"; -#line 6069 "PFCfgParser.cpp" +#line 6152 "PFCfgParser.cpp" } else if ((LA(1) == LESS_THAN) && (LA(2) == EQUAL)) { match(LESS_THAN); match(EQUAL); -#line 1756 "pf.g" +#line 1774 "pf.g" importer->tmp_port_op = "<="; -#line 6076 "PFCfgParser.cpp" +#line 6159 "PFCfgParser.cpp" } else if ((LA(1) == GREATER_THAN) && (LA(2) == WORD || LA(2) == INT_CONST)) { match(GREATER_THAN); -#line 1758 "pf.g" +#line 1776 "pf.g" importer->tmp_port_op = ">"; -#line 6082 "PFCfgParser.cpp" +#line 6165 "PFCfgParser.cpp" } else if ((LA(1) == GREATER_THAN) && (LA(2) == EQUAL)) { match(GREATER_THAN); match(EQUAL); -#line 1760 "pf.g" +#line 1778 "pf.g" importer->tmp_port_op = ">="; -#line 6089 "PFCfgParser.cpp" +#line 6172 "PFCfgParser.cpp" } else { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); @@ -6109,26 +6192,26 @@ void PFCfgParser::binary_op() { { match(LESS_THAN); match(GREATER_THAN); -#line 1766 "pf.g" +#line 1784 "pf.g" importer->tmp_port_op = "<>"; -#line 6115 "PFCfgParser.cpp" +#line 6198 "PFCfgParser.cpp" break; } case GREATER_THAN: { match(GREATER_THAN); match(LESS_THAN); -#line 1768 "pf.g" +#line 1786 "pf.g" importer->tmp_port_op = "><"; -#line 6124 "PFCfgParser.cpp" +#line 6207 "PFCfgParser.cpp" break; } case COLON: { match(COLON); -#line 1770 "pf.g" +#line 1788 "pf.g" importer->tmp_port_op = ":"; -#line 6132 "PFCfgParser.cpp" +#line 6215 "PFCfgParser.cpp" break; } default: @@ -6165,9 +6248,9 @@ void PFCfgParser::scrub_option() { match(LITERAL_crop); break; } - case 143: + case 145: { - match(143); + match(145); break; } default: @@ -6176,76 +6259,76 @@ void PFCfgParser::scrub_option() { } } } -#line 1434 "pf.g" +#line 1452 "pf.g" importer->scrub_options.push_back( str_tuple("fragment", LT(0)->getText())); importer->scrub_rule = true; -#line 6186 "PFCfgParser.cpp" +#line 6269 "PFCfgParser.cpp" break; } case LITERAL_reassemble: { match(LITERAL_reassemble); match(TCP); -#line 1441 "pf.g" +#line 1459 "pf.g" importer->scrub_options.push_back( str_tuple("reassemble", "tcp")); importer->scrub_rule = true; -#line 6199 "PFCfgParser.cpp" - break; - } - case 144: - { - match(144); -#line 1448 "pf.g" - - importer->scrub_options.push_back( - str_tuple(LT(0)->getText(), "")); - importer->scrub_rule = true; - -#line 6211 "PFCfgParser.cpp" - break; - } - case 145: - { - match(145); - match(INT_CONST); -#line 1455 "pf.g" - - importer->scrub_options.push_back( - str_tuple("min-ttl", LT(0)->getText())); - importer->scrub_rule = true; - -#line 6224 "PFCfgParser.cpp" +#line 6282 "PFCfgParser.cpp" break; } case 146: { match(146); - match(INT_CONST); -#line 1462 "pf.g" - - importer->scrub_options.push_back( - str_tuple("max-mss", LT(0)->getText())); - importer->scrub_rule = true; - -#line 6237 "PFCfgParser.cpp" - break; - } - case 147: - { - match(147); -#line 1469 "pf.g" +#line 1466 "pf.g" importer->scrub_options.push_back( str_tuple(LT(0)->getText(), "")); importer->scrub_rule = true; -#line 6249 "PFCfgParser.cpp" +#line 6294 "PFCfgParser.cpp" + break; + } + case 147: + { + match(147); + match(INT_CONST); +#line 1473 "pf.g" + + importer->scrub_options.push_back( + str_tuple("min-ttl", LT(0)->getText())); + importer->scrub_rule = true; + +#line 6307 "PFCfgParser.cpp" + break; + } + case 148: + { + match(148); + match(INT_CONST); +#line 1480 "pf.g" + + importer->scrub_options.push_back( + str_tuple("max-mss", LT(0)->getText())); + importer->scrub_rule = true; + +#line 6320 "PFCfgParser.cpp" + break; + } + case 149: + { + match(149); +#line 1487 "pf.g" + + importer->scrub_options.push_back( + str_tuple(LT(0)->getText(), "")); + importer->scrub_rule = true; + +#line 6332 "PFCfgParser.cpp" break; } default: @@ -6279,10 +6362,10 @@ void PFCfgParser::scrub_option_list() { } case LITERAL_reassemble: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: { break; } @@ -6295,11 +6378,11 @@ void PFCfgParser::scrub_option_list() { scrub_option(); } else { - goto _loop222; + goto _loop225; } } - _loop222:; + _loop225:; } // ( ... )* match(CLOSING_PAREN); } @@ -6311,9 +6394,9 @@ void PFCfgParser::scrub_option_list() { void PFCfgParser::icmp_type_code() { Tracer traceInOut(this, "icmp_type_code"); -#line 1510 "pf.g" +#line 1528 "pf.g" IcmpSpec is; -#line 6317 "PFCfgParser.cpp" +#line 6400 "PFCfgParser.cpp" try { // for error handling { @@ -6338,24 +6421,24 @@ void PFCfgParser::icmp_type_code() { case LITERAL_trace: case LITERAL_dataconv: case LITERAL_mobredir: - case 170: - case 171: + case 172: + case 173: case LITERAL_mobregreq: case LITERAL_mobregrep: case LITERAL_photuris: { icmp_type_by_name(); -#line 1512 "pf.g" +#line 1530 "pf.g" is.icmp_type_name = LT(0)->getText(); -#line 6351 "PFCfgParser.cpp" +#line 6434 "PFCfgParser.cpp" break; } case INT_CONST: { match(INT_CONST); -#line 1514 "pf.g" +#line 1532 "pf.g" is.icmp_type_int = LT(0)->getText(); -#line 6359 "PFCfgParser.cpp" +#line 6442 "PFCfgParser.cpp" break; } default: @@ -6371,17 +6454,15 @@ void PFCfgParser::icmp_type_code() { match(ICMP_CODE); { switch ( LA(1)) { - case 175: - case 176: case 177: case 178: + case 179: + case 180: case LITERAL_needfrag: case LITERAL_srcfail: - case 181: - case 182: - case LITERAL_isolate: + case 183: case 184: - case 185: + case LITERAL_isolate: case 186: case 187: case 188: @@ -6393,27 +6474,29 @@ void PFCfgParser::icmp_type_code() { case 194: case 195: case 196: + case 197: + case 198: case LITERAL_transit: case LITERAL_reassemb: case LITERAL_badhead: case LITERAL_optmiss: case LITERAL_badlen: - case 202: - case 203: case 204: + case 205: + case 206: { icmp_code_by_name(); -#line 1520 "pf.g" +#line 1538 "pf.g" is.icmp_code_name = LT(0)->getText(); -#line 6409 "PFCfgParser.cpp" +#line 6492 "PFCfgParser.cpp" break; } case INT_CONST: { match(INT_CONST); -#line 1522 "pf.g" +#line 1540 "pf.g" is.icmp_code_int = LT(0)->getText(); -#line 6417 "PFCfgParser.cpp" +#line 6500 "PFCfgParser.cpp" break; } default: @@ -6438,10 +6521,10 @@ void PFCfgParser::icmp_type_code() { case USER: case GROUP: case LITERAL_fragment: - case 144: - case 145: case 146: case 147: + case 148: + case 149: case FLAGS: case ICMP_TYPE: case LITERAL_echorep: @@ -6463,8 +6546,8 @@ void PFCfgParser::icmp_type_code() { case LITERAL_trace: case LITERAL_dataconv: case LITERAL_mobredir: - case 170: - case 171: + case 172: + case 173: case LITERAL_mobregreq: case LITERAL_mobregrep: case LITERAL_photuris: @@ -6484,11 +6567,11 @@ void PFCfgParser::icmp_type_code() { } } } -#line 1525 "pf.g" +#line 1543 "pf.g" importer->icmp_type_code_group.push_back(is); -#line 6492 "PFCfgParser.cpp" +#line 6575 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -6533,8 +6616,8 @@ void PFCfgParser::icmp_list() { case LITERAL_trace: case LITERAL_dataconv: case LITERAL_mobredir: - case 170: - case 171: + case 172: + case 173: case LITERAL_mobregreq: case LITERAL_mobregrep: case LITERAL_photuris: @@ -6550,11 +6633,11 @@ void PFCfgParser::icmp_list() { icmp_type_code(); } else { - goto _loop243; + goto _loop246; } } - _loop243:; + _loop246:; } // ( ... )* match(CLOSING_BRACE); } @@ -6665,14 +6748,14 @@ void PFCfgParser::icmp_type_by_name() { match(LITERAL_mobredir); break; } - case 170: + case 172: { - match(170); + match(172); break; } - case 171: + case 173: { - match(171); + match(173); break; } case LITERAL_mobregreq: @@ -6710,9 +6793,9 @@ void PFCfgParser::icmp_type_by_name() { void PFCfgParser::port_op() { Tracer traceInOut(this, "port_op"); -#line 1776 "pf.g" +#line 1794 "pf.g" PortSpec ps; -#line 6716 "PFCfgParser.cpp" +#line 6799 "PFCfgParser.cpp" try { // for error handling { @@ -6723,39 +6806,39 @@ void PFCfgParser::port_op() { case EXLAMATION: { unary_op(); -#line 1778 "pf.g" +#line 1796 "pf.g" ps.port_op = importer->tmp_port_op; -#line 6729 "PFCfgParser.cpp" +#line 6812 "PFCfgParser.cpp" port_def(); -#line 1780 "pf.g" +#line 1798 "pf.g" ps.port1 = importer->tmp_port_def; ps.port2 = importer->tmp_port_def; -#line 6736 "PFCfgParser.cpp" +#line 6819 "PFCfgParser.cpp" break; } case WORD: case INT_CONST: { port_def(); -#line 1786 "pf.g" +#line 1804 "pf.g" ps.port1 = importer->tmp_port_def; ps.port2 = ps.port1; ps.port_op = "="; -#line 6749 "PFCfgParser.cpp" +#line 6832 "PFCfgParser.cpp" { if ((LA(1) == LESS_THAN || LA(1) == GREATER_THAN || LA(1) == COLON) && (_tokenSet_48.member(LA(2)))) { binary_op(); -#line 1792 "pf.g" +#line 1810 "pf.g" ps.port_op = importer->tmp_port_op; -#line 6755 "PFCfgParser.cpp" +#line 6838 "PFCfgParser.cpp" port_def(); -#line 1793 "pf.g" +#line 1811 "pf.g" ps.port2 = LT(0)->getText(); -#line 6759 "PFCfgParser.cpp" +#line 6842 "PFCfgParser.cpp" } else if ((_tokenSet_58.member(LA(1))) && (_tokenSet_59.member(LA(2)))) { } @@ -6769,11 +6852,11 @@ void PFCfgParser::port_op() { case IPV6: { match(IPV6); -#line 1797 "pf.g" +#line 1815 "pf.g" ps.setFromPortRange(LT(0)->getText()); -#line 6777 "PFCfgParser.cpp" +#line 6860 "PFCfgParser.cpp" break; } default: @@ -6782,11 +6865,11 @@ void PFCfgParser::port_op() { } } } -#line 1801 "pf.g" +#line 1819 "pf.g" importer->tmp_port_group.push_back(ps); -#line 6790 "PFCfgParser.cpp" +#line 6873 "PFCfgParser.cpp" } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { reportError(ex); @@ -6829,11 +6912,11 @@ void PFCfgParser::port_op_list() { port_op(); } else { - goto _loop271; + goto _loop274; } } - _loop271:; + _loop274:; } // ( ... )* match(CLOSING_BRACE); } @@ -6852,7 +6935,7 @@ const char* PFCfgParser::tokenNames[] = { "<2>", "NULL_TREE_LOOKAHEAD", "NEWLINE", - "LINE_COMMENT", + "COMMENT_START", "\"include\"", "WORD", "EQUAL", @@ -6985,8 +7068,10 @@ const char* PFCfgParser::tokenNames[] = { "\"urpf-failed\"", "\"any\"", "\"no-route\"", + "MACRO", "\"route-to\"", "\"reply-to\"", + "\"dup-to\"", "\"group\"", "\"fragment\"", "\"crop\"", @@ -7093,7 +7178,6 @@ const char* PFCfgParser::tokenNames[] = { "NUM_HEX_4DIGIT", "NUMBER_ADDRESS_OR_WORD", "PIPE_CHAR", - "NUMBER_SIGN", "PERCENT", "AMPERSAND", "APOSTROPHE", @@ -7115,19 +7199,19 @@ const unsigned long PFCfgParser::_tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL, 0UL // EOF const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_0(_tokenSet_0_data_,10); const unsigned long PFCfgParser::_tokenSet_1_data_[] = { 7922UL, 0UL, 40894478UL, 192UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD "antispoof" "altq" "queue" "set" -// "scrub" "match" "table" "no" "nat" "pass" "rdr" "binat" "block" +// EOF NEWLINE COMMENT_START "include" WORD "antispoof" "altq" "queue" +// "set" "scrub" "match" "table" "no" "nat" "pass" "rdr" "binat" "block" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_1(_tokenSet_1_data_,10); const unsigned long PFCfgParser::_tokenSet_2_data_[] = { 128UL, 134217736UL, 460800UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // WORD COMMA INT_CONST EXLAMATION "self" IPV4 NUMBER const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_2(_tokenSet_2_data_,10); const unsigned long PFCfgParser::_tokenSet_3_data_[] = { 7922UL, 134217496UL, 40894478UL, 192UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD "antispoof" "altq" "queue" "set" -// COMMA CLOSING_BRACE "tcp.first" "tcp.opening" "tcp.established" "tcp.closing" -// "tcp.finwait" "tcp.closed" "udp.first" "udp.single" "udp.multiple" "icmp.first" -// "icmp.error" "other.first" "other.single" "other.multiple" "frag" "interval" -// "src.track" "adaptive.start" "adaptive.end" "scrub" "match" "table" -// "no" "nat" "pass" "rdr" "binat" "block" +// EOF NEWLINE COMMENT_START "include" WORD "antispoof" "altq" "queue" +// "set" COMMA CLOSING_BRACE "tcp.first" "tcp.opening" "tcp.established" +// "tcp.closing" "tcp.finwait" "tcp.closed" "udp.first" "udp.single" "udp.multiple" +// "icmp.first" "icmp.error" "other.first" "other.single" "other.multiple" +// "frag" "interval" "src.track" "adaptive.start" "adaptive.end" "scrub" +// "match" "table" "no" "nat" "pass" "rdr" "binat" "block" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_3(_tokenSet_3_data_,10); const unsigned long PFCfgParser::_tokenSet_4_data_[] = { 0UL, 134217480UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // COMMA "tcp.first" "tcp.opening" "tcp.established" "tcp.closing" "tcp.finwait" @@ -7136,39 +7220,39 @@ const unsigned long PFCfgParser::_tokenSet_4_data_[] = { 0UL, 134217480UL, 0UL, // "adaptive.start" "adaptive.end" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_4(_tokenSet_4_data_,10); const unsigned long PFCfgParser::_tokenSet_5_data_[] = { 7922UL, 4026531864UL, 40894479UL, 192UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD "antispoof" "altq" "queue" "set" -// COMMA CLOSING_BRACE "frags" "states" "src-nodes" "tables" "tables-entries" +// EOF NEWLINE COMMENT_START "include" WORD "antispoof" "altq" "queue" +// "set" COMMA CLOSING_BRACE "frags" "states" "src-nodes" "tables" "tables-entries" // "scrub" "match" "table" "no" "nat" "pass" "rdr" "binat" "block" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_5(_tokenSet_5_data_,10); const unsigned long PFCfgParser::_tokenSet_6_data_[] = { 0UL, 4026531848UL, 1UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // COMMA "frags" "states" "src-nodes" "tables" "tables-entries" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_6(_tokenSet_6_data_,10); -const unsigned long PFCfgParser::_tokenSet_7_data_[] = { 2064UL, 64UL, 68159490UL, 458752UL, 4141120UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_7_data_[] = { 2064UL, 64UL, 68159490UL, 458752UL, 16564288UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN "all" // "user" "to" "from" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" // "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_7(_tokenSet_7_data_,16); -const unsigned long PFCfgParser::_tokenSet_8_data_[] = { 8178UL, 134217805UL, 645598270UL, 33685696UL, 4290769792UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_8_data_[] = { 8178UL, 134217805UL, 645598270UL, 33685696UL, 4278175616UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" OPENING_BRACE COMMA "reassemble" INT_CONST "scrub" "match" // "table" LESS_THAN GREATER_THAN STRING EXLAMATION "self" IPV4 SLASH "no" // "nat" "pass" "rdr" OPENING_PAREN IPV6 "binat" "block" "user" "tcp" "urpf-failed" -// "any" "no-route" "group" "fragment" "crop" "drop-ovl" "no-df" "min-ttl" -// "max-mss" "random-id" "flags" "icmp-type" "echorep" "unreach" "squench" -// "redir" "althost" "echoreq" "routeradv" "routersol" "timex" "paramprob" -// "timereq" "timerep" "inforeq" "inforep" "maskreq" "maskrep" "trace" -// "dataconv" "mobredir" "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" +// "any" "no-route" MACRO "group" "fragment" "crop" "drop-ovl" "no-df" +// "min-ttl" "max-mss" "random-id" "flags" "icmp-type" "echorep" "unreach" +// "squench" "redir" "althost" "echoreq" "routeradv" "routersol" "timex" +// "paramprob" "timereq" "timerep" "inforeq" "inforep" "maskreq" "maskrep" +// "trace" "dataconv" "mobredir" "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" // "photuris" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "state" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_8(_tokenSet_8_data_,16); -const unsigned long PFCfgParser::_tokenSet_9_data_[] = { 2064UL, 64UL, 68159490UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_9_data_[] = { 2064UL, 64UL, 68159490UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN "user" // "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" // "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_9(_tokenSet_9_data_,16); -const unsigned long PFCfgParser::_tokenSet_10_data_[] = { 8178UL, 134217805UL, 108530750UL, 33685696UL, 4290769152UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_10_data_[] = { 8178UL, 134217805UL, 108530750UL, 33685696UL, 4278173952UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" OPENING_BRACE COMMA "reassemble" INT_CONST "scrub" "match" // "table" LESS_THAN GREATER_THAN STRING EXLAMATION SLASH "no" "nat" "pass" // "rdr" OPENING_PAREN "binat" "block" "user" "tcp" "any" "group" "fragment" @@ -7185,35 +7269,36 @@ const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_11(_tokenSet_11_da const unsigned long PFCfgParser::_tokenSet_12_data_[] = { 128UL, 134217752UL, 460800UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // WORD COMMA CLOSING_BRACE INT_CONST EXLAMATION "self" IPV4 NUMBER const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_12(_tokenSet_12_data_,10); -const unsigned long PFCfgParser::_tokenSet_13_data_[] = { 16UL, 2UL, 8390656UL, 3997696UL, 64UL, 0UL, 49152UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_13_data_[] = { 16UL, 2UL, 8390656UL, 3997696UL, 64UL, 0UL, 196608UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "on" EXLAMATION MINUS "all" "to" "inet" "inet6" "proto" "from" // "tagged" "tag" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_13(_tokenSet_13_data_,16); -const unsigned long PFCfgParser::_tokenSet_14_data_[] = { 2064UL, 64UL, 76548098UL, 4128768UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_14_data_[] = { 2064UL, 64UL, 76548098UL, 4128768UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "all" "user" "to" "inet" "inet6" "proto" "from" "route-to" "reply-to" -// "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" -// "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" +// "dup-to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" +// "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_14(_tokenSet_14_data_,16); -const unsigned long PFCfgParser::_tokenSet_15_data_[] = { 2064UL, 64UL, 76548098UL, 2555904UL, 4141120UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_15_data_[] = { 2064UL, 64UL, 76548098UL, 2555904UL, 16564288UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "all" "user" "to" "proto" "from" "group" "fragment" "no-df" "min-ttl" // "max-mss" "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" // "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_15(_tokenSet_15_data_,16); -const unsigned long PFCfgParser::_tokenSet_16_data_[] = { 2064UL, 64UL, 76548098UL, 458752UL, 4141120UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_16_data_[] = { 2064UL, 64UL, 76548098UL, 458752UL, 16564288UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "all" "user" "to" "from" "group" "fragment" "no-df" "min-ttl" "max-mss" // "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" // "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_16(_tokenSet_16_data_,16); -const unsigned long PFCfgParser::_tokenSet_17_data_[] = { 2064UL, 64UL, 76548098UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_17_data_[] = { 2064UL, 64UL, 76548098UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "user" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" // "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_17(_tokenSet_17_data_,16); -const unsigned long PFCfgParser::_tokenSet_18_data_[] = { 2064UL, 72UL, 76548098UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_18_data_[] = { 2064UL, 72UL, 76548098UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" COMMA "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "user" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" // "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" @@ -7235,7 +7320,7 @@ const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_22(_tokenSet_22_da const unsigned long PFCfgParser::_tokenSet_23_data_[] = { 16UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "static-port" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_23(_tokenSet_23_data_,10); -const unsigned long PFCfgParser::_tokenSet_24_data_[] = { 2448UL, 134217816UL, 2777684018UL, 393235UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_24_data_[] = { 2448UL, 134217816UL, 2777684018UL, 393235UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE WORD EQUAL "queue" COMMA CLOSING_BRACE "reassemble" INT_CONST // "scrub" LESS_THAN GREATER_THAN EXLAMATION COLON "no" MINUS "static-port" // OPENING_PAREN IPV6 "bitmask" "random" "source-hash" "round-robin" "user" @@ -7243,7 +7328,7 @@ const unsigned long PFCfgParser::_tokenSet_24_data_[] = { 2448UL, 134217816UL, 2 // "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_24(_tokenSet_24_data_,16); -const unsigned long PFCfgParser::_tokenSet_25_data_[] = { 0UL, 134217728UL, 0UL, 0UL, 0UL, 4294934528UL, 8191UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_25_data_[] = { 0UL, 134217728UL, 0UL, 0UL, 0UL, 4294836224UL, 32767UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // INT_CONST "net-unr" "host-unr" "proto-unr" "port-unr" "needfrag" "srcfail" // "net-unk" "host-unk" "isolate" "net-prohib" "host-prohib" "net-tos" // "host-tos" "filter-prohib" "host-preced" "cutoff-preced" "redir-net" @@ -7251,29 +7336,30 @@ const unsigned long PFCfgParser::_tokenSet_25_data_[] = { 0UL, 134217728UL, 0UL, // "transit" "reassemb" "badhead" "optmiss" "badlen" "unknown-ind" "auth-fail" // "decrypt-fail" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_25(_tokenSet_25_data_,16); -const unsigned long PFCfgParser::_tokenSet_26_data_[] = { 2064UL, 66UL, 68159490UL, 4190208UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_26_data_[] = { 2064UL, 66UL, 68159490UL, 4190208UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "on" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN // "in" "out" "log" "quick" "all" "user" "to" "inet" "inet6" "proto" "from" -// "route-to" "reply-to" "group" "fragment" "no-df" "min-ttl" "max-mss" -// "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" -// "synproxy" "label" +// "route-to" "reply-to" "dup-to" "group" "fragment" "no-df" "min-ttl" +// "max-mss" "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" +// "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_26(_tokenSet_26_data_,16); -const unsigned long PFCfgParser::_tokenSet_27_data_[] = { 8178UL, 134217807UL, 645598270UL, 4294951104UL, 4290772991UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_27_data_[] = { 8178UL, 134217807UL, 645598270UL, 4294951104UL, 4278190079UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" "on" OPENING_BRACE COMMA "reassemble" INT_CONST "scrub" // "match" "table" LESS_THAN GREATER_THAN STRING EXLAMATION "self" IPV4 // SLASH "no" "nat" "pass" "rdr" OPENING_PAREN IPV6 "binat" "block" "log" // "quick" "all" "user" "to" "inet" "inet6" "proto" "ip" "icmp" "igmp" // "tcp" "udp" "rdp" "rsvp" "gre" "esp" "ah" "eigrp" "ospf" "ipip" "vrrp" -// "l2tp" "isis" "from" "urpf-failed" "any" "no-route" "route-to" "reply-to" -// "group" "fragment" "crop" "drop-ovl" "no-df" "min-ttl" "max-mss" "random-id" -// "flags" "icmp-type" "echorep" "unreach" "squench" "redir" "althost" -// "echoreq" "routeradv" "routersol" "timex" "paramprob" "timereq" "timerep" -// "inforeq" "inforep" "maskreq" "maskrep" "trace" "dataconv" "mobredir" -// "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" "photuris" "icmp6-type" -// "tagged" "tag" "keep" "modulate" "synproxy" "state" "label" +// "l2tp" "isis" "from" "urpf-failed" "any" "no-route" MACRO "route-to" +// "reply-to" "dup-to" "group" "fragment" "crop" "drop-ovl" "no-df" "min-ttl" +// "max-mss" "random-id" "flags" "icmp-type" "echorep" "unreach" "squench" +// "redir" "althost" "echoreq" "routeradv" "routersol" "timex" "paramprob" +// "timereq" "timerep" "inforeq" "inforep" "maskreq" "maskrep" "trace" +// "dataconv" "mobredir" "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" +// "photuris" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "state" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_27(_tokenSet_27_data_,16); -const unsigned long PFCfgParser::_tokenSet_28_data_[] = { 2064UL, 134217817UL, 202377218UL, 131072UL, 4290719744UL, 32767UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_28_data_[] = { 2064UL, 134217817UL, 202377218UL, 131072UL, 4277977088UL, 131071UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "skip" COMMA CLOSING_BRACE "reassemble" INT_CONST "scrub" // EXLAMATION "no" OPENING_PAREN CLOSING_PAREN "user" "group" "fragment" // "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" "echorep" @@ -7283,82 +7369,86 @@ const unsigned long PFCfgParser::_tokenSet_28_data_[] = { 2064UL, 134217817UL, 2 // "mobregrep" "photuris" "icmp6-type" "tagged" "tag" "keep" "modulate" // "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_28(_tokenSet_28_data_,16); -const unsigned long PFCfgParser::_tokenSet_29_data_[] = { 2064UL, 66UL, 68159490UL, 4177920UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_29_data_[] = { 2064UL, 66UL, 68159490UL, 4177920UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "on" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN // "log" "quick" "all" "user" "to" "inet" "inet6" "proto" "from" "route-to" -// "reply-to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" +// "reply-to" "dup-to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" // "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_29(_tokenSet_29_data_,16); -const unsigned long PFCfgParser::_tokenSet_30_data_[] = { 2064UL, 66UL, 68159490UL, 4161536UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_30_data_[] = { 2064UL, 66UL, 68159490UL, 4161536UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "on" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN // "quick" "all" "user" "to" "inet" "inet6" "proto" "from" "route-to" "reply-to" -// "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" -// "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" +// "dup-to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" +// "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_30(_tokenSet_30_data_,16); -const unsigned long PFCfgParser::_tokenSet_31_data_[] = { 8178UL, 134217807UL, 645598270UL, 4294901952UL, 4290772991UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_31_data_[] = { 8178UL, 134217807UL, 645598270UL, 4294901952UL, 4278190079UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" "on" OPENING_BRACE COMMA "reassemble" INT_CONST "scrub" // "match" "table" LESS_THAN GREATER_THAN STRING EXLAMATION "self" IPV4 // SLASH "no" "nat" "pass" "rdr" OPENING_PAREN IPV6 "binat" "block" "all" // "user" "to" "inet" "inet6" "proto" "ip" "icmp" "igmp" "tcp" "udp" "rdp" // "rsvp" "gre" "esp" "ah" "eigrp" "ospf" "ipip" "vrrp" "l2tp" "isis" "from" -// "urpf-failed" "any" "no-route" "route-to" "reply-to" "group" "fragment" -// "crop" "drop-ovl" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" -// "echorep" "unreach" "squench" "redir" "althost" "echoreq" "routeradv" -// "routersol" "timex" "paramprob" "timereq" "timerep" "inforeq" "inforep" -// "maskreq" "maskrep" "trace" "dataconv" "mobredir" "ipv6-where" "ipv6-here" -// "mobregreq" "mobregrep" "photuris" "icmp6-type" "tagged" "tag" "keep" -// "modulate" "synproxy" "state" "label" +// "urpf-failed" "any" "no-route" MACRO "route-to" "reply-to" "dup-to" +// "group" "fragment" "crop" "drop-ovl" "no-df" "min-ttl" "max-mss" "random-id" +// "flags" "icmp-type" "echorep" "unreach" "squench" "redir" "althost" +// "echoreq" "routeradv" "routersol" "timex" "paramprob" "timereq" "timerep" +// "inforeq" "inforep" "maskreq" "maskrep" "trace" "dataconv" "mobredir" +// "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" "photuris" "icmp6-type" +// "tagged" "tag" "keep" "modulate" "synproxy" "state" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_31(_tokenSet_31_data_,16); -const unsigned long PFCfgParser::_tokenSet_32_data_[] = { 2064UL, 66UL, 68159490UL, 4128768UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_32_data_[] = { 2064UL, 66UL, 68159490UL, 4128768UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "on" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN // "all" "user" "to" "inet" "inet6" "proto" "from" "route-to" "reply-to" -// "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" -// "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" +// "dup-to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" +// "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_32(_tokenSet_32_data_,16); -const unsigned long PFCfgParser::_tokenSet_33_data_[] = { 8178UL, 134217805UL, 645598270UL, 4293329088UL, 4290769919UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_33_data_[] = { 8178UL, 134217805UL, 645598270UL, 4293329088UL, 4278175743UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" OPENING_BRACE COMMA "reassemble" INT_CONST "scrub" "match" // "table" LESS_THAN GREATER_THAN STRING EXLAMATION "self" IPV4 SLASH "no" // "nat" "pass" "rdr" OPENING_PAREN IPV6 "binat" "block" "all" "user" "to" // "proto" "ip" "icmp" "igmp" "tcp" "udp" "rdp" "rsvp" "gre" "esp" "ah" // "eigrp" "ospf" "ipip" "vrrp" "l2tp" "isis" "from" "urpf-failed" "any" -// "no-route" "group" "fragment" "crop" "drop-ovl" "no-df" "min-ttl" "max-mss" -// "random-id" "flags" "icmp-type" "echorep" "unreach" "squench" "redir" -// "althost" "echoreq" "routeradv" "routersol" "timex" "paramprob" "timereq" -// "timerep" "inforeq" "inforep" "maskreq" "maskrep" "trace" "dataconv" -// "mobredir" "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" "photuris" -// "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "state" "label" +// "no-route" MACRO "group" "fragment" "crop" "drop-ovl" "no-df" "min-ttl" +// "max-mss" "random-id" "flags" "icmp-type" "echorep" "unreach" "squench" +// "redir" "althost" "echoreq" "routeradv" "routersol" "timex" "paramprob" +// "timereq" "timerep" "inforeq" "inforep" "maskreq" "maskrep" "trace" +// "dataconv" "mobredir" "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" +// "photuris" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "state" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_33(_tokenSet_33_data_,16); -const unsigned long PFCfgParser::_tokenSet_34_data_[] = { 2064UL, 64UL, 68159490UL, 4128768UL, 4141120UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_34_data_[] = { 2064UL, 64UL, 68159490UL, 4128768UL, 16564288UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN "all" // "user" "to" "inet" "inet6" "proto" "from" "group" "fragment" "no-df" // "min-ttl" "max-mss" "random-id" "flags" "icmp-type" "icmp6-type" "tagged" // "tag" "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_34(_tokenSet_34_data_,16); -const unsigned long PFCfgParser::_tokenSet_35_data_[] = { 2048UL, 72UL, 68159490UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_35_data_[] = { 2048UL, 72UL, 68159490UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // "queue" COMMA "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN "user" // "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" // "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_35(_tokenSet_35_data_,16); -const unsigned long PFCfgParser::_tokenSet_36_data_[] = { 2064UL, 66UL, 76548098UL, 4161536UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_36_data_[] = { 2064UL, 66UL, 76548098UL, 4161536UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "on" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "quick" "all" "user" "to" "inet" "inet6" "proto" "from" "route-to" "reply-to" -// "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" -// "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" +// "dup-to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" +// "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_36(_tokenSet_36_data_,16); const unsigned long PFCfgParser::_tokenSet_37_data_[] = { 0UL, 8UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // COMMA CLOSING_PAREN const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_37(_tokenSet_37_data_,10); -const unsigned long PFCfgParser::_tokenSet_38_data_[] = { 2192UL, 88UL, 76548098UL, 4128768UL, 4144192UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_38_data_[] = { 2192UL, 88UL, 76548098UL, 4128768UL, 16578624UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE WORD "queue" COMMA CLOSING_BRACE "reassemble" "scrub" EXLAMATION // "no" MINUS OPENING_PAREN "all" "user" "to" "inet" "inet6" "proto" "from" -// "route-to" "reply-to" "group" "fragment" "no-df" "min-ttl" "max-mss" -// "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" -// "synproxy" "label" +// "route-to" "reply-to" "dup-to" "group" "fragment" "no-df" "min-ttl" +// "max-mss" "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" +// "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_38(_tokenSet_38_data_,16); -const unsigned long PFCfgParser::_tokenSet_39_data_[] = { 2064UL, 134217820UL, 76548098UL, 4291231744UL, 4141183UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_39_data_[] = { 2064UL, 134217820UL, 76548098UL, 4291231744UL, 16564351UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" OPENING_BRACE COMMA CLOSING_BRACE "reassemble" INT_CONST // "scrub" EXLAMATION "no" MINUS OPENING_PAREN "all" "user" "to" "ip" "icmp" // "igmp" "tcp" "udp" "rdp" "rsvp" "gre" "esp" "ah" "eigrp" "ospf" "ipip" @@ -7370,40 +7460,41 @@ const unsigned long PFCfgParser::_tokenSet_40_data_[] = { 0UL, 134217740UL, 0UL, // OPENING_BRACE COMMA INT_CONST "ip" "icmp" "igmp" "tcp" "udp" "rdp" "rsvp" // "gre" "esp" "ah" "eigrp" "ospf" "ipip" "vrrp" "l2tp" "isis" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_40(_tokenSet_40_data_,12); -const unsigned long PFCfgParser::_tokenSet_41_data_[] = { 2064UL, 64UL, 76548098UL, 393216UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_41_data_[] = { 2064UL, 64UL, 76548098UL, 393216UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "user" "to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" // "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_41(_tokenSet_41_data_,16); -const unsigned long PFCfgParser::_tokenSet_42_data_[] = { 2064UL, 64UL, 344983554UL, 393216UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_42_data_[] = { 2064UL, 64UL, 344983554UL, 393216UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "port" "user" "to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" // "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_42(_tokenSet_42_data_,16); -const unsigned long PFCfgParser::_tokenSet_43_data_[] = { 2064UL, 64UL, 344983554UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_43_data_[] = { 2064UL, 64UL, 344983554UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "reassemble" "scrub" EXLAMATION "no" MINUS OPENING_PAREN // "port" "user" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" // "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_43(_tokenSet_43_data_,16); -const unsigned long PFCfgParser::_tokenSet_44_data_[] = { 2192UL, 88UL, 882051090UL, 393216UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_44_data_[] = { 2192UL, 88UL, 882051090UL, 393216UL, 16565248UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE WORD "queue" COMMA CLOSING_BRACE "reassemble" "scrub" LESS_THAN // EXLAMATION "self" IPV4 "no" MINUS OPENING_PAREN "port" IPV6 "user" "to" -// "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" -// "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" +// MACRO "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" +// "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" +// "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_44(_tokenSet_44_data_,16); -const unsigned long PFCfgParser::_tokenSet_45_data_[] = { 128UL, 8UL, 604178448UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// WORD COMMA LESS_THAN EXLAMATION "self" IPV4 OPENING_PAREN IPV6 -const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_45(_tokenSet_45_data_,10); -const unsigned long PFCfgParser::_tokenSet_46_data_[] = { 2064UL, 88UL, 68159490UL, 4128768UL, 4141120UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_45_data_[] = { 128UL, 8UL, 604178448UL, 0UL, 1024UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// WORD COMMA LESS_THAN EXLAMATION "self" IPV4 OPENING_PAREN IPV6 MACRO +const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_45(_tokenSet_45_data_,12); +const unsigned long PFCfgParser::_tokenSet_46_data_[] = { 2064UL, 88UL, 68159490UL, 4128768UL, 16564288UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" COMMA CLOSING_BRACE "reassemble" "scrub" EXLAMATION // "no" OPENING_PAREN "all" "user" "to" "inet" "inet6" "proto" "from" "group" // "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" // "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_46(_tokenSet_46_data_,16); -const unsigned long PFCfgParser::_tokenSet_47_data_[] = { 2064UL, 72UL, 68159490UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_47_data_[] = { 2064UL, 72UL, 68159490UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" COMMA "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN // "user" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" // "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" @@ -7412,14 +7503,14 @@ const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_47(_tokenSet_47_da const unsigned long PFCfgParser::_tokenSet_48_data_[] = { 128UL, 134217728UL, 48UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // WORD INT_CONST LESS_THAN GREATER_THAN const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_48(_tokenSet_48_data_,10); -const unsigned long PFCfgParser::_tokenSet_49_data_[] = { 2448UL, 134217816UL, 68159538UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_49_data_[] = { 2448UL, 134217816UL, 68159538UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE WORD EQUAL "queue" COMMA CLOSING_BRACE "reassemble" INT_CONST // "scrub" LESS_THAN GREATER_THAN EXLAMATION "no" OPENING_PAREN "user" // "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" // "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_49(_tokenSet_49_data_,16); -const unsigned long PFCfgParser::_tokenSet_50_data_[] = { 8178UL, 134217821UL, 108534846UL, 33685696UL, 4290769152UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_50_data_[] = { 8178UL, 134217821UL, 108534846UL, 33685696UL, 4278173952UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" OPENING_BRACE COMMA CLOSING_BRACE "reassemble" INT_CONST // "scrub" "match" "table" LESS_THAN GREATER_THAN STRING EXLAMATION COLON // SLASH "no" "nat" "pass" "rdr" OPENING_PAREN "binat" "block" "user" "tcp" @@ -7436,16 +7527,16 @@ const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_51(_tokenSet_51_da const unsigned long PFCfgParser::_tokenSet_52_data_[] = { 128UL, 134217728UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // WORD INT_CONST const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_52(_tokenSet_52_data_,10); -const unsigned long PFCfgParser::_tokenSet_53_data_[] = { 2064UL, 72UL, 202377218UL, 131072UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_53_data_[] = { 2064UL, 72UL, 202377218UL, 131072UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" COMMA "reassemble" "scrub" EXLAMATION "no" OPENING_PAREN // CLOSING_PAREN "user" "group" "fragment" "no-df" "min-ttl" "max-mss" // "random-id" "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" // "synproxy" "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_53(_tokenSet_53_data_,16); -const unsigned long PFCfgParser::_tokenSet_54_data_[] = { 0UL, 72UL, 0UL, 0UL, 991232UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_54_data_[] = { 0UL, 72UL, 0UL, 0UL, 3964928UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // COMMA "reassemble" "fragment" "no-df" "min-ttl" "max-mss" "random-id" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_54(_tokenSet_54_data_,12); -const unsigned long PFCfgParser::_tokenSet_55_data_[] = { 2064UL, 134217817UL, 68159490UL, 131072UL, 4290719744UL, 32767UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_55_data_[] = { 2064UL, 134217817UL, 68159490UL, 131072UL, 4277977088UL, 131071UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "skip" COMMA CLOSING_BRACE "reassemble" INT_CONST "scrub" // EXLAMATION "no" OPENING_PAREN "user" "group" "fragment" "no-df" "min-ttl" // "max-mss" "random-id" "flags" "icmp-type" "echorep" "unreach" "squench" @@ -7455,13 +7546,13 @@ const unsigned long PFCfgParser::_tokenSet_55_data_[] = { 2064UL, 134217817UL, 6 // "photuris" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_55(_tokenSet_55_data_,16); -const unsigned long PFCfgParser::_tokenSet_56_data_[] = { 0UL, 134217737UL, 0UL, 0UL, 4286578688UL, 32767UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_56_data_[] = { 0UL, 134217737UL, 0UL, 0UL, 4261412864UL, 131071UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // "skip" COMMA INT_CONST "echorep" "unreach" "squench" "redir" "althost" // "echoreq" "routeradv" "routersol" "timex" "paramprob" "timereq" "timerep" // "inforeq" "inforep" "maskreq" "maskrep" "trace" "dataconv" "mobredir" // "ipv6-where" "ipv6-here" "mobregreq" "mobregrep" "photuris" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_56(_tokenSet_56_data_,12); -const unsigned long PFCfgParser::_tokenSet_57_data_[] = { 2064UL, 134217817UL, 68159490UL, 131072UL, 4294914048UL, 32767UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_57_data_[] = { 2064UL, 134217817UL, 68159490UL, 131072UL, 4294754304UL, 131071UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE "queue" "skip" COMMA CLOSING_BRACE "reassemble" INT_CONST "scrub" // EXLAMATION "no" OPENING_PAREN "user" "group" "fragment" "no-df" "min-ttl" // "max-mss" "random-id" "flags" "icmp-type" "code" "echorep" "unreach" @@ -7471,20 +7562,20 @@ const unsigned long PFCfgParser::_tokenSet_57_data_[] = { 2064UL, 134217817UL, 6 // "photuris" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_57(_tokenSet_57_data_,16); -const unsigned long PFCfgParser::_tokenSet_58_data_[] = { 2448UL, 134217816UL, 613419058UL, 393216UL, 4141056UL, 0UL, 1564672UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +const unsigned long PFCfgParser::_tokenSet_58_data_[] = { 2448UL, 134217816UL, 613419058UL, 393216UL, 16564224UL, 0UL, 6258688UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE WORD EQUAL "queue" COMMA CLOSING_BRACE "reassemble" INT_CONST // "scrub" LESS_THAN GREATER_THAN EXLAMATION "no" MINUS OPENING_PAREN IPV6 // "user" "to" "group" "fragment" "no-df" "min-ttl" "max-mss" "random-id" // "flags" "icmp-type" "icmp6-type" "tagged" "tag" "keep" "modulate" "synproxy" // "label" const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgParser::_tokenSet_58(_tokenSet_58_data_,16); -const unsigned long PFCfgParser::_tokenSet_59_data_[] = { 8178UL, 134217821UL, 653990974UL, 33947840UL, 4290769664UL, 32767UL, 2088960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE LINE_COMMENT "include" WORD EQUAL "antispoof" "altq" "queue" +const unsigned long PFCfgParser::_tokenSet_59_data_[] = { 8178UL, 134217821UL, 653990974UL, 33947840UL, 4278175488UL, 131071UL, 8355840UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF NEWLINE COMMENT_START "include" WORD EQUAL "antispoof" "altq" "queue" // "set" "skip" OPENING_BRACE COMMA CLOSING_BRACE "reassemble" INT_CONST // "scrub" "match" "table" LESS_THAN GREATER_THAN STRING EXLAMATION COLON // "self" IPV4 SLASH "no" "nat" "pass" MINUS "rdr" OPENING_PAREN IPV6 "binat" -// "block" "user" "to" "tcp" "any" "no-route" "group" "fragment" "crop" -// "drop-ovl" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" +// "block" "user" "to" "tcp" "any" "no-route" MACRO "group" "fragment" +// "crop" "drop-ovl" "no-df" "min-ttl" "max-mss" "random-id" "flags" "icmp-type" // "echorep" "unreach" "squench" "redir" "althost" "echoreq" "routeradv" // "routersol" "timex" "paramprob" "timereq" "timerep" "inforeq" "inforep" // "maskreq" "maskrep" "trace" "dataconv" "mobredir" "ipv6-where" "ipv6-here" diff --git a/src/parsers/PFCfgParser.hpp b/src/parsers/PFCfgParser.hpp index e45fbfa48..0b5fe4ec3 100644 --- a/src/parsers/PFCfgParser.hpp +++ b/src/parsers/PFCfgParser.hpp @@ -9,7 +9,7 @@ #line 11 "PFCfgParser.hpp" #include -/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgParser.hpp"$ */ +/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgParser.hpp"$ */ #include #include #include "PFCfgParserTokenTypes.hpp" @@ -165,6 +165,7 @@ public: public: void host_list(); public: void route_to(); public: void reply_to(); + public: void dup_to(); public: void routehost(); public: void routehost_list(); public: void filteropt(); @@ -200,10 +201,10 @@ protected: private: static const char* tokenNames[]; #ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 261; + static const int NUM_TOKENS = 262; #else enum { - NUM_TOKENS = 261 + NUM_TOKENS = 262 }; #endif diff --git a/src/parsers/PFCfgParserTokenTypes.hpp b/src/parsers/PFCfgParserTokenTypes.hpp index ae0e15ba7..fabc7025c 100644 --- a/src/parsers/PFCfgParserTokenTypes.hpp +++ b/src/parsers/PFCfgParserTokenTypes.hpp @@ -1,7 +1,7 @@ #ifndef INC_PFCfgParserTokenTypes_hpp_ #define INC_PFCfgParserTokenTypes_hpp_ -/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgParserTokenTypes.hpp"$ */ +/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgParserTokenTypes.hpp"$ */ #ifndef CUSTOM_API # define CUSTOM_API @@ -13,7 +13,7 @@ struct CUSTOM_API PFCfgParserTokenTypes { enum { EOF_ = 1, NEWLINE = 4, - LINE_COMMENT = 5, + COMMENT_START = 5, INCLUDE_COMMAND = 6, WORD = 7, EQUAL = 8, @@ -146,129 +146,130 @@ struct CUSTOM_API PFCfgParserTokenTypes { URPF_FAILED = 135, ANY = 136, NO_ROUTE = 137, - ROUTE_TO = 138, - REPLY_TO = 139, - GROUP = 140, - LITERAL_fragment = 141, - LITERAL_crop = 142, - // "drop-ovl" = 143 - // "no-df" = 144 - // "min-ttl" = 145 - // "max-mss" = 146 - // "random-id" = 147 - FLAGS = 148, - ICMP_TYPE = 149, - ICMP_CODE = 150, - LITERAL_echorep = 151, - LITERAL_unreach = 152, - LITERAL_squench = 153, - LITERAL_redir = 154, - LITERAL_althost = 155, - LITERAL_echoreq = 156, - LITERAL_routeradv = 157, - LITERAL_routersol = 158, - LITERAL_timex = 159, - LITERAL_paramprob = 160, - LITERAL_timereq = 161, - LITERAL_timerep = 162, - LITERAL_inforeq = 163, - LITERAL_inforep = 164, - LITERAL_maskreq = 165, - LITERAL_maskrep = 166, - LITERAL_trace = 167, - LITERAL_dataconv = 168, - LITERAL_mobredir = 169, - // "ipv6-where" = 170 - // "ipv6-here" = 171 - LITERAL_mobregreq = 172, - LITERAL_mobregrep = 173, - LITERAL_photuris = 174, - // "net-unr" = 175 - // "host-unr" = 176 - // "proto-unr" = 177 - // "port-unr" = 178 - LITERAL_needfrag = 179, - LITERAL_srcfail = 180, - // "net-unk" = 181 - // "host-unk" = 182 - LITERAL_isolate = 183, - // "net-prohib" = 184 - // "host-prohib" = 185 - // "net-tos" = 186 - // "host-tos" = 187 - // "filter-prohib" = 188 - // "host-preced" = 189 - // "cutoff-preced" = 190 - // "redir-net" = 191 - // "redir-host" = 192 - // "redir-tos-net" = 193 - // "redir-tos-host" = 194 - // "normal-adv" = 195 - // "common-adv" = 196 - LITERAL_transit = 197, - LITERAL_reassemb = 198, - LITERAL_badhead = 199, - LITERAL_optmiss = 200, - LITERAL_badlen = 201, - // "unknown-ind" = 202 - // "auth-fail" = 203 - // "decrypt-fail" = 204 - ICMP6_TYPE = 205, - TAGGED = 206, - TAG = 207, - KEEP = 208, - MODULATE = 209, - SYNPROXY = 210, - STATE = 211, - LABEL = 212, - EXIT = 213, - QUIT = 214, - INTRFACE = 215, - ICMP6 = 216, - IGRP = 217, - IPSEC = 218, - NOS = 219, - PCP = 220, - PIM = 221, - PPTP = 222, - RIP = 223, - SNP = 224, - HOST = 225, - RANGE = 226, - LOG_LEVEL_ALERTS = 227, - LOG_LEVEL_CRITICAL = 228, - LOG_LEVEL_DEBUGGING = 229, - LOG_LEVEL_EMERGENCIES = 230, - LOG_LEVEL_ERRORS = 231, - LOG_LEVEL_INFORMATIONAL = 232, - LOG_LEVEL_NOTIFICATIONS = 233, - LOG_LEVEL_WARNINGS = 234, - LOG_LEVEL_DISABLE = 235, - LOG_LEVEL_INACTIVE = 236, - Whitespace = 237, - HEX_CONST = 238, - NEG_INT_CONST = 239, - HEX_DIGIT = 240, - DIGIT = 241, - NUM_3DIGIT = 242, - NUM_HEX_4DIGIT = 243, - NUMBER_ADDRESS_OR_WORD = 244, - PIPE_CHAR = 245, - NUMBER_SIGN = 246, - PERCENT = 247, - AMPERSAND = 248, - APOSTROPHE = 249, - PLUS = 250, - DOT = 251, - SEMICOLON = 252, - QUESTION = 253, - COMMERCIAL_AT = 254, - OPENING_SQUARE = 255, - CLOSING_SQUARE = 256, - CARET = 257, - UNDERLINE = 258, - TILDE = 259, - DOUBLE_QUOTE = 260, + MACRO = 138, + ROUTE_TO = 139, + REPLY_TO = 140, + DUP_TO = 141, + GROUP = 142, + LITERAL_fragment = 143, + LITERAL_crop = 144, + // "drop-ovl" = 145 + // "no-df" = 146 + // "min-ttl" = 147 + // "max-mss" = 148 + // "random-id" = 149 + FLAGS = 150, + ICMP_TYPE = 151, + ICMP_CODE = 152, + LITERAL_echorep = 153, + LITERAL_unreach = 154, + LITERAL_squench = 155, + LITERAL_redir = 156, + LITERAL_althost = 157, + LITERAL_echoreq = 158, + LITERAL_routeradv = 159, + LITERAL_routersol = 160, + LITERAL_timex = 161, + LITERAL_paramprob = 162, + LITERAL_timereq = 163, + LITERAL_timerep = 164, + LITERAL_inforeq = 165, + LITERAL_inforep = 166, + LITERAL_maskreq = 167, + LITERAL_maskrep = 168, + LITERAL_trace = 169, + LITERAL_dataconv = 170, + LITERAL_mobredir = 171, + // "ipv6-where" = 172 + // "ipv6-here" = 173 + LITERAL_mobregreq = 174, + LITERAL_mobregrep = 175, + LITERAL_photuris = 176, + // "net-unr" = 177 + // "host-unr" = 178 + // "proto-unr" = 179 + // "port-unr" = 180 + LITERAL_needfrag = 181, + LITERAL_srcfail = 182, + // "net-unk" = 183 + // "host-unk" = 184 + LITERAL_isolate = 185, + // "net-prohib" = 186 + // "host-prohib" = 187 + // "net-tos" = 188 + // "host-tos" = 189 + // "filter-prohib" = 190 + // "host-preced" = 191 + // "cutoff-preced" = 192 + // "redir-net" = 193 + // "redir-host" = 194 + // "redir-tos-net" = 195 + // "redir-tos-host" = 196 + // "normal-adv" = 197 + // "common-adv" = 198 + LITERAL_transit = 199, + LITERAL_reassemb = 200, + LITERAL_badhead = 201, + LITERAL_optmiss = 202, + LITERAL_badlen = 203, + // "unknown-ind" = 204 + // "auth-fail" = 205 + // "decrypt-fail" = 206 + ICMP6_TYPE = 207, + TAGGED = 208, + TAG = 209, + KEEP = 210, + MODULATE = 211, + SYNPROXY = 212, + STATE = 213, + LABEL = 214, + EXIT = 215, + QUIT = 216, + INTRFACE = 217, + ICMP6 = 218, + IGRP = 219, + IPSEC = 220, + NOS = 221, + PCP = 222, + PIM = 223, + PPTP = 224, + RIP = 225, + SNP = 226, + HOST = 227, + RANGE = 228, + LOG_LEVEL_ALERTS = 229, + LOG_LEVEL_CRITICAL = 230, + LOG_LEVEL_DEBUGGING = 231, + LOG_LEVEL_EMERGENCIES = 232, + LOG_LEVEL_ERRORS = 233, + LOG_LEVEL_INFORMATIONAL = 234, + LOG_LEVEL_NOTIFICATIONS = 235, + LOG_LEVEL_WARNINGS = 236, + LOG_LEVEL_DISABLE = 237, + LOG_LEVEL_INACTIVE = 238, + Whitespace = 239, + HEX_CONST = 240, + NEG_INT_CONST = 241, + HEX_DIGIT = 242, + DIGIT = 243, + NUM_3DIGIT = 244, + NUM_HEX_4DIGIT = 245, + NUMBER_ADDRESS_OR_WORD = 246, + PIPE_CHAR = 247, + PERCENT = 248, + AMPERSAND = 249, + APOSTROPHE = 250, + PLUS = 251, + DOT = 252, + SEMICOLON = 253, + QUESTION = 254, + COMMERCIAL_AT = 255, + OPENING_SQUARE = 256, + CLOSING_SQUARE = 257, + CARET = 258, + UNDERLINE = 259, + TILDE = 260, + DOUBLE_QUOTE = 261, NULL_TREE_LOOKAHEAD = 3 }; #ifdef __cplusplus diff --git a/src/parsers/PFCfgParserTokenTypes.txt b/src/parsers/PFCfgParserTokenTypes.txt index ebacff9bf..f59bbc1cc 100644 --- a/src/parsers/PFCfgParserTokenTypes.txt +++ b/src/parsers/PFCfgParserTokenTypes.txt @@ -1,7 +1,7 @@ -// $ANTLR 2.7.7 (20090306): pf.g -> PFCfgParserTokenTypes.txt$ +// $ANTLR 2.7.7 (20100319): pf.g -> PFCfgParserTokenTypes.txt$ PFCfgParser // output token vocab name NEWLINE=4 -LINE_COMMENT=5 +COMMENT_START=5 INCLUDE_COMMAND="include"=6 WORD=7 EQUAL=8 @@ -134,126 +134,127 @@ FROM="from"=134 URPF_FAILED="urpf-failed"=135 ANY="any"=136 NO_ROUTE="no-route"=137 -ROUTE_TO="route-to"=138 -REPLY_TO="reply-to"=139 -GROUP="group"=140 -LITERAL_fragment="fragment"=141 -LITERAL_crop="crop"=142 -"drop-ovl"=143 -"no-df"=144 -"min-ttl"=145 -"max-mss"=146 -"random-id"=147 -FLAGS="flags"=148 -ICMP_TYPE="icmp-type"=149 -ICMP_CODE="code"=150 -LITERAL_echorep="echorep"=151 -LITERAL_unreach="unreach"=152 -LITERAL_squench="squench"=153 -LITERAL_redir="redir"=154 -LITERAL_althost="althost"=155 -LITERAL_echoreq="echoreq"=156 -LITERAL_routeradv="routeradv"=157 -LITERAL_routersol="routersol"=158 -LITERAL_timex="timex"=159 -LITERAL_paramprob="paramprob"=160 -LITERAL_timereq="timereq"=161 -LITERAL_timerep="timerep"=162 -LITERAL_inforeq="inforeq"=163 -LITERAL_inforep="inforep"=164 -LITERAL_maskreq="maskreq"=165 -LITERAL_maskrep="maskrep"=166 -LITERAL_trace="trace"=167 -LITERAL_dataconv="dataconv"=168 -LITERAL_mobredir="mobredir"=169 -"ipv6-where"=170 -"ipv6-here"=171 -LITERAL_mobregreq="mobregreq"=172 -LITERAL_mobregrep="mobregrep"=173 -LITERAL_photuris="photuris"=174 -"net-unr"=175 -"host-unr"=176 -"proto-unr"=177 -"port-unr"=178 -LITERAL_needfrag="needfrag"=179 -LITERAL_srcfail="srcfail"=180 -"net-unk"=181 -"host-unk"=182 -LITERAL_isolate="isolate"=183 -"net-prohib"=184 -"host-prohib"=185 -"net-tos"=186 -"host-tos"=187 -"filter-prohib"=188 -"host-preced"=189 -"cutoff-preced"=190 -"redir-net"=191 -"redir-host"=192 -"redir-tos-net"=193 -"redir-tos-host"=194 -"normal-adv"=195 -"common-adv"=196 -LITERAL_transit="transit"=197 -LITERAL_reassemb="reassemb"=198 -LITERAL_badhead="badhead"=199 -LITERAL_optmiss="optmiss"=200 -LITERAL_badlen="badlen"=201 -"unknown-ind"=202 -"auth-fail"=203 -"decrypt-fail"=204 -ICMP6_TYPE="icmp6-type"=205 -TAGGED="tagged"=206 -TAG="tag"=207 -KEEP="keep"=208 -MODULATE="modulate"=209 -SYNPROXY="synproxy"=210 -STATE="state"=211 -LABEL="label"=212 -EXIT="exit"=213 -QUIT="quit"=214 -INTRFACE="interface"=215 -ICMP6="icmp6"=216 -IGRP="igrp"=217 -IPSEC="ipsec"=218 -NOS="nos"=219 -PCP="pcp"=220 -PIM="pim"=221 -PPTP="pptp"=222 -RIP="rip"=223 -SNP="snp"=224 -HOST="host"=225 -RANGE="range"=226 -LOG_LEVEL_ALERTS="alerts"=227 -LOG_LEVEL_CRITICAL="critical"=228 -LOG_LEVEL_DEBUGGING="debugging"=229 -LOG_LEVEL_EMERGENCIES="emergencies"=230 -LOG_LEVEL_ERRORS="errors"=231 -LOG_LEVEL_INFORMATIONAL="informational"=232 -LOG_LEVEL_NOTIFICATIONS="notifications"=233 -LOG_LEVEL_WARNINGS="warnings"=234 -LOG_LEVEL_DISABLE="disable"=235 -LOG_LEVEL_INACTIVE="inactive"=236 -Whitespace=237 -HEX_CONST=238 -NEG_INT_CONST=239 -HEX_DIGIT=240 -DIGIT=241 -NUM_3DIGIT=242 -NUM_HEX_4DIGIT=243 -NUMBER_ADDRESS_OR_WORD=244 -PIPE_CHAR=245 -NUMBER_SIGN=246 -PERCENT=247 -AMPERSAND=248 -APOSTROPHE=249 -PLUS=250 -DOT=251 -SEMICOLON=252 -QUESTION=253 -COMMERCIAL_AT=254 -OPENING_SQUARE=255 -CLOSING_SQUARE=256 -CARET=257 -UNDERLINE=258 -TILDE=259 -DOUBLE_QUOTE=260 +MACRO=138 +ROUTE_TO="route-to"=139 +REPLY_TO="reply-to"=140 +DUP_TO="dup-to"=141 +GROUP="group"=142 +LITERAL_fragment="fragment"=143 +LITERAL_crop="crop"=144 +"drop-ovl"=145 +"no-df"=146 +"min-ttl"=147 +"max-mss"=148 +"random-id"=149 +FLAGS="flags"=150 +ICMP_TYPE="icmp-type"=151 +ICMP_CODE="code"=152 +LITERAL_echorep="echorep"=153 +LITERAL_unreach="unreach"=154 +LITERAL_squench="squench"=155 +LITERAL_redir="redir"=156 +LITERAL_althost="althost"=157 +LITERAL_echoreq="echoreq"=158 +LITERAL_routeradv="routeradv"=159 +LITERAL_routersol="routersol"=160 +LITERAL_timex="timex"=161 +LITERAL_paramprob="paramprob"=162 +LITERAL_timereq="timereq"=163 +LITERAL_timerep="timerep"=164 +LITERAL_inforeq="inforeq"=165 +LITERAL_inforep="inforep"=166 +LITERAL_maskreq="maskreq"=167 +LITERAL_maskrep="maskrep"=168 +LITERAL_trace="trace"=169 +LITERAL_dataconv="dataconv"=170 +LITERAL_mobredir="mobredir"=171 +"ipv6-where"=172 +"ipv6-here"=173 +LITERAL_mobregreq="mobregreq"=174 +LITERAL_mobregrep="mobregrep"=175 +LITERAL_photuris="photuris"=176 +"net-unr"=177 +"host-unr"=178 +"proto-unr"=179 +"port-unr"=180 +LITERAL_needfrag="needfrag"=181 +LITERAL_srcfail="srcfail"=182 +"net-unk"=183 +"host-unk"=184 +LITERAL_isolate="isolate"=185 +"net-prohib"=186 +"host-prohib"=187 +"net-tos"=188 +"host-tos"=189 +"filter-prohib"=190 +"host-preced"=191 +"cutoff-preced"=192 +"redir-net"=193 +"redir-host"=194 +"redir-tos-net"=195 +"redir-tos-host"=196 +"normal-adv"=197 +"common-adv"=198 +LITERAL_transit="transit"=199 +LITERAL_reassemb="reassemb"=200 +LITERAL_badhead="badhead"=201 +LITERAL_optmiss="optmiss"=202 +LITERAL_badlen="badlen"=203 +"unknown-ind"=204 +"auth-fail"=205 +"decrypt-fail"=206 +ICMP6_TYPE="icmp6-type"=207 +TAGGED="tagged"=208 +TAG="tag"=209 +KEEP="keep"=210 +MODULATE="modulate"=211 +SYNPROXY="synproxy"=212 +STATE="state"=213 +LABEL="label"=214 +EXIT="exit"=215 +QUIT="quit"=216 +INTRFACE="interface"=217 +ICMP6="icmp6"=218 +IGRP="igrp"=219 +IPSEC="ipsec"=220 +NOS="nos"=221 +PCP="pcp"=222 +PIM="pim"=223 +PPTP="pptp"=224 +RIP="rip"=225 +SNP="snp"=226 +HOST="host"=227 +RANGE="range"=228 +LOG_LEVEL_ALERTS="alerts"=229 +LOG_LEVEL_CRITICAL="critical"=230 +LOG_LEVEL_DEBUGGING="debugging"=231 +LOG_LEVEL_EMERGENCIES="emergencies"=232 +LOG_LEVEL_ERRORS="errors"=233 +LOG_LEVEL_INFORMATIONAL="informational"=234 +LOG_LEVEL_NOTIFICATIONS="notifications"=235 +LOG_LEVEL_WARNINGS="warnings"=236 +LOG_LEVEL_DISABLE="disable"=237 +LOG_LEVEL_INACTIVE="inactive"=238 +Whitespace=239 +HEX_CONST=240 +NEG_INT_CONST=241 +HEX_DIGIT=242 +DIGIT=243 +NUM_3DIGIT=244 +NUM_HEX_4DIGIT=245 +NUMBER_ADDRESS_OR_WORD=246 +PIPE_CHAR=247 +PERCENT=248 +AMPERSAND=249 +APOSTROPHE=250 +PLUS=251 +DOT=252 +SEMICOLON=253 +QUESTION=254 +COMMERCIAL_AT=255 +OPENING_SQUARE=256 +CLOSING_SQUARE=257 +CARET=258 +UNDERLINE=259 +TILDE=260 +DOUBLE_QUOTE=261 diff --git a/src/parsers/pf.g b/src/parsers/pf.g index 642fb9690..bac80da57 100644 --- a/src/parsers/pf.g +++ b/src/parsers/pf.g @@ -151,7 +151,18 @@ cfgfile : ; //**************************************************************** -comment : LINE_COMMENT ; +comment : + COMMENT_START + { + QStringList str; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + str << QString::fromUtf8(LT(1)->getText().c_str()); + consume(); + } + importer->last_comment << str.join(" "); + } + ; //**************************************************************** include_command : INCLUDE_COMMAND @@ -1182,7 +1193,7 @@ common_hosts_part : host { AddressSpec as; } : ( EXLAMATION { as.neg = true; } )? ( - WORD + ( WORD | MACRO ) { // interface name or domain/host name as.at = AddressSpec::INTERFACE_OR_HOST_NAME; @@ -1274,7 +1285,7 @@ host_list : // ************************************************************************ route : - route_to | reply_to + route_to | reply_to | dup_to ; route_to : @@ -1291,6 +1302,13 @@ reply_to : } ; +dup_to : + DUP_TO ( routehost | routehost_list ) + { + importer->route_type = PFImporter::DUP_TO; + } + ; + routehost { RouteSpec rs; } : OPENING_PAREN WORD { rs.iface = LT(0)->getText(); } @@ -1942,6 +1960,7 @@ tokens ROUTE_TO = "route-to"; REPLY_TO = "reply-to"; + DUP_TO = "dup-to"; DROP = "drop"; RETURN = "return"; @@ -1971,13 +1990,13 @@ tokens STATIC_PORT = "static-port"; } -LINE_COMMENT : "#" (~('\r' | '\n'))* NEWLINE ; +// LINE_COMMENT : "#" (~('\r' | '\n'))* NEWLINE ; Whitespace : ( '\003'..'\010' | '\t' | '\013' | '\f' | '\016'.. '\037' | '\177'..'\377' | ' ' ) { $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); } ; -//COMMENT_START : '!' ; +COMMENT_START : '#' ; NEWLINE : ( "\r\n" | '\r' | '\n' ) { newline(); } ; @@ -2042,21 +2061,21 @@ options { | ( DIGIT )+ { $setType(INT_CONST); } -// making sure ',' '(' ')' '=' '<' '>' '+' are not part of WORD do -// not start WORD with '$' since we expand macros in PFImporterRun -// using regex. -// double quote " should be included, without it STRING does not match +// Making sure ',' '(' ')' '=' '<' '>' '+' are not part of WORD. +// Double quote " should be included, without it STRING does not match | ( 'a'..'z' | 'A'..'Z' ) ( '"' | '$' | '%' | '&' | '-' | '.' | '0'..'9' | ';' | '?' | '@' | 'A'..'Z' | '\\' | '^' | '_' | '`' | 'a'..'z' )* { $setType(WORD); } + + | '$' ( 'a'..'z' | 'A'..'Z' ) ( 'a'..'z' | 'A'..'Z' | '0'..'9' | '_' )* + { $setType(MACRO); } ; STRING : '"' (~'"')* '"'; PIPE_CHAR : '|'; -NUMBER_SIGN : '#' ; // DOLLAR : '$' ; PERCENT : '%' ; AMPERSAND : '&' ; diff --git a/src/pflib/RoutingCompiler_openbsd.cpp b/src/pflib/RoutingCompiler_openbsd.cpp index 95650b5aa..36624b253 100644 --- a/src/pflib/RoutingCompiler_openbsd.cpp +++ b/src/pflib/RoutingCompiler_openbsd.cpp @@ -207,6 +207,9 @@ void RoutingCompiler_openbsd::compile() add(new addressRangesInDst("process address ranges")); + add( new processMultiAddressObjectsInRDst( + "process MultiAddress objects in RDst") ); + //add(new eliminateDuplicatesInDST("Eliminate duplicates in DST")); add(new FindDefaultRoute("Find rules that install default route")); diff --git a/src/unit_tests/CustomServiceDialogTest/CustomServiceDialogTest.cpp b/src/unit_tests/CustomServiceDialogTest/CustomServiceDialogTest.cpp index b9caf4a20..93a495669 100644 --- a/src/unit_tests/CustomServiceDialogTest/CustomServiceDialogTest.cpp +++ b/src/unit_tests/CustomServiceDialogTest/CustomServiceDialogTest.cpp @@ -182,10 +182,10 @@ void CustomServiceDialogTest::testDialog() selectComboItem(platform, "iptables"); dialog->platformChanged(); QTest::mouseClick(ipv6, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); - QVERIFY(service->getAddressFamily() == 10); + QVERIFY(service->getAddressFamily() == AF_INET6); selectComboItem(platform, "PF"); dialog->platformChanged(); - QVERIFY(service->getAddressFamily() == 10); + QVERIFY(service->getAddressFamily() == AF_INET6); // testing that changing address family does not change platform code foreach (QString key, platforms.keys()) @@ -193,11 +193,11 @@ void CustomServiceDialogTest::testDialog() string oldcode = service->getCodeForPlatform(key.toStdString().c_str()); string oldprotocol = service->getProtocol(); QTest::mouseClick(ipv4, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); - QVERIFY(service->getAddressFamily() == 2); + QVERIFY(service->getAddressFamily() == AF_INET); QVERIFY(oldcode == service->getCodeForPlatform(key.toStdString().c_str())); QVERIFY(oldprotocol == service->getProtocol()); QTest::mouseClick(ipv6, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); - QVERIFY(service->getAddressFamily() == 10); + QVERIFY(service->getAddressFamily() == AF_INET6); QVERIFY(oldcode == service->getCodeForPlatform(key.toStdString().c_str())); QVERIFY(oldprotocol == service->getProtocol()); } diff --git a/src/unit_tests/PFImporterTest/PFImporterTest.cpp b/src/unit_tests/PFImporterTest/PFImporterTest.cpp index a3efeeb6d..e9f6b2aaa 100644 --- a/src/unit_tests/PFImporterTest/PFImporterTest.cpp +++ b/src/unit_tests/PFImporterTest/PFImporterTest.cpp @@ -212,6 +212,7 @@ void PFImporterTest::macrosTest() openTestFile("test_data/pf-macros.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -230,6 +231,7 @@ void PFImporterTest::hostsMatchTest() openTestFile("test_data/pf-hosts-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -251,6 +253,7 @@ void PFImporterTest::blockReturnTest() openTestFile("test_data/pf-block-return-actions.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -272,6 +275,7 @@ void PFImporterTest::icmpMatchTest() openTestFile("test_data/pf-icmp-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -293,6 +297,7 @@ void PFImporterTest::interfaceMatchTest() openTestFile("test_data/pf-interface-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -314,6 +319,7 @@ void PFImporterTest::portMatchTest() openTestFile("test_data/pf-port-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -335,6 +341,7 @@ void PFImporterTest::setCommandsTest() openTestFile("test_data/pf-set-commands.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -356,6 +363,7 @@ void PFImporterTest::stateMatchTest() openTestFile("test_data/pf-state-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -377,6 +385,7 @@ void PFImporterTest::tcpFlagsMatchTest() openTestFile("test_data/pf-tcp-flags-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -398,6 +407,7 @@ void PFImporterTest::natCommands() openTestFile("test_data/pf-nat-rules.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -419,6 +429,7 @@ void PFImporterTest::rdrCommands() openTestFile("test_data/pf-rdr-rules.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -440,6 +451,7 @@ void PFImporterTest::setTimeoutCommands() openTestFile("test_data/pf-timeouts.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -459,6 +471,7 @@ void PFImporterTest::scrubCommandsOld() openTestFile("test_data/pf-scrub-commands-old.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -475,6 +488,7 @@ void PFImporterTest::scrubCommandsNew() openTestFile("test_data/pf-scrub-commands-new.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -491,6 +505,7 @@ void PFImporterTest::tableDefinitions() openTestFile("test_data/pf-tables.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -510,6 +525,7 @@ void PFImporterTest::userGroupMatches() openTestFile("test_data/pf-user-group-matches.conf")); Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); CPPUNIT_ASSERT_NO_THROW( imp->run() ); imp->finalize(); @@ -523,6 +539,25 @@ void PFImporterTest::userGroupMatches() "pf-user-group-matches.fwb"); } +void PFImporterTest::routeToTest() +{ + platform = "pf"; + + std::istringstream instream( + openTestFile("test_data/pf-route-to.conf")); + + Importer* imp = new PFImporter(lib, instream, logger, "test_fw"); + imp->setAddStandardCommentsFlag(true); + CPPUNIT_ASSERT_NO_THROW( imp->run() ); + imp->finalize(); + + db->setPredictableIds(); + db->saveFile("pf-route-to.fwb"); + + compareResults(logger, "test_data/pf-route-to.output", "pf-route-to.output"); + compareFwbFiles("test_data/pf-route-to.fwb", "pf-route-to.fwb"); +} + diff --git a/src/unit_tests/PFImporterTest/PFImporterTest.h b/src/unit_tests/PFImporterTest/PFImporterTest.h index 5b838c5c2..518a9b5bb 100644 --- a/src/unit_tests/PFImporterTest/PFImporterTest.h +++ b/src/unit_tests/PFImporterTest/PFImporterTest.h @@ -74,6 +74,7 @@ public: void scrubCommandsNew(); void tableDefinitions(); void userGroupMatches(); + void routeToTest(); CPPUNIT_TEST_SUITE(PFImporterTest); @@ -93,6 +94,7 @@ public: CPPUNIT_TEST(scrubCommandsNew); CPPUNIT_TEST(tableDefinitions); CPPUNIT_TEST(userGroupMatches); + CPPUNIT_TEST(routeToTest); CPPUNIT_TEST_SUITE_END(); diff --git a/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.fwb b/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.fwb index ed1bb8806..785cdf03f 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.fwb +++ b/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.fwb @@ -1,6 +1,6 @@ - + @@ -442,62 +442,68 @@ - + + + + + + + - + - - - + + + - - - + + + - + - - - - - - - - + + + + + + + + - + - - - - - - - - - + + + + + + + + + - - - - + + + + - - - + + + - - + + - + - + @@ -512,12 +518,12 @@ - + - + @@ -533,12 +539,12 @@ - + - + - + @@ -554,12 +560,12 @@ - + - + - + @@ -575,7 +581,7 @@ - + @@ -595,12 +601,12 @@ - + - + @@ -615,15 +621,15 @@ - + - + - + @@ -635,15 +641,15 @@ - + - + - + @@ -655,7 +661,7 @@ - + @@ -663,7 +669,7 @@ - + @@ -675,15 +681,15 @@ - + - + - + @@ -695,7 +701,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -715,15 +801,15 @@ - + - + - + @@ -735,104 +821,15 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -844,7 +841,7 @@ - + @@ -865,7 +862,7 @@ - + @@ -885,7 +882,7 @@ - + @@ -905,9 +902,9 @@ - + - + @@ -925,15 +922,15 @@ - + - + - + @@ -945,15 +942,15 @@ - + - + - + @@ -965,7 +962,7 @@ - + @@ -973,7 +970,7 @@ - + @@ -985,15 +982,15 @@ - + - + - + @@ -1005,7 +1002,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1025,15 +1102,15 @@ - + - + - + @@ -1045,104 +1122,15 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1154,7 +1142,7 @@ - + @@ -1175,7 +1163,7 @@ - + @@ -1197,12 +1185,12 @@ - + - + - + @@ -1222,7 +1210,7 @@ - - + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.output b/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.output index 8e1ecc712..385f2a480 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.output +++ b/src/unit_tests/PFImporterTest/test_data/pf-hosts-matches.output @@ -1,8 +1,9 @@ -5: Address Table: : 192.168.1.1/, 192.168.1.2/, 192.168.2.0/24 +2: Address Table: : 10.123.12.32/27, 10.123.14.8/27, 10.123.10.16/28, 10.123.0.0/24 +5: Address Table: : 192.168.1.1, 192.168.1.2, 192.168.2.0/24 +6: Address Table: : pcn0, pcn0 6: New interface: pcn0 -6: Address Table: : pcn0/, pcn0/ -7: Address Table: : pcn0/, pcn0/ -8: Address Table: : www.fwbuilder.org/, www.netcitadel.com/ +7: Address Table: : pcn0, pcn0 +8: Address Table: : www.fwbuilder.org, www.netcitadel.com 11: filtering rule: action pass; interfaces: 12: filtering rule: action pass; interfaces: 12: Error: import of 'interface:broadcast' is not supported. diff --git a/src/unit_tests/PFImporterTest/test_data/pf-macros.conf b/src/unit_tests/PFImporterTest/test_data/pf-macros.conf index 5a47e80f8..5e695ff87 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-macros.conf +++ b/src/unit_tests/PFImporterTest/test_data/pf-macros.conf @@ -1,11 +1,20 @@ one_address = 10.1.1.1 # comment is allowed here addr_list_1 = "{ 10.123.12.32/27 10.123.14.8/27 10.123.10.16/28 10.123.0.0/24 }" -# another macro is used inside this one recursively +# another macro is used inside this one recursively and only {} are in quotes addr_list_2 = "{" $one_address 10.123.12.32/27 10.123.14.8/27 10.123.10.16/28 10.123.0.0/24 "}" +# now use comma as a separator +addr_list_3 = "{" $one_address, 10.123.12.33/27, 10.123.14.9/27 "}" +# spaces are mixed with tabs and messed up +addr_list_4 = "{$one_address, 10.123.12.34/27, 10.123.14.10/27}" + +# multi-line +addr_list_5 = "{$one_address, \ + 10.123.12.35/27,\ + 10.123.14.11/27}" + # another macro name is a substring of this one's name addr_list_1_foo = "{ 10.1.2.3 10.4.5.6 10.7.8.9 }" -baddies = "{" 192.168.1.1 192.168.1.2 "}" # this works, too host1 = "192.168.1.1" host2 = "192.168.1.2" @@ -13,6 +22,14 @@ recursive_macro = "{" $host1 $host2 "}" tcp_services = "{ ssh, smtp }" ext_if = "em1" +mixed_macro_1 = "{ $host1 192.168.2.1 www.fwbuilder.org }" +mixed_macro_2 = "{ $host1 192.168.2.1 em1 }" +mixed_macro_3 = "{ $host1 192.168.2.1 em1:network }" +mixed_macro_4 = "{ em1:network www.fwbuilder.org }" + +# test for an undefined macro +# undefined_macro = 192.168.23.45 + pass in quick from any to $one_address pass in quick from any to { 10.11.11.11 $one_address } @@ -26,8 +43,17 @@ pass in quick from any to {$one_address , 10.18.18.18 } pass in quick from any to $addr_list_1 pass in quick from any to $addr_list_2 +pass in quick from any to $addr_list_3 +pass in quick from any to $addr_list_4 +pass in quick from any to $addr_list_5 pass in quick from any to $addr_list_1_foo -block in from $baddies to any +# test for undefined macro +pass in quick from any to $undefined_macro pass out quick on $ext_if proto tcp to $recursive_macro port $tcp_services + +pass in quick on $ext_if proto tcp from any to $mixed_macro_1 port 80 +pass in quick on $ext_if proto tcp from any to $mixed_macro_2 port 80 +pass in quick on $ext_if proto tcp from any to $mixed_macro_3 port 80 +pass in quick on $ext_if proto tcp from any to $mixed_macro_4 port 80 diff --git a/src/unit_tests/PFImporterTest/test_data/pf-macros.fwb b/src/unit_tests/PFImporterTest/test_data/pf-macros.fwb index d15fbad12..c640f050d 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-macros.fwb +++ b/src/unit_tests/PFImporterTest/test_data/pf-macros.fwb @@ -1,6 +1,6 @@ - + @@ -432,53 +432,117 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + - - - - + + + + - - - + + + - - + + @@ -498,139 +562,13 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -645,60 +583,13 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -713,13 +604,54 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -735,13 +667,13 @@ - + - - + - + + @@ -756,20 +688,283 @@ - + - + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -780,11 +975,12 @@ - + - + + @@ -804,7 +1000,7 @@ - - + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-macros.output b/src/unit_tests/PFImporterTest/test_data/pf-macros.output index 2320785a8..750373ebb 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-macros.output +++ b/src/unit_tests/PFImporterTest/test_data/pf-macros.output @@ -1,15 +1,33 @@ -16: filtering rule: action pass; interfaces: -18: filtering rule: action pass; interfaces: -19: filtering rule: action pass; interfaces: -20: filtering rule: action pass; interfaces: -21: filtering rule: action pass; interfaces: -22: filtering rule: action pass; interfaces: -23: filtering rule: action pass; interfaces: -24: filtering rule: action pass; interfaces: -25: filtering rule: action pass; interfaces: -27: filtering rule: action pass; interfaces: -28: filtering rule: action pass; interfaces: -29: filtering rule: action pass; interfaces: -31: filtering rule: action block; interfaces: -33: New interface: em1 -33: filtering rule: action pass; interfaces: em1 +Warning: Macro undefined_macro is undefined3: Address Table: : 10.123.12.32/27, 10.123.14.8/27, 10.123.10.16/28, 10.123.0.0/24 +5: Address Table: : 10.1.1.1, 10.123.12.32/27, 10.123.14.8/27, 10.123.10.16/28, 10.123.0.0/24 +7: Address Table: : 10.1.1.1, 10.123.12.33/27, 10.123.14.9/27 +9: Address Table: : 10.1.1.1, 10.123.12.34/27, 10.123.14.10/27 +12: Address Table: : 10.1.1.1, 10.123.12.35/27, 10.123.14.11/27 +15: Address Table: : 10.1.2.3, 10.4.5.6, 10.7.8.9 +19: Address Table: : 192.168.1.1, 192.168.1.2 +23: Address Table: : 192.168.1.1, 192.168.2.1, www.fwbuilder.org +24: Address Table: : 192.168.1.1, 192.168.2.1, em1 +24: New interface: em1 +25: Address Table: : 192.168.1.1, 192.168.2.1, em1 +31: filtering rule: action pass; interfaces: +33: filtering rule: action pass; interfaces: +34: filtering rule: action pass; interfaces: +35: filtering rule: action pass; interfaces: +36: filtering rule: action pass; interfaces: +37: filtering rule: action pass; interfaces: +38: filtering rule: action pass; interfaces: +39: filtering rule: action pass; interfaces: +40: filtering rule: action pass; interfaces: +42: filtering rule: action pass; interfaces: +43: filtering rule: action pass; interfaces: +44: filtering rule: action pass; interfaces: +45: filtering rule: action pass; interfaces: +46: filtering rule: action pass; interfaces: +47: filtering rule: action pass; interfaces: +50: filtering rule: action pass; interfaces: +50: Warning: Macro '$undefined_macro' was undefined, rule may be broken +52: filtering rule: action pass; interfaces: em1 +54: filtering rule: action pass; interfaces: em1 +55: filtering rule: action pass; interfaces: em1 +56: filtering rule: action pass; interfaces: em1 +57: filtering rule: action pass; interfaces: em1 diff --git a/src/unit_tests/PFImporterTest/test_data/pf-route-to.conf b/src/unit_tests/PFImporterTest/test_data/pf-route-to.conf new file mode 100644 index 000000000..122e45800 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-route-to.conf @@ -0,0 +1,7 @@ + +pass in log quick route-to { ( em0 10.1.2.3 ) } inet from 192.168.1.0/24 to any + +pass in quick on bce0 reply-to ( bce0 10.3.4.5 ) inet from 192.168.1.0/24 to any + +pass out quick on bce0 dup-to (em0 10.1.2.3) proto tcp from any port 80 to any + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-route-to.fwb b/src/unit_tests/PFImporterTest/test_data/pf-route-to.fwb new file mode 100644 index 000000000..df4edbff1 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-route-to.fwb @@ -0,0 +1,566 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-route-to.output b/src/unit_tests/PFImporterTest/test_data/pf-route-to.output new file mode 100644 index 000000000..e5fffa2dc --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-route-to.output @@ -0,0 +1,5 @@ +2: New interface: em0 +2: filtering rule: action pass; interfaces: +4: New interface: bce0 +4: filtering rule: action pass; interfaces: bce0 +6: filtering rule: action pass; interfaces: bce0 diff --git a/src/unit_tests/PFImporterTest/test_data/pf-tables.conf b/src/unit_tests/PFImporterTest/test_data/pf-tables.conf index 85b430f7d..baf82a3da 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-tables.conf +++ b/src/unit_tests/PFImporterTest/test_data/pf-tables.conf @@ -10,3 +10,9 @@ table { 192.168.1.1, 192.168.1.2, 192.168.2.0/24 } table { pcn0, pcn0:network } table { pcn0:peer, pcn0:0 } table { www.fwbuilder.org, www.netcitadel.com } + +# unsupported: this table has a mix of negated and non-negated addresses +table { 192.168.10.1, !192.168.10.2, 192.168.20.0/24 } + +# the rule should be marked as "broken" +pass in quick on em1 from to any diff --git a/src/unit_tests/PFImporterTest/test_data/pf-tables.fwb b/src/unit_tests/PFImporterTest/test_data/pf-tables.fwb index 34418c699..1d1ffc76a 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-tables.fwb +++ b/src/unit_tests/PFImporterTest/test_data/pf-tables.fwb @@ -1,6 +1,6 @@ - + @@ -434,75 +434,107 @@ + + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - + - + - - - + + + - - - + + + - + + + + + + - + - - - - - - + + + + + + + - + - - - - - - - - - + + + + + + + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + - @@ -522,7 +554,7 @@ - - + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-tables.output b/src/unit_tests/PFImporterTest/test_data/pf-tables.output index b2b47c996..5a1242668 100644 --- a/src/unit_tests/PFImporterTest/test_data/pf-tables.output +++ b/src/unit_tests/PFImporterTest/test_data/pf-tables.output @@ -7,10 +7,13 @@ 6: Address Table: file 7: Warning: attribute "const" will be dropped from table configuration since this attribute is not supported at this time 7: Address Table: : 10/8, 172.16/12, 192.168/16 -9: Address Table: : 192.168.1.1/, 192.168.1.2/, 192.168.2.0/24 +9: Address Table: : 192.168.1.1, 192.168.1.2, 192.168.2.0/24 +10: Address Table: : pcn0, pcn0 10: New interface: pcn0 -10: Address Table: : pcn0/, pcn0/ -11: Address Table: : pcn0/, pcn0/ -12: Address Table: : www.fwbuilder.org/, www.netcitadel.com/ -Could not find enough information in the data file to create any firewall rules. - +11: Address Table: : pcn0, pcn0 +12: Address Table: : www.fwbuilder.org, www.netcitadel.com +15: Address Table: : 192.168.10.1, !192.168.10.2, 192.168.20.0/24 +15: Error: import of table definition with negated addresses is not supported. +18: New interface: em1 +18: filtering rule: action pass; interfaces: em1 +18: Error: Address table 'dst_addresses_5' has a mix of negated and non-negated addresses in the original file. diff --git a/src/unit_tests/RuleSetViewContextMenuTest/RuleSetViewContextMenuTest.cpp b/src/unit_tests/RuleSetViewContextMenuTest/RuleSetViewContextMenuTest.cpp index ebfd826c5..7b2895f94 100644 --- a/src/unit_tests/RuleSetViewContextMenuTest/RuleSetViewContextMenuTest.cpp +++ b/src/unit_tests/RuleSetViewContextMenuTest/RuleSetViewContextMenuTest.cpp @@ -52,6 +52,7 @@ using namespace libfwbuilder; void RuleSetViewContextMenuTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->move(0,0); @@ -60,7 +61,6 @@ void RuleSetViewContextMenuTest::initTestCase() else mw->resize(1024, 768); mw->startupLoad(); - new FWObjectClipboard(); StartTipDialog *d = mw->findChild(); if (d!=NULL) d->close(); om = dynamic_cast(mw->getCurrentObjectTree()->parent()->parent()); diff --git a/src/unit_tests/RuleSetViewTest/RuleSetViewTest.cpp b/src/unit_tests/RuleSetViewTest/RuleSetViewTest.cpp index 7ca792320..44d5a2103 100644 --- a/src/unit_tests/RuleSetViewTest/RuleSetViewTest.cpp +++ b/src/unit_tests/RuleSetViewTest/RuleSetViewTest.cpp @@ -49,11 +49,11 @@ using namespace libfwbuilder; void RuleSetViewTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->resize(QSize(800,600)); mw->startupLoad(); - new FWObjectClipboard(); StartTipDialog *d = mw->findChild(); if (d) if (d!=NULL) d->close(); om = dynamic_cast(mw->getCurrentObjectTree()->parent()->parent()); diff --git a/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest b/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest index e9e325fa5..b9e8fcf88 100755 --- a/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest +++ b/src/unit_tests/commandLinePrintingTest/commandLinePrintingTest @@ -1,47 +1,46 @@ -#!/bin/bash +#!/bin/sh rm -f print.pdf >/dev/null 2>/dev/null -QTVERSION=`qmake --version | tail -n1| cut -d' ' -f4` -TESTNAME=$(basename `pwd`) +QTVERSION=$(${QMAKE:-qmake} --version 2>&1 | tail -n1| cut -d' ' -f4) +TESTNAME=${0##/} PASSED=0 FAILED=0 SKIPPED=0 -function pass # test_name +pass() # test_name { echo "PASS : ${TESTNAME}::$1()" PASSED=$((PASSED+1)) } -function fail # test_name +fail() # test_name { echo "FAIL! : ${TESTNAME}::$1()" FAILED=$((FAILED+1)) } -function output # test_name text +output() # test_name text { echo -n "QDEBUG : ${TESTNAME}::$1() " shift echo $@ } -function run_command # test_name command +run_command() # test_name command { test=$1 shift - command=$@ - output=$($command 2>&1) + output=$("$@" 2>&1) returned=$? ORIGIFS=$IFS - IFS=`echo -en "\n\b"` + IFS=`printf "\n\b"` for line in $output do output $test $line done IFS=$ORIGIFS - [ $returned -eq 0 ] && pass $test || fail $test + [ "$returned" -eq 0 ] && pass "$test" || fail "$test" } @@ -51,8 +50,8 @@ pass "initTestCase" # -------- actual testing goes here -------- -run_command "runPrinting" "../../gui/fwbuilder -f test.fwb -P test" -run_command "fileExists" "ls print.pdf" +run_command "runPrinting" ../../gui/fwbuilder -f test.fwb -P test +run_command "fileExists" ls print.pdf # --------- end of actual testing --------- @@ -61,4 +60,4 @@ rm -f print.pdf >/dev/null 2>&1 pass "cleanupTestCase" echo "Totals: ${PASSED} passed, ${FAILED} failed, ${SKIPPED} skipped" echo "********* Finished testing of ${TESTNAME} *********" -[ ${FAILED} -eq 0 ] && exit 0 || exit 1 +[ "${FAILED}" -eq 0 ] && exit 0 || exit 1 diff --git a/src/unit_tests/instDialogClusterTest/instDialogClusterTest.cpp b/src/unit_tests/instDialogClusterTest/instDialogClusterTest.cpp index a30f7f0e8..b22782e8e 100644 --- a/src/unit_tests/instDialogClusterTest/instDialogClusterTest.cpp +++ b/src/unit_tests/instDialogClusterTest/instDialogClusterTest.cpp @@ -77,11 +77,11 @@ using namespace libfwbuilder; void instDialogClusterTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); wfl = new UserWorkflow(); mw->show(); mw->loadFile("test_work.fwb", false); - new FWObjectClipboard(); } void instDialogClusterTest::openPolicy(QString fwname) diff --git a/src/unit_tests/instDialogCompileTest/instDialogCompileTest.cpp b/src/unit_tests/instDialogCompileTest/instDialogCompileTest.cpp index 42d9b98f1..2341fedbe 100644 --- a/src/unit_tests/instDialogCompileTest/instDialogCompileTest.cpp +++ b/src/unit_tests/instDialogCompileTest/instDialogCompileTest.cpp @@ -54,10 +54,10 @@ using namespace libfwbuilder; void instDialogCompileTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->loadFile("test_work.fwb", false); - new FWObjectClipboard(); } bool checkProgress(QTreeWidget *list) diff --git a/src/unit_tests/instDialogInspectTest/instDialogInspectTest.cpp b/src/unit_tests/instDialogInspectTest/instDialogInspectTest.cpp index dd1bd5f5e..0c38a5874 100644 --- a/src/unit_tests/instDialogInspectTest/instDialogInspectTest.cpp +++ b/src/unit_tests/instDialogInspectTest/instDialogInspectTest.cpp @@ -57,10 +57,10 @@ bool checkProgress(QTreeWidget *list) void instDialogInspectTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->loadFile("test_work.fwb", false); - new FWObjectClipboard(); dialogClosed = false; om = mw->findChild("om"); tree = mw->activeProject()->getCurrentObjectTree(); diff --git a/src/unit_tests/instDialogInstallTest/instDialogInstallTest.cpp b/src/unit_tests/instDialogInstallTest/instDialogInstallTest.cpp index 448a6337c..ce7e9ed01 100644 --- a/src/unit_tests/instDialogInstallTest/instDialogInstallTest.cpp +++ b/src/unit_tests/instDialogInstallTest/instDialogInstallTest.cpp @@ -128,10 +128,10 @@ bool checkProgress(QTreeWidget *list) void instDialogInstallTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->loadFile("test_work.fwb", false); - new FWObjectClipboard(); ssh_auth_sock = getenv("SSH_AUTH_SOCK"); } diff --git a/src/unit_tests/instDialogObjectListTest/instDialogObjectListTest.cpp b/src/unit_tests/instDialogObjectListTest/instDialogObjectListTest.cpp index f41b2d9eb..7b4eb0137 100644 --- a/src/unit_tests/instDialogObjectListTest/instDialogObjectListTest.cpp +++ b/src/unit_tests/instDialogObjectListTest/instDialogObjectListTest.cpp @@ -105,10 +105,10 @@ using namespace libfwbuilder; void instDialogObjectListTest::initTestCase() { + new FWObjectClipboard(); mw = new FWWindow(); mw->show(); mw->loadFile("test_work.fwb", false); - new FWObjectClipboard(); } void instDialogObjectListTest::openPolicy(QString fwname) diff --git a/src/unit_tests/main/main.cpp b/src/unit_tests/main/main.cpp index 436eb2a56..dbf93d0d6 100644 --- a/src/unit_tests/main/main.cpp +++ b/src/unit_tests/main/main.cpp @@ -25,6 +25,7 @@ #include "FWBSettings.h" #include "FWBApplication.h" #include "UserWorkflow.h" +#include "FWObjectClipboard.h" #include "common/commoninit.h" diff --git a/test/ipt/rc.firewall.local b/test/ipt/rc.firewall.local index 476684bb2..8175a6781 100755 --- a/test/ipt/rc.firewall.local +++ b/test/ipt/rc.firewall.local @@ -2,9 +2,9 @@ # # This is automatically generated file. DO NOT MODIFY ! # -# Firewall Builder fwb_ipt v5.0.0.3556 +# Firewall Builder fwb_ipt v5.0.0.3557 # -# Generated Tue Jul 5 18:03:29 2011 PDT by vadim +# Generated Wed Jul 6 17:48:03 2011 PDT by vadim # # files: * rc.firewall.local /etc/rc.d//rc.firewall.local # diff --git a/test/pf/pf_cluster_4_rc.conf.local b/test/pf/pf_cluster_4_rc.conf.local index af28ee0d1..523b35c73 100755 --- a/test/pf/pf_cluster_4_rc.conf.local +++ b/test/pf/pf_cluster_4_rc.conf.local @@ -1,9 +1,9 @@ # # This is automatically generated file. DO NOT MODIFY ! # -# Firewall Builder fwb_pf v5.0.0.3556 +# Firewall Builder fwb_pf v5.0.0.3557 # -# Generated Tue Jul 5 18:05:39 2011 PDT by vadim +# Generated Wed Jul 6 17:49:01 2011 PDT by vadim # # files: * pf_cluster_4_rc.conf.local /etc/pf_cluster_4_rc.conf.local # files: pf_cluster_4_pf.conf /etc/pf_cluster_4_pf.conf