1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-23 11:47:24 +01:00

* Importer.cpp (ignoreCurrentInterface): see #2152 "ASA Import -

shutdown interfaces". Importer recognizes and skips ASA interfaces
in "shutdown" mode.
This commit is contained in:
Vadim Kurland 2011-03-06 21:27:28 -08:00
parent 69d277ce41
commit 85291843f5
11 changed files with 490 additions and 410 deletions

View File

@ -1,5 +1,9 @@
2011-03-06 vadim <vadim@netcitadel.com>
* Importer.cpp (ignoreCurrentInterface): see #2152 "ASA Import -
shutdown interfaces". Importer recognizes and skips ASA interfaces
in "shutdown" mode.
* IPTImporter.cpp (pushNATRule): see #2181 "Update iptables
importer to detect inbound & outbound interfaces in NAT rules".
Importer can now import nat rules with "-i" or "-o" interface spec.

View File

@ -298,6 +298,20 @@ FWObject* IOSImporter::createUDPService()
return getUDPService(srs,sre,drs,dre);
}
void IOSImporter::ignoreCurrentInterface()
{
if (current_interface)
{
Importer::ignoreCurrentInterface();
QString err("Warning: interface %1 was not imported because it "
"is in \"shutdown\" mode\n");
*Importer::logger <<
err.arg(current_interface->getName().c_str()).toStdString();
}
}
void IOSImporter::merge_rule::operator()(FWObject* r)
{
PolicyRule *rule = PolicyRule::cast(r);

View File

@ -56,7 +56,7 @@ class IOSImporter : public Importer
const std::string &port_spec,
const std::string &proto);
public:
public:
IOSImporter(libfwbuilder::FWObject *lib,
std::istringstream &input,
@ -70,6 +70,8 @@ class IOSImporter : public Importer
const std::string &interface_name,
const std::string &dir);
virtual void ignoreCurrentInterface();
// this method actually adds interfaces to the firewall object
// and does final clean up.
virtual libfwbuilder::Firewall* finalize();

View File

@ -266,6 +266,20 @@ void Importer::newInterface(const std::string &name)
*logger << "New interface: " + name + "\n";
}
/*
* We call this when importer for PIX or IOS encounters interface in
* state "shutdown"
*/
void Importer::ignoreCurrentInterface()
{
if (current_interface)
{
string name = current_interface->getName();
current_interface->getParent()->remove(current_interface);
all_interfaces.erase(name);
}
}
void Importer::addAddressObjectToInterface(Interface*intf,
const string &addr,
const string &netm)

View File

