compiler for ipfilter: int IDs and member vars for tcp/udp ports

This commit is contained in:
Vadim Kurland
2008-06-09 22:11:30 +00:00
parent b0fc8dfa5f
commit efc9f2f507
2 changed files with 47 additions and 46 deletions
+14 -13
View File
@@ -139,8 +139,8 @@ bool NATCompiler_ipf::ExpandPortRange::processNext()
if (UDPService::isA(osrv) || TCPService::isA(osrv))
{
int rs = osrv->getInt("dst_range_start");
int re = osrv->getInt("dst_range_end");
int rs = TCPUDPService::cast(osrv)->getDstRangeStart();
int re = TCPUDPService::cast(osrv)->getDstRangeEnd();
int numPorts = re-rs+1;
if (numPorts==1)
@@ -169,8 +169,8 @@ bool NATCompiler_ipf::ExpandPortRange::processNext()
FWObject *newSrv = compiler->dbcopy->create(newSrvType);
newSrv->duplicate(osrv,true);
newSrv->setInt("dst_range_start",p);
newSrv->setInt("dst_range_end",p);
TCPUDPService::cast(newSrv)->setDstRangeStart(p);
TCPUDPService::cast(newSrv)->setDstRangeEnd(p);
compiler->dbcopy->add(newSrv,false);
compiler->dbcopy->addToIndex(newSrv);
compiler->cacheObj(newSrv);
@@ -436,7 +436,8 @@ bool NATCompiler_ipf::appProxy::processNext()
{
UDPService *s=UDPService::cast(osrv);
if (ipsec_proxy &&
s->getInt("dst_range_start")==ISAKMP_PORT && s->getInt("dst_range_end")==ISAKMP_PORT)
s->getDstRangeStart()==ISAKMP_PORT && s->getDstRangeEnd()==ISAKMP_PORT)
rule->setStr("nat_rule_proxy",ipsec_proxy_str);
}
@@ -444,35 +445,35 @@ bool NATCompiler_ipf::appProxy::processNext()
{
TCPService *s=TCPService::cast(osrv);
if (ftp_proxy &&
s->getInt("dst_range_start")==FTP_PORT && s->getInt("dst_range_end")==FTP_PORT )
s->getDstRangeStart()==FTP_PORT && s->getDstRangeEnd()==FTP_PORT )
rule->setStr("nat_rule_proxy",ftp_proxy_str);
if (rcmd_proxy &&
s->getInt("dst_range_start")==RCMD_PORT && s->getInt("dst_range_end")==RCMD_PORT )
s->getDstRangeStart()==RCMD_PORT && s->getDstRangeEnd()==RCMD_PORT )
rule->setStr("nat_rule_proxy",rcmd_proxy_str);
if (krcmd_proxy &&
s->getInt("dst_range_start")==KRCMD_PORT && s->getInt("dst_range_end")==KRCMD_PORT )
s->getDstRangeStart()==KRCMD_PORT && s->getDstRangeEnd()==KRCMD_PORT )
rule->setStr("nat_rule_proxy",krcmd_proxy_str);
if (ekshell_proxy &&
s->getInt("dst_range_start")==EKSHELL_PORT && s->getInt("dst_range_end")==EKSHELL_PORT )
s->getDstRangeStart()==EKSHELL_PORT && s->getDstRangeEnd()==EKSHELL_PORT )
rule->setStr("nat_rule_proxy",ekshell_proxy_str);
if (raudio_proxy &&
s->getInt("dst_range_start")==RAUDIO_PORT && s->getInt("dst_range_end")==RAUDIO_PORT )
s->getDstRangeStart()==RAUDIO_PORT && s->getDstRangeEnd()==RAUDIO_PORT )
rule->setStr("nat_rule_proxy",raudio_proxy_str);
if (h323_proxy &&
s->getInt("dst_range_start")==H323_PORT && s->getInt("dst_range_end")==H323_PORT )
s->getDstRangeStart()==H323_PORT && s->getDstRangeEnd()==H323_PORT )
rule->setStr("nat_rule_proxy",h323_proxy_str);
if (pptp_proxy &&
s->getInt("dst_range_start")==PPTP_PORT && s->getInt("dst_range_end")==PPTP_PORT )
s->getDstRangeStart()==PPTP_PORT && s->getDstRangeEnd()==PPTP_PORT )
rule->setStr("nat_rule_proxy",pptp_proxy_str);
if (irc_proxy &&
s->getInt("dst_range_start")==IRC_PORT && s->getInt("dst_range_end")==IRC_PORT )
s->getDstRangeStart()==IRC_PORT && s->getDstRangeEnd()==IRC_PORT )
rule->setStr("nat_rule_proxy",irc_proxy_str);
}
}
+1 -1
View File
@@ -199,7 +199,7 @@ void NATCompiler_ipf::PrintRule::_printPort(Service *srv,bool eq)
{
if (TCPService::isA(srv) || UDPService::isA(srv))
{
int drs=srv->getInt("dst_range_start");
int drs=TCPUDPService::cast(srv)->getDstRangeStart();
if (!eq || drs!=0)
{
compiler->output << "port ";