mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-11 15:41:41 +02:00
compiler for ipfilter: int IDs and member vars for tcp/udp ports
This commit is contained in:
@@ -139,8 +139,8 @@ bool NATCompiler_ipf::ExpandPortRange::processNext()
|
|||||||
|
|
||||||
if (UDPService::isA(osrv) || TCPService::isA(osrv))
|
if (UDPService::isA(osrv) || TCPService::isA(osrv))
|
||||||
{
|
{
|
||||||
int rs = osrv->getInt("dst_range_start");
|
int rs = TCPUDPService::cast(osrv)->getDstRangeStart();
|
||||||
int re = osrv->getInt("dst_range_end");
|
int re = TCPUDPService::cast(osrv)->getDstRangeEnd();
|
||||||
|
|
||||||
int numPorts = re-rs+1;
|
int numPorts = re-rs+1;
|
||||||
if (numPorts==1)
|
if (numPorts==1)
|
||||||
@@ -169,8 +169,8 @@ bool NATCompiler_ipf::ExpandPortRange::processNext()
|
|||||||
|
|
||||||
FWObject *newSrv = compiler->dbcopy->create(newSrvType);
|
FWObject *newSrv = compiler->dbcopy->create(newSrvType);
|
||||||
newSrv->duplicate(osrv,true);
|
newSrv->duplicate(osrv,true);
|
||||||
newSrv->setInt("dst_range_start",p);
|
TCPUDPService::cast(newSrv)->setDstRangeStart(p);
|
||||||
newSrv->setInt("dst_range_end",p);
|
TCPUDPService::cast(newSrv)->setDstRangeEnd(p);
|
||||||
compiler->dbcopy->add(newSrv,false);
|
compiler->dbcopy->add(newSrv,false);
|
||||||
compiler->dbcopy->addToIndex(newSrv);
|
compiler->dbcopy->addToIndex(newSrv);
|
||||||
compiler->cacheObj(newSrv);
|
compiler->cacheObj(newSrv);
|
||||||
@@ -436,7 +436,8 @@ bool NATCompiler_ipf::appProxy::processNext()
|
|||||||
{
|
{
|
||||||
UDPService *s=UDPService::cast(osrv);
|
UDPService *s=UDPService::cast(osrv);
|
||||||
if (ipsec_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",ipsec_proxy_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,35 +445,35 @@ bool NATCompiler_ipf::appProxy::processNext()
|
|||||||
{
|
{
|
||||||
TCPService *s=TCPService::cast(osrv);
|
TCPService *s=TCPService::cast(osrv);
|
||||||
if (ftp_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",ftp_proxy_str);
|
||||||
|
|
||||||
if (rcmd_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",rcmd_proxy_str);
|
||||||
|
|
||||||
if (krcmd_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",krcmd_proxy_str);
|
||||||
|
|
||||||
if (ekshell_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",ekshell_proxy_str);
|
||||||
|
|
||||||
if (raudio_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",raudio_proxy_str);
|
||||||
|
|
||||||
if (h323_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",h323_proxy_str);
|
||||||
|
|
||||||
if (pptp_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",pptp_proxy_str);
|
||||||
|
|
||||||
if (irc_proxy &&
|
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);
|
rule->setStr("nat_rule_proxy",irc_proxy_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ void NATCompiler_ipf::PrintRule::_printPort(Service *srv,bool eq)
|
|||||||
{
|
{
|
||||||
if (TCPService::isA(srv) || UDPService::isA(srv))
|
if (TCPService::isA(srv) || UDPService::isA(srv))
|
||||||
{
|
{
|
||||||
int drs=srv->getInt("dst_range_start");
|
int drs=TCPUDPService::cast(srv)->getDstRangeStart();
|
||||||
if (!eq || drs!=0)
|
if (!eq || drs!=0)
|
||||||
{
|
{
|
||||||
compiler->output << "port ";
|
compiler->output << "port ";
|
||||||
|
|||||||
Reference in New Issue
Block a user