@ -279,6 +279,7 @@ public:
virtual void setHostName(const std::string &hn);
virtual void newInterface(const std::string &interface_name);
virtual void clearCurrentInterface() { current_interface = NULL; }
virtual void ignoreCurrentInterface();
virtual void addInterfaceAddress(const std::string &a,
const std::string &nm);
virtual void addInterfaceAddress(const std::string &label,

View File

@ -46,51 +46,52 @@ PIXCfgLexer::PIXCfgLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState&
void PIXCfgLexer::initLiterals()
{
literals["host"] = 28;
literals["setroute"] = 54;
literals["log"] = 31;
literals["access-list"] = 16;
literals["interface"] = 37;
literals["standby"] = 46;
literals["remark"] = 42;
literals["certificate"] = 9;
literals["exit"] = 50;
literals["udp"] = 22;
literals["tcp"] = 21;
literals["controller"] = 36;
literals["eq"] = 23;
literals["host"] = 29;
literals["setroute"] = 55;
literals["log"] = 32;
literals["access-list"] = 17;
literals["interface"] = 38;
literals["standby"] = 47;
literals["remark"] = 43;
literals["certificate"] = 10;
literals["exit"] = 51;
literals["udp"] = 23;
literals["tcp"] = 22;
literals["controller"] = 37;
literals["eq"] = 24;
literals["crypto"] = 8;
literals["ip"] = 5;
literals["access-group"] = 49;
literals["time-range"] = 35;
literals["access-group"] = 50;
literals["time-range"] = 36;
literals["community-list"] = 7;
literals["icmp"] = 20;
literals["description"] = 41;
literals["Version"] = 12;
literals["nameif"] = 40;
literals["security-level"] = 39;
literals["secondary"] = 53;
literals["access"] = 48;
literals["lt"] = 25;
literals["range"] = 27;
literals["switchport"] = 47;
literals["log-input"] = 32;
literals["standard"] = 56;
literals["gt"] = 24;
literals["permit"] = 18;
literals["extended"] = 55;
literals["address"] = 44;
literals["established"] = 33;
literals["dhcp"] = 45;
literals["neq"] = 26;
literals["icmp"] = 21;
literals["description"] = 42;
literals["Version"] = 13;
literals["nameif"] = 41;
literals["security-level"] = 40;
literals["secondary"] = 54;
literals["access"] = 49;
literals["lt"] = 26;
literals["range"] = 28;
literals["switchport"] = 48;
literals["log-input"] = 33;
literals["standard"] = 57;
literals["gt"] = 25;
literals["permit"] = 19;
literals["extended"] = 56;
literals["address"] = 45;
literals["established"] = 34;
literals["dhcp"] = 46;
literals["neq"] = 27;
literals["quit"] = 6;
literals["vlan"] = 38;
literals["any"] = 30;
literals["deny"] = 19;
literals["shutdown"] = 43;
literals["hostname"] = 14;
literals["PIX"] = 10;
literals["ASA"] = 11;
literals["fragments"] = 34;
literals["vlan"] = 39;
literals["any"] = 31;
literals["deny"] = 20;
literals["shutdown"] = 44;
literals["hostname"] = 15;
literals["PIX"] = 11;
literals["ASA"] = 12;
literals["fragments"] = 35;
}
ANTLR_USE_NAMESPACE(antlr)RefToken PIXCfgLexer::nextToken()
@ -407,11 +408,11 @@ void PIXCfgLexer::mLINE_COMMENT(bool _createToken) {
}
}
else {
goto _loop88;
goto _loop89;
}
}
_loop88:;
_loop89:;
} // ( ... )*
mNEWLINE(false);
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
@ -443,9 +444,9 @@ void PIXCfgLexer::mNEWLINE(bool _createToken) {
}
if ( inputState->guessing==0 ) {
#line 786 "pix.g"
#line 798 "pix.g"
newline();
#line 449 "PIXCfgLexer.cpp"
#line 450 "PIXCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -469,11 +470,11 @@ void PIXCfgLexer::mCOLON_COMMENT(bool _createToken) {
}
}
else {
goto _loop92;
goto _loop93;
}
}
_loop92:;
_loop93:;
} // ( ... )*
mNEWLINE(false);
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
@ -567,9 +568,9 @@ void PIXCfgLexer::mWhitespace(bool _createToken) {
}
}
if ( inputState->guessing==0 ) {
#line 781 "pix.g"
#line 793 "pix.g"
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
#line 573 "PIXCfgLexer.cpp"
#line 574 "PIXCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -681,208 +682,208 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex;
{
bool synPredMatched111 = false;
bool synPredMatched112 = false;
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (_tokenSet_2.member(LA(4))) && (_tokenSet_2.member(LA(5))) && (_tokenSet_2.member(LA(6))) && (_tokenSet_2.member(LA(7))) && (true) && (true) && (true))) {
int _m111 = mark();
synPredMatched111 = true;
int _m112 = mark();
synPredMatched112 = true;
inputState->guessing++;
try {
{
{ // ( ... )+
int _cnt106=0;
int _cnt107=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt106>=1 ) { goto _loop106; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt107>=1 ) { goto _loop107; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt106++;
_cnt107++;
}
_loop106:;
_loop107:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt108=0;
int _cnt109=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt108>=1 ) { goto _loop108; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt109>=1 ) { goto _loop109; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt108++;
_cnt109++;
}
_loop108:;
_loop109:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt110=0;
int _cnt111=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt110>=1 ) { goto _loop110; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt111>=1 ) { goto _loop111; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt110++;
_cnt111++;
}
_loop110:;
_loop111:;
} // ( ... )+
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
synPredMatched111 = false;
synPredMatched112 = false;
}
rewind(_m111);
rewind(_m112);
inputState->guessing--;
}
if ( synPredMatched111 ) {
if ( synPredMatched112 ) {
{
{ // ( ... )+
int _cnt114=0;
int _cnt115=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt114>=1 ) { goto _loop114; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt115>=1 ) { goto _loop115; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt114++;
_cnt115++;
}
_loop114:;
_loop115:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt116=0;
int _cnt117=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt116>=1 ) { goto _loop116; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt117>=1 ) { goto _loop117; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt116++;
_cnt117++;
}
_loop116:;
_loop117:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt118=0;
int _cnt119=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt118>=1 ) { goto _loop118; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt119>=1 ) { goto _loop119; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt118++;
_cnt119++;
}
_loop118:;
_loop119:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt120=0;
int _cnt121=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt120>=1 ) { goto _loop120; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt121>=1 ) { goto _loop121; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt120++;
_cnt121++;
}
_loop120:;
_loop121:;
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 806 "pix.g"
#line 818 "pix.g"
_ttype = IPV4;
#line 809 "PIXCfgLexer.cpp"
#line 810 "PIXCfgLexer.cpp"
}
}
else {
bool synPredMatched126 = false;
bool synPredMatched127 = false;
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (true) && (true) && (true) && (true) && (true) && (true) && (true))) {
int _m126 = mark();
synPredMatched126 = true;
int _m127 = mark();
synPredMatched127 = true;
inputState->guessing++;
try {
{
{ // ( ... )+
int _cnt123=0;
int _cnt124=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt123>=1 ) { goto _loop123; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt124>=1 ) { goto _loop124; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt123++;
_cnt124++;
}
_loop123:;
_loop124:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt125=0;
int _cnt126=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt125>=1 ) { goto _loop125; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt126>=1 ) { goto _loop126; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt125++;
_cnt126++;
}
_loop125:;
_loop126:;
} // ( ... )+
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
synPredMatched126 = false;
synPredMatched127 = false;
}
rewind(_m126);
rewind(_m127);
inputState->guessing--;
}
if ( synPredMatched126 ) {
if ( synPredMatched127 ) {
{
{ // ( ... )+
int _cnt129=0;
int _cnt130=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt129>=1 ) { goto _loop129; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt130>=1 ) { goto _loop130; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt129++;
_cnt130++;
}
_loop129:;
_loop130:;
} // ( ... )+
mDOT(false);
{ // ( ... )+
int _cnt131=0;
int _cnt132=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt131>=1 ) { goto _loop131; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt132>=1 ) { goto _loop132; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt131++;
_cnt132++;
}
_loop131:;
_loop132:;
} // ( ... )+
}
}
@ -891,45 +892,45 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
match('0' /* charlit */ );
match('x' /* charlit */ );
{ // ( ... )+
int _cnt136=0;
int _cnt137=0;
for (;;) {
if ((_tokenSet_3.member(LA(1)))) {
mHEXDIGIT(false);
}
else {
if ( _cnt136>=1 ) { goto _loop136; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt137>=1 ) { goto _loop137; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt136++;
_cnt137++;
}
_loop136:;
_loop137:;
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 812 "pix.g"
#line 824 "pix.g"
_ttype = HEX_CONST;
#line 912 "PIXCfgLexer.cpp"
#line 913 "PIXCfgLexer.cpp"
}
}
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
{ // ( ... )+
int _cnt133=0;
int _cnt134=0;
for (;;) {
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
mDIGIT(false);
}
else {
if ( _cnt133>=1 ) { goto _loop133; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
if ( _cnt134>=1 ) { goto _loop134; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
}
_cnt133++;
_cnt134++;
}
_loop133:;
_loop134:;
} // ( ... )+
if ( inputState->guessing==0 ) {
#line 810 "pix.g"
#line 822 "pix.g"
_ttype = INT_CONST;
#line 933 "PIXCfgLexer.cpp"
#line 934 "PIXCfgLexer.cpp"
}
}
else {
@ -1190,11 +1191,11 @@ void PIXCfgLexer::mWORD(bool _createToken) {
}
default:
{
goto _loop140;
goto _loop141;
}
}
}
_loop140:;
_loop141:;
} // ( ... )*
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -1216,11 +1217,11 @@ void PIXCfgLexer::mSTRING(bool _createToken) {
matchNot('\"' /* charlit */ );
}
else {
goto _loop143;
goto _loop144;
}
}
_loop143:;
_loop144:;
} // ( ... )*
match('\"' /* charlit */ );
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
@ -1590,7 +1591,7 @@ const unsigned long PIXCfgLexer::_tokenSet_1_data_[] = { 4294958072UL, 429496729
// 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
// H I J K L M N O P Q R S T U V W X Y
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_1(_tokenSet_1_data_,16);
const unsigned long PIXCfgLexer::_tokenSet_2_data_[] = { 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
// . 0 1 2 3 4 5 6 7 8 9
@ -1602,6 +1603,6 @@ const unsigned long PIXCfgLexer::_tokenSet_4_data_[] = { 4294967288UL, 429496729
// 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
// G H I J K L M N O P Q R S T U V W X
// G H I J K L M N O P Q R S T U V W X Y
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_4(_tokenSet_4_data_,16);

View File

@ -130,6 +130,11 @@ void PIXCfgParser::cfgfile() {
quit();
break;
}
case CRYPTO:
{
crypto();
break;
}
case WORD:
{
unknown_command();
@ -216,13 +221,13 @@ void PIXCfgParser::version() {
match(VERSION_WORD);
match(NUMBER);
if ( inputState->guessing==0 ) {
#line 156 "pix.g"
#line 165 "pix.g"
importer->setDiscoveredVersion(LT(0)->getText());
*dbg << "VERSION " << LT(0)->getText() << std::endl;
consumeUntil(NEWLINE);
#line 226 "PIXCfgParser.cpp"
#line 231 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -258,14 +263,14 @@ void PIXCfgParser::hostname() {
}
}
if ( inputState->guessing==0 ) {
#line 165 "pix.g"
#line 174 "pix.g"
importer->setHostName( LT(0)->getText() );
*dbg << "HOSTNAME "
<< "LT0=" << LT(0)->getText()
<< std::endl;
#line 269 "PIXCfgParser.cpp"
#line 274 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -331,14 +336,14 @@ void PIXCfgParser::intrface() {
in = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 465 "pix.g"
#line 474 "pix.g"
importer->newInterface( in->getText() );
*dbg << in->getLine() << ":"
<< " INTRFACE: " << in->getText() << std::endl;
consumeUntil(NEWLINE);
#line 342 "PIXCfgParser.cpp"
#line 347 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -359,12 +364,12 @@ void PIXCfgParser::vlan_interface() {
vlan_id = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 474 "pix.g"
#line 483 "pix.g"
importer->setInterfaceVlanId(vlan_id->getText());
*dbg << " VLAN: " << vlan_id->getText() << std::endl;
#line 368 "PIXCfgParser.cpp"
#line 373 "PIXCfgParser.cpp"
}
match(NEWLINE);
}
@ -386,12 +391,12 @@ void PIXCfgParser::sec_level() {
sec_level = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 482 "pix.g"
#line 491 "pix.g"
importer->setInterfaceSecurityLevel(sec_level->getText());
*dbg << "SEC_LEVEL: " << sec_level->getText() << std::endl;
#line 395 "PIXCfgParser.cpp"
#line 400 "PIXCfgParser.cpp"
}
match(NEWLINE);
}
@ -437,7 +442,7 @@ void PIXCfgParser::nameif() {
}
}
if ( inputState->guessing==0 ) {
#line 490 "pix.g"
#line 499 "pix.g"
std::string label = (intf_label) ? intf_label->getText() : "";
std::string seclevel = (sec_level) ? sec_level->getText() : "";
@ -445,7 +450,7 @@ void PIXCfgParser::nameif() {
*dbg << " NAMEIF: "
<< phys_intf->getText() << label << seclevel << std::endl;
#line 449 "PIXCfgParser.cpp"
#line 454 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -463,12 +468,12 @@ void PIXCfgParser::controller() {
try { // for error handling
match(CONTROLLER);
if ( inputState->guessing==0 ) {
#line 419 "pix.g"
#line 428 "pix.g"
importer->clearCurrentInterface();
consumeUntil(NEWLINE);
#line 472 "PIXCfgParser.cpp"
#line 477 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -489,13 +494,13 @@ void PIXCfgParser::access_list_commands() {
acl_num = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 180 "pix.g"
#line 189 "pix.g"
importer->newUnidirRuleSet( std::string("acl_") + acl_num->getText() );
*dbg << acl_num->getLine() << ":"
<< " ACL #" << acl_num->getText() << " ";
#line 499 "PIXCfgParser.cpp"
#line 504 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -551,7 +556,7 @@ void PIXCfgParser::description() {
try { // for error handling
match(DESCRIPTION);
if ( inputState->guessing==0 ) {
#line 502 "pix.g"
#line 511 "pix.g"
*dbg << LT(1)->getLine() << ":";
std::string descr;
@ -564,7 +569,7 @@ void PIXCfgParser::description() {
*dbg << " DESCRIPTION " << descr << std::endl;
//consumeUntil(NEWLINE);
#line 568 "PIXCfgParser.cpp"
#line 573 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -582,12 +587,13 @@ void PIXCfgParser::shutdown() {
try { // for error handling
match(SHUTDOWN);
if ( inputState->guessing==0 ) {
#line 537 "pix.g"
#line 546 "pix.g"
importer->ignoreCurrentInterface();
*dbg<< LT(1)->getLine() << ":"
<< " INTERFACE SHUTDOWN " << std::endl;
#line 591 "PIXCfgParser.cpp"
#line 597 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -606,12 +612,12 @@ void PIXCfgParser::certificate() {
match(CERTIFICATE);
match(WORD);
if ( inputState->guessing==0 ) {
#line 148 "pix.g"
#line 157 "pix.g"
consumeUntil(NEWLINE);
consumeUntil(QUIT);
#line 615 "PIXCfgParser.cpp"
#line 621 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -629,11 +635,33 @@ void PIXCfgParser::quit() {
try { // for error handling
match(QUIT);
if ( inputState->guessing==0 ) {
#line 127 "pix.g"
#line 129 "pix.g"
consumeUntil(NEWLINE);
#line 637 "PIXCfgParser.cpp"
#line 643 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
if( inputState->guessing == 0 ) {
reportError(ex);
recover(ex,_tokenSet_1);
} else {
throw;
}
}
}
void PIXCfgParser::crypto() {
try { // for error handling
match(CRYPTO);
if ( inputState->guessing==0 ) {
#line 143 "pix.g"
consumeUntil(NEWLINE);
#line 665 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -651,11 +679,11 @@ void PIXCfgParser::unknown_command() {
try { // for error handling
match(WORD);
if ( inputState->guessing==0 ) {
#line 141 "pix.g"
#line 150 "pix.g"
consumeUntil(NEWLINE);
#line 659 "PIXCfgParser.cpp"
#line 687 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -676,13 +704,13 @@ void PIXCfgParser::ip_access_list_ext() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 197 "pix.g"
#line 206 "pix.g"
importer->newUnidirRuleSet( name->getText() );
*dbg << name->getLine() << ":"
<< " ACL ext " << name->getText() << std::endl;
#line 686 "PIXCfgParser.cpp"
#line 714 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -719,12 +747,12 @@ void PIXCfgParser::ip_access_list_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 213 "pix.g"
#line 222 "pix.g"
*dbg << LT(0)->getLine() << ":"
<< " ACL line end" << std::endl << std::endl;
#line 728 "PIXCfgParser.cpp"
#line 756 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -780,11 +808,11 @@ void PIXCfgParser::community_list_command() {
try { // for error handling
match(COMMUNITY_LIST);
if ( inputState->guessing==0 ) {
#line 134 "pix.g"
#line 136 "pix.g"
consumeUntil(NEWLINE);
#line 788 "PIXCfgParser.cpp"
#line 816 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -802,23 +830,23 @@ void PIXCfgParser::permit_ext() {
try { // for error handling
match(PERMIT);
if ( inputState->guessing==0 ) {
#line 221 "pix.g"
#line 230 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "permit";
*dbg << LT(1)->getLine() << ":" << " permit ";
#line 813 "PIXCfgParser.cpp"
#line 841 "PIXCfgParser.cpp"
}
rule_ext();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 228 "pix.g"
#line 237 "pix.g"
importer->pushRule();
#line 822 "PIXCfgParser.cpp"
#line 850 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -836,23 +864,23 @@ void PIXCfgParser::deny_ext() {
try { // for error handling
match(DENY);
if ( inputState->guessing==0 ) {
#line 234 "pix.g"
#line 243 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "deny";
*dbg << LT(1)->getLine() << ":" << " deny ";
#line 847 "PIXCfgParser.cpp"
#line 875 "PIXCfgParser.cpp"
}
rule_ext();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 241 "pix.g"
#line 250 "pix.g"
importer->pushRule();
#line 856 "PIXCfgParser.cpp"
#line 884 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -870,7 +898,7 @@ void PIXCfgParser::remark() {
try { // for error handling
match(REMARK);
if ( inputState->guessing==0 ) {
#line 522 "pix.g"
#line 531 "pix.g"
*dbg << LT(1)->getLine() << ":";
std::string rem;
@ -883,7 +911,7 @@ void PIXCfgParser::remark() {
*dbg << " REMARK " << rem << std::endl;
//consumeUntil(NEWLINE);
#line 887 "PIXCfgParser.cpp"
#line 915 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -907,15 +935,15 @@ void PIXCfgParser::rule_ext() {
ip_protocols();
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 251 "pix.g"
#line 260 "pix.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 913 "PIXCfgParser.cpp"
#line 941 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 252 "pix.g"
#line 261 "pix.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 919 "PIXCfgParser.cpp"
#line 947 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -980,24 +1008,24 @@ void PIXCfgParser::rule_ext() {
{
match(ICMP);
if ( inputState->guessing==0 ) {
#line 258 "pix.g"
#line 267 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 989 "PIXCfgParser.cpp"
#line 1017 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 262 "pix.g"
#line 271 "pix.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 995 "PIXCfgParser.cpp"
#line 1023 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 263 "pix.g"
#line 272 "pix.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 1001 "PIXCfgParser.cpp"
#line 1029 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1102,18 +1130,18 @@ void PIXCfgParser::rule_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 270 "pix.g"
#line 279 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 1111 "PIXCfgParser.cpp"
#line 1139 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 274 "pix.g"
#line 283 "pix.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 1117 "PIXCfgParser.cpp"
#line 1145 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1125,9 +1153,9 @@ void PIXCfgParser::rule_ext() {
{
xoperator();
if ( inputState->guessing==0 ) {
#line 275 "pix.g"
#line 284 "pix.g"
importer->SaveTmpPortToSrc();
#line 1131 "PIXCfgParser.cpp"
#line 1159 "PIXCfgParser.cpp"
}
break;
}
@ -1145,9 +1173,9 @@ void PIXCfgParser::rule_ext() {
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 276 "pix.g"
#line 285 "pix.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 1151 "PIXCfgParser.cpp"
#line 1179 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1159,9 +1187,9 @@ void PIXCfgParser::rule_ext() {
{
xoperator();
if ( inputState->guessing==0 ) {
#line 277 "pix.g"
#line 286 "pix.g"
importer->SaveTmpPortToDst();
#line 1165 "PIXCfgParser.cpp"
#line 1193 "PIXCfgParser.cpp"
}
break;
}
@ -1267,11 +1295,11 @@ void PIXCfgParser::rule_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 283 "pix.g"
#line 292 "pix.g"
*dbg << std::endl;
#line 1275 "PIXCfgParser.cpp"
#line 1303 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1306,12 +1334,12 @@ void PIXCfgParser::ip_protocols() {
}
}
if ( inputState->guessing==0 ) {
#line 291 "pix.g"
#line 300 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 1315 "PIXCfgParser.cpp"
#line 1343 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1339,13 +1367,13 @@ void PIXCfgParser::hostaddr_ext() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 343 "pix.g"
#line 352 "pix.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "0.0.0.0";
*dbg << h->getText() << "/0.0.0.0";
#line 1349 "PIXCfgParser.cpp"
#line 1377 "PIXCfgParser.cpp"
}
break;
}
@ -1358,13 +1386,13 @@ void PIXCfgParser::hostaddr_ext() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 350 "pix.g"
#line 359 "pix.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 1368 "PIXCfgParser.cpp"
#line 1396 "PIXCfgParser.cpp"
}
break;
}
@ -1372,13 +1400,13 @@ void PIXCfgParser::hostaddr_ext() {
{
match(ANY);
if ( inputState->guessing==0 ) {
#line 357 "pix.g"
#line 366 "pix.g"
importer->tmp_a = "0.0.0.0";
importer->tmp_nm = "0.0.0.0";
*dbg << "0.0.0.0/0.0.0.0";
#line 1382 "PIXCfgParser.cpp"
#line 1410 "PIXCfgParser.cpp"
}
break;
}
@ -1406,12 +1434,12 @@ void PIXCfgParser::time_range() {
tr_name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 409 "pix.g"
#line 418 "pix.g"
importer->time_range_name = tr_name->getText();
*dbg << "time_range " << tr_name->getText() << " ";
#line 1415 "PIXCfgParser.cpp"
#line 1443 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1429,12 +1457,12 @@ void PIXCfgParser::fragments() {
try { // for error handling
match(FRAGMENTS);
if ( inputState->guessing==0 ) {
#line 402 "pix.g"
#line 411 "pix.g"
importer->fragments = true;
*dbg << "fragments ";
#line 1438 "PIXCfgParser.cpp"
#line 1466 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1469,12 +1497,12 @@ void PIXCfgParser::log() {
}
}
if ( inputState->guessing==0 ) {
#line 388 "pix.g"
#line 397 "pix.g"
importer->logging = true;
*dbg << "logging ";
#line 1478 "PIXCfgParser.cpp"
#line 1506 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1504,7 +1532,7 @@ void PIXCfgParser::icmp_spec() {
match(INT_CONST);
}
if ( inputState->guessing==0 ) {
#line 299 "pix.g"
#line 308 "pix.g"
importer->icmp_type = icmp_type->getText();
importer->icmp_code = icmp_code->getText();
@ -1512,7 +1540,7 @@ void PIXCfgParser::icmp_spec() {
*dbg << icmp_type->getText() << " "
<< icmp_code->getText() << " ";
#line 1516 "PIXCfgParser.cpp"
#line 1544 "PIXCfgParser.cpp"
}
break;
}
@ -1521,12 +1549,12 @@ void PIXCfgParser::icmp_spec() {
icmp_word = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 308 "pix.g"
#line 317 "pix.g"
importer->icmp_spec = icmp_word->getText();
*dbg << icmp_word->getText() << " ";
#line 1530 "PIXCfgParser.cpp"
#line 1558 "PIXCfgParser.cpp"
}
break;
}
@ -1585,12 +1613,12 @@ void PIXCfgParser::established() {
try { // for error handling
match(ESTABLISHED);
if ( inputState->guessing==0 ) {
#line 395 "pix.g"
#line 404 "pix.g"
importer->established = true;
*dbg << "established ";
#line 1594 "PIXCfgParser.cpp"
#line 1622 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1635,12 +1663,12 @@ void PIXCfgParser::single_port_op() {
}
}
if ( inputState->guessing==0 ) {
#line 319 "pix.g"
#line 328 "pix.g"
importer->tmp_port_op = LT(0)->getText();
*dbg << LT(0)->getText() << " ";
#line 1644 "PIXCfgParser.cpp"
#line 1672 "PIXCfgParser.cpp"
}
port_spec();
}
@ -1659,12 +1687,12 @@ void PIXCfgParser::port_range() {
try { // for error handling
match(P_RANGE);
if ( inputState->guessing==0 ) {
#line 327 "pix.g"
#line 336 "pix.g"
importer->tmp_port_op = LT(0)->getText();
*dbg << LT(0)->getText() << " ";
#line 1668 "PIXCfgParser.cpp"
#line 1696 "PIXCfgParser.cpp"
}
port_spec();
port_spec();
@ -1701,12 +1729,12 @@ void PIXCfgParser::port_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 335 "pix.g"
#line 344 "pix.g"
importer->tmp_port_spec += (std::string(" ") + LT(0)->getText());
*dbg << LT(0)->getText() << " ";
#line 1710 "PIXCfgParser.cpp"
#line 1738 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1731,13 +1759,13 @@ void PIXCfgParser::hostaddr_std() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 366 "pix.g"
#line 375 "pix.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "0.0.0.0";
*dbg << h->getText() << "/0.0.0.0";
#line 1741 "PIXCfgParser.cpp"
#line 1769 "PIXCfgParser.cpp"
}
}
else if ((LA(1) == IPV4) && (LA(2) == IPV4)) {
@ -1748,25 +1776,25 @@ void PIXCfgParser::hostaddr_std() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 373 "pix.g"
#line 382 "pix.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 1758 "PIXCfgParser.cpp"
#line 1786 "PIXCfgParser.cpp"
}
}
else if ((LA(1) == ANY)) {
match(ANY);
if ( inputState->guessing==0 ) {
#line 380 "pix.g"
#line 389 "pix.g"
importer->tmp_a = "0.0.0.0";
importer->tmp_nm = "0.0.0.0";
*dbg << "0.0.0.0/0.0.0.0";
#line 1770 "PIXCfgParser.cpp"
#line 1798 "PIXCfgParser.cpp"
}
}
else {
@ -1828,10 +1856,10 @@ void PIXCfgParser::switchport() {
vlan_num = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 642 "pix.g"
#line 652 "pix.g"
#line 1835 "PIXCfgParser.cpp"
#line 1863 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1908,7 +1936,7 @@ void PIXCfgParser::v6_dhcp_address() {
dhcp = LT(1);
match(DHCP);
if ( inputState->guessing==0 ) {
#line 580 "pix.g"
#line 590 "pix.g"
std::string label = lbl->getText();
std::string addr = dhcp->getText();
@ -1919,7 +1947,7 @@ void PIXCfgParser::v6_dhcp_address() {
// which we do not support
consumeUntil(NEWLINE);
#line 1923 "PIXCfgParser.cpp"
#line 1951 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1945,7 +1973,7 @@ void PIXCfgParser::v6_static_address() {
m = LT(1);
match(IPV4);
if ( inputState->guessing==0 ) {
#line 593 "pix.g"
#line 603 "pix.g"
std::string label = lbl->getText();
std::string addr = a->getText();
@ -1956,7 +1984,7 @@ void PIXCfgParser::v6_static_address() {
// in case there are some other parameters after address and netmask
consumeUntil(NEWLINE);
#line 1960 "PIXCfgParser.cpp"
#line 1988 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1976,7 +2004,7 @@ void PIXCfgParser::v7_dhcp_address() {
dhcp = LT(1);
match(DHCP);
if ( inputState->guessing==0 ) {
#line 610 "pix.g"
#line 620 "pix.g"
std::string addr = dhcp->getText();
importer->addInterfaceAddress(addr, "");
@ -1984,7 +2012,7 @@ void PIXCfgParser::v7_dhcp_address() {
<< " INTRFACE ADDRESS: " << addr << std::endl;
consumeUntil(NEWLINE);
#line 1988 "PIXCfgParser.cpp"
#line 2016 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2026,7 +2054,7 @@ void PIXCfgParser::v7_static_address() {
}
}
if ( inputState->guessing==0 ) {
#line 621 "pix.g"
#line 631 "pix.g"
std::string addr = a->getText();
std::string netm = m->getText();
@ -2043,7 +2071,7 @@ void PIXCfgParser::v7_static_address() {
}
consumeUntil(NEWLINE);
#line 2047 "PIXCfgParser.cpp"
#line 2075 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2071,7 +2099,7 @@ void PIXCfgParser::access_group_by_name() {
intf_label = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 649 "pix.g"
#line 659 "pix.g"
importer->setInterfaceAndDirectionForRuleSet(
acln->getText(),
@ -2082,7 +2110,7 @@ void PIXCfgParser::access_group_by_name() {
<< " " << intf_label->getText()
<< " " << dir->getText() << std::endl;
#line 2086 "PIXCfgParser.cpp"
#line 2114 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2107,6 +2135,7 @@ const char* PIXCfgParser::tokenNames[] = {
"\"ip\"",
"\"quit\"",
"\"community-list\"",
"\"crypto\"",
"WORD",
"\"certificate\"",
"\"PIX\"",
@ -2194,35 +2223,35 @@ const char* PIXCfgParser::tokenNames[] = {
const unsigned long PIXCfgParser::_tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL };
// EOF
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_0(_tokenSet_0_data_,4);
const unsigned long PIXCfgParser::_tokenSet_1_data_[] = { 85874UL, 1838064UL, 0UL, 0UL };
// EOF NEWLINE "ip" "quit" WORD "certificate" "PIX" "ASA" "hostname" "access-list"
// "controller" "interface" "vlan" "security-level" "nameif" "description"
// "shutdown" "exit" LINE_COMMENT COLON_COMMENT
const unsigned long PIXCfgParser::_tokenSet_1_data_[] = { 171890UL, 3676128UL, 0UL, 0UL };
// EOF NEWLINE "ip" "quit" "crypto" WORD "certificate" "PIX" "ASA" "hostname"
// "access-list" "controller" "interface" "vlan" "security-level" "nameif"
// "description" "shutdown" "exit" LINE_COMMENT COLON_COMMENT
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_1(_tokenSet_1_data_,4);
const unsigned long PIXCfgParser::_tokenSet_2_data_[] = { 16UL, 0UL, 0UL, 0UL };
// NEWLINE
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_2(_tokenSet_2_data_,4);
const unsigned long PIXCfgParser::_tokenSet_3_data_[] = { 1879048192UL, 0UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_3_data_[] = { 3758096384UL, 0UL, 0UL, 0UL };
// "host" IPV4 "any"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_3(_tokenSet_3_data_,4);
const unsigned long PIXCfgParser::_tokenSet_4_data_[] = { 4286710032UL, 15UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_4_data_[] = { 4278452752UL, 31UL, 0UL, 0UL };
// NEWLINE WORD INT_CONST "eq" "gt" "lt" "neq" "range" "host" IPV4 "any"
// "log" "log-input" "established" "fragments" "time-range"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_4(_tokenSet_4_data_,4);
const unsigned long PIXCfgParser::_tokenSet_5_data_[] = { 2147483664UL, 5UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_5_data_[] = { 16UL, 11UL, 0UL, 0UL };
// NEWLINE "log" "log-input" "fragments"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_5(_tokenSet_5_data_,4);
const unsigned long PIXCfgParser::_tokenSet_6_data_[] = { 2147483664UL, 1UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_6_data_[] = { 16UL, 3UL, 0UL, 0UL };
// NEWLINE "log" "log-input"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_6(_tokenSet_6_data_,4);
const unsigned long PIXCfgParser::_tokenSet_7_data_[] = { 2147483664UL, 13UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_7_data_[] = { 16UL, 27UL, 0UL, 0UL };
// NEWLINE "log" "log-input" "fragments" "time-range"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_7(_tokenSet_7_data_,4);
const unsigned long PIXCfgParser::_tokenSet_8_data_[] = { 4026531856UL, 15UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_8_data_[] = { 3758096400UL, 31UL, 0UL, 0UL };
// NEWLINE "host" IPV4 "any" "log" "log-input" "established" "fragments"
// "time-range"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_8(_tokenSet_8_data_,4);
const unsigned long PIXCfgParser::_tokenSet_9_data_[] = { 4026663184UL, 15UL, 0UL, 0UL };
const unsigned long PIXCfgParser::_tokenSet_9_data_[] = { 3758359056UL, 31UL, 0UL, 0UL };
// NEWLINE WORD INT_CONST "host" IPV4 "any" "log" "log-input" "established"
// "fragments" "time-range"
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_9(_tokenSet_9_data_,4);

View File

@ -81,6 +81,7 @@ public:
public: void shutdown();
public: void certificate();
public: void quit();
public: void crypto();
public: void unknown_command();
public: void ip_access_list_ext();
public: void interface_known_commands();
@ -121,10 +122,10 @@ protected:
private:
static const char* tokenNames[];
#ifndef NO_STATIC_CONSTS
static const int NUM_TOKENS = 89;
static const int NUM_TOKENS = 90;
#else
enum {
NUM_TOKENS = 89
NUM_TOKENS = 90
};
#endif

View File

@ -16,87 +16,88 @@ struct CUSTOM_API PIXCfgParserTokenTypes {
IP = 5,
QUIT = 6,
COMMUNITY_LIST = 7,
WORD = 8,
CERTIFICATE = 9,
PIX_WORD = 10,
ASA_WORD = 11,
VERSION_WORD = 12,
NUMBER = 13,
HOSTNAME = 14,
STRING = 15,
ACCESS_LIST = 16,
INT_CONST = 17,
PERMIT = 18,
DENY = 19,
ICMP = 20,
TCP = 21,
UDP = 22,
P_EQ = 23,
P_GT = 24,
P_LT = 25,
P_NEQ = 26,
P_RANGE = 27,
HOST = 28,
IPV4 = 29,
ANY = 30,
LOG = 31,
LOG_INPUT = 32,
ESTABLISHED = 33,
FRAGMENTS = 34,
TIME_RANGE = 35,
CONTROLLER = 36,
INTRFACE = 37,
VLAN = 38,
SEC_LEVEL = 39,
NAMEIF = 40,
DESCRIPTION = 41,
REMARK = 42,
SHUTDOWN = 43,
ADDRESS = 44,
DHCP = 45,
STANDBY = 46,
SWITCHPORT = 47,
ACCESS = 48,
ACCESS_GROUP = 49,
EXIT = 50,
LINE_COMMENT = 51,
COLON_COMMENT = 52,
SECONDARY = 53,
SETROUTE = 54,
EXTENDED = 55,
STANDARD = 56,
Whitespace = 57,
HEX_CONST = 58,
NEG_INT_CONST = 59,
DIGIT = 60,
HEXDIGIT = 61,
PIPE_CHAR = 62,
NUMBER_SIGN = 63,
PERCENT = 64,
AMPERSAND = 65,
APOSTROPHE = 66,
OPENING_PAREN = 67,
CLOSING_PAREN = 68,
STAR = 69,
PLUS = 70,
COMMA = 71,
MINUS = 72,
DOT = 73,
SLASH = 74,
COLON = 75,
SEMICOLON = 76,
LESS_THAN = 77,
EQUALS = 78,
GREATER_THAN = 79,
QUESTION = 80,
COMMERCIAL_AT = 81,
OPENING_SQUARE = 82,
CLOSING_SQUARE = 83,
CARET = 84,
UNDERLINE = 85,
OPENING_BRACE = 86,
CLOSING_BRACE = 87,
TILDE = 88,
CRYPTO = 8,
WORD = 9,
CERTIFICATE = 10,
PIX_WORD = 11,
ASA_WORD = 12,
VERSION_WORD = 13,
NUMBER = 14,
HOSTNAME = 15,
STRING = 16,
ACCESS_LIST = 17,
INT_CONST = 18,
PERMIT = 19,
DENY = 20,
ICMP = 21,
TCP = 22,
UDP = 23,
P_EQ = 24,
P_GT = 25,
P_LT = 26,
P_NEQ = 27,
P_RANGE = 28,
HOST = 29,
IPV4 = 30,
ANY = 31,
LOG = 32,
LOG_INPUT = 33,
ESTABLISHED = 34,
FRAGMENTS = 35,
TIME_RANGE = 36,
CONTROLLER = 37,
INTRFACE = 38,
VLAN = 39,
SEC_LEVEL = 40,
NAMEIF = 41,
DESCRIPTION = 42,
REMARK = 43,
SHUTDOWN = 44,
ADDRESS = 45,
DHCP = 46,
STANDBY = 47,
SWITCHPORT = 48,
ACCESS = 49,
ACCESS_GROUP = 50,
EXIT = 51,
LINE_COMMENT = 52,
COLON_COMMENT = 53,
SECONDARY = 54,
SETROUTE = 55,
EXTENDED = 56,
STANDARD = 57,
Whitespace = 58,
HEX_CONST = 59,
NEG_INT_CONST = 60,
DIGIT = 61,
HEXDIGIT = 62,
PIPE_CHAR = 63,
NUMBER_SIGN = 64,
PERCENT = 65,
AMPERSAND = 66,
APOSTROPHE = 67,
OPENING_PAREN = 68,
CLOSING_PAREN = 69,
STAR = 70,
PLUS = 71,
COMMA = 72,
MINUS = 73,
DOT = 74,
SLASH = 75,
COLON = 76,
SEMICOLON = 77,
LESS_THAN = 78,
EQUALS = 79,
GREATER_THAN = 80,
QUESTION = 81,
COMMERCIAL_AT = 82,
OPENING_SQUARE = 83,
CLOSING_SQUARE = 84,
CARET = 85,
UNDERLINE = 86,
OPENING_BRACE = 87,
CLOSING_BRACE = 88,
TILDE = 89,
NULL_TREE_LOOKAHEAD = 3
};
#ifdef __cplusplus

View File

@ -4,84 +4,85 @@ NEWLINE=4
IP="ip"=5
QUIT="quit"=6
COMMUNITY_LIST="community-list"=7
WORD=8
CERTIFICATE="certificate"=9
PIX_WORD="PIX"=10
ASA_WORD="ASA"=11
VERSION_WORD="Version"=12
NUMBER=13
HOSTNAME="hostname"=14
STRING=15
ACCESS_LIST="access-list"=16
INT_CONST=17
PERMIT="permit"=18
DENY="deny"=19
ICMP="icmp"=20
TCP="tcp"=21
UDP="udp"=22
P_EQ="eq"=23
P_GT="gt"=24
P_LT="lt"=25
P_NEQ="neq"=26
P_RANGE="range"=27
HOST="host"=28
IPV4=29
ANY="any"=30
LOG="log"=31
LOG_INPUT="log-input"=32
ESTABLISHED="established"=33
FRAGMENTS="fragments"=34
TIME_RANGE="time-range"=35
CONTROLLER="controller"=36
INTRFACE="interface"=37
VLAN="vlan"=38
SEC_LEVEL="security-level"=39
NAMEIF="nameif"=40
DESCRIPTION="description"=41
REMARK="remark"=42
SHUTDOWN="shutdown"=43
ADDRESS="address"=44
DHCP="dhcp"=45
STANDBY="standby"=46
SWITCHPORT="switchport"=47
ACCESS="access"=48
ACCESS_GROUP="access-group"=49
EXIT="exit"=50
LINE_COMMENT=51
COLON_COMMENT=52
SECONDARY="secondary"=53
SETROUTE="setroute"=54
EXTENDED="extended"=55
STANDARD="standard"=56
Whitespace=57
HEX_CONST=58
NEG_INT_CONST=59
DIGIT=60
HEXDIGIT=61
PIPE_CHAR=62
NUMBER_SIGN=63
PERCENT=64
AMPERSAND=65
APOSTROPHE=66
OPENING_PAREN=67
CLOSING_PAREN=68
STAR=69
PLUS=70
COMMA=71
MINUS=72
DOT=73
SLASH=74
COLON=75
SEMICOLON=76
LESS_THAN=77
EQUALS=78
GREATER_THAN=79
QUESTION=80
COMMERCIAL_AT=81
OPENING_SQUARE=82
CLOSING_SQUARE=83
CARET=84
UNDERLINE=85
OPENING_BRACE=86
CLOSING_BRACE=87
TILDE=88
CRYPTO="crypto"=8
WORD=9
CERTIFICATE="certificate"=10
PIX_WORD="PIX"=11
ASA_WORD="ASA"=12
VERSION_WORD="Version"=13
NUMBER=14
HOSTNAME="hostname"=15
STRING=16
ACCESS_LIST="access-list"=17
INT_CONST=18
PERMIT="permit"=19
DENY="deny"=20
ICMP="icmp"=21
TCP="tcp"=22
UDP="udp"=23
P_EQ="eq"=24
P_GT="gt"=25
P_LT="lt"=26
P_NEQ="neq"=27
P_RANGE="range"=28
HOST="host"=29
IPV4=30
ANY="any"=31
LOG="log"=32
LOG_INPUT="log-input"=33
ESTABLISHED="established"=34
FRAGMENTS="fragments"=35
TIME_RANGE="time-range"=36
CONTROLLER="controller"=37
INTRFACE="interface"=38
VLAN="vlan"=39
SEC_LEVEL="security-level"=40
NAMEIF="nameif"=41
DESCRIPTION="description"=42
REMARK="remark"=43
SHUTDOWN="shutdown"=44
ADDRESS="address"=45
DHCP="dhcp"=46
STANDBY="standby"=47
SWITCHPORT="switchport"=48
ACCESS="access"=49
ACCESS_GROUP="access-group"=50
EXIT="exit"=51
LINE_COMMENT=52
COLON_COMMENT=53
SECONDARY="secondary"=54
SETROUTE="setroute"=55
EXTENDED="extended"=56
STANDARD="standard"=57
Whitespace=58
HEX_CONST=59
NEG_INT_CONST=60
DIGIT=61
HEXDIGIT=62
PIPE_CHAR=63
NUMBER_SIGN=64
PERCENT=65
AMPERSAND=66
APOSTROPHE=67
OPENING_PAREN=68
CLOSING_PAREN=69
STAR=70
PLUS=71
COMMA=72
MINUS=73
DOT=74
SLASH=75
COLON=76
SEMICOLON=77
LESS_THAN=78
EQUALS=79
GREATER_THAN=80
QUESTION=81
COMMERCIAL_AT=82
OPENING_SQUARE=83
CLOSING_SQUARE=84
CARET=85
UNDERLINE=86
OPENING_BRACE=87
CLOSING_BRACE=88
TILDE=89

View File

@ -110,6 +110,8 @@ cfgfile :
certificate
|
quit
|
crypto
|
unknown_command
|
@ -136,6 +138,13 @@ community_list_command : COMMUNITY_LIST
}
;
//****************************************************************
crypto : CRYPTO
{
consumeUntil(NEWLINE);
}
;
//****************************************************************
unknown_command : WORD
{
@ -535,6 +544,7 @@ remark : REMARK
shutdown : SHUTDOWN
{
importer->ignoreCurrentInterface();
*dbg<< LT(1)->getLine() << ":"
<< " INTERFACE SHUTDOWN " << std::endl;
}
@ -766,6 +776,8 @@ tokens
PIX_WORD = "PIX" ;
ASA_WORD = "ASA" ;
VERSION_WORD = "Version" ;
CRYPTO = "crypto";
}