1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-22 03:07:20 +01:00

renaming getAddressObjectInetAddrMask to getInetAddrMaskObjectPtr

This commit is contained in:
Vadim Kurland 2008-05-20 01:11:40 +00:00
parent c5f9a8f99b
commit ab5c914d81
7 changed files with 57 additions and 37 deletions

View File

@ -189,16 +189,20 @@ void NATCompiler_ipt::_expandInterface(Interface *iface,
{
if (physAddress::cast(*j)!=NULL) continue;
const InetAddrMask *ipv4 = Address::cast(*j)->getAddressObjectInetAddrMask();
if (ipv4!=NULL && use_mac && pa!=NULL)
//const InetAddrMask *ipv4 = Address::cast(*j)->getAddressObjectInetAddrMask();
const InetAddr *ip_addr = Address::cast(*j)->getAddressPtr();
const InetAddr *ip_netm = Address::cast(*j)->getNetmaskPtr();
if (ip_addr!=NULL && use_mac && pa!=NULL)
{
combinedAddress *ca=new combinedAddress(dbcopy,true);
combinedAddress *ca = new combinedAddress(dbcopy,true);
dbcopy->add(ca);
dbcopy->addToIndex(ca);
cacheObj(ca);
ca->setName( "CA("+iface->getName()+")" );
ca->setAddress( *(ipv4->getAddressPtr()) );
ca->setNetmask( *(ipv4->getNetmaskPtr()) );
ca->setAddress( *ip_addr );
ca->setNetmask( *ip_netm );
ca->setPhysAddress( pa->getPhysAddress() );
nol.push_back(ca);
} else
@ -234,8 +238,9 @@ bool NATCompiler_ipt::ConvertLoadBalancingRules::processNext()
FWObject *obj = NULL;
if (FWReference::cast(o)!=NULL)
obj=FWReference::cast(o)->getPointer();
const InetAddrMask *a = Address::cast(obj)->getAddressObjectInetAddrMask();
al.push_back( a->getAddressPtr() );
//const InetAddrMask *a = Address::cast(obj)->getAddressObjectInetAddrMask();
const InetAddr *ip_addr = Address::cast(obj)->getAddressPtr();
al.push_back( ip_addr );
}
al.sort(compare_addresses_ptr);

View File

@ -262,13 +262,18 @@ void OSConfigurator_linux24::addVirtualAddressForNAT(const Address *addr)
Interface *iface = Interface::cast(vaddr->getParent());
assert(iface!=NULL);
const InetAddrMask *vaddr_addr = Address::cast(
vaddr)->getAddressObjectInetAddrMask();
assert(vaddr_addr!=NULL);
const InetAddr *vaddr_netm =
Address::cast(vaddr)->getNetmaskPtr();
ostr << "add_addr " << addr->getAddressPtr()->toString() << " "
<< vaddr_addr->getNetmaskPtr()->getLength() << " "
<< iface->getName() << endl;
// const InetAddrMask *vaddr_addr = Address::cast(
// vaddr)->getAddressObjectInetAddrMask();
// assert(vaddr_addr!=NULL);
ostr << "add_addr " << addr->getAddressPtr()->toString()
<< " "
<< vaddr_netm->getLength()
<< " "
<< iface->getName() << endl;
virtual_addresses.push_back(*(addr->getAddressPtr()));
registerVirtualAddressForNat();
@ -363,15 +368,20 @@ void OSConfigurator_linux24::configureInterfaces()
FWObjectTypedChildIterator j=iface->findByType(IPv4::TYPENAME);
for ( ; j!=j.end(); ++j )
{
const InetAddrMask *iaddr = Address::cast(*j)->getAddressObjectInetAddrMask();
//const InetAddrMask *iaddr = Address::cast(*j)->getAddressObjectInetAddrMask();
const InetAddr *iaddr_addr =
Address::cast(*j)->getAddressPtr();
const InetAddr *iaddr_netm =
Address::cast(*j)->getNetmaskPtr();
output << "add_addr " << iaddr->getAddressPtr()->toString()
output << "add_addr " << iaddr_addr->toString()
<< " "
<< iaddr_netm->getLength()
<< " "
<< iaddr->getNetmaskPtr()->getLength() << " "
<< iface->getName() << endl;
// add to the table of virtual addresses so we won't generate code to
// configure the same address if it is needed for NAT
virtual_addresses.push_back(*(iaddr->getAddressPtr()));
virtual_addresses.push_back(*iaddr_addr);
}
output << "$IP link set " << iface->getName() << " up" << endl;
}

View File

@ -58,7 +58,7 @@ using namespace std;
* check and create new chain if needed
*/
string PolicyCompiler_ipt::PrintRuleIptRst::_createChain(const string &chain,
bool ipv6)
bool)
{
string res;
if ( ! chains[chain] )
@ -69,7 +69,7 @@ string PolicyCompiler_ipt::PrintRuleIptRst::_createChain(const string &chain,
return res;
}
string PolicyCompiler_ipt::PrintRuleIptRst::_startRuleLine(bool ipv6)
string PolicyCompiler_ipt::PrintRuleIptRst::_startRuleLine(bool)
{
return string("-A ");
}

View File

@ -58,7 +58,7 @@ using namespace std;
* check and create new chain if needed
*/
string PolicyCompiler_ipt::PrintRuleIptRstEcho::_createChain(
const string &chain, bool ipv6)
const string &chain, bool)
{
string res;
if ( ! chains[chain] )
@ -69,7 +69,7 @@ string PolicyCompiler_ipt::PrintRuleIptRstEcho::_createChain(
return res;
}
string PolicyCompiler_ipt::PrintRuleIptRstEcho::_startRuleLine(bool ipv6)
string PolicyCompiler_ipt::PrintRuleIptRstEcho::_startRuleLine(bool)
{
return string("echo \"-A ");
}

View File

@ -229,15 +229,17 @@ void PolicyCompiler_ipt::_expandInterface(Interface *iface,
std::list<FWObject*>::iterator j=lipaddr.begin();
for ( ; j!=lipaddr.end(); j++)
{
const InetAddrMask *ipv4 = Address::cast(*j)->getAddressObjectInetAddrMask();
//const InetAddrMask *ipv4 = Address::cast(*j)->getAddressObjectInetAddrMask();
const InetAddr *ip_addr = Address::cast(*j)->getAddressPtr();
const InetAddr *ip_netm = Address::cast(*j)->getNetmaskPtr();
if (use_mac)
{
combinedAddress *ca = new combinedAddress();
dbcopy->add(ca);
cacheObj(ca);
ca->setName( "CA("+iface->getName()+")" );
ca->setAddress( *(ipv4->getAddressPtr()) );
ca->setNetmask( *(ipv4->getNetmaskPtr()) );
ca->setAddress( *ip_addr );
ca->setNetmask( *ip_netm );
ca->setPhysAddress( pa->getPhysAddress() );
ol.push_back(ca);
@ -1723,7 +1725,11 @@ bool PolicyCompiler_ipt::bridgingFw::checkForMatchingBroadcastAndMulticast(
FWObjectTypedChildIterator k = iface->findByType(IPv4::TYPENAME);
for ( ; k!=k.end(); ++k )
{
const InetAddrMask *ipv4 = Address::cast(*k)->getAddressObjectInetAddrMask();
//const InetAddrMask *ipv4 = Address::cast(*k)->getAddressObjectInetAddrMask();
Address *addr = Address::cast(*k);
const InetAddr *ip_netm = addr->getNetmaskPtr();
const InetAddr *ip_net_addr = addr->getNetworkAddressPtr();
const InetAddr *ip_bcast_addr = addr->getBroadcastAddressPtr();
/*
* bug #780345: if interface has netmask 255.255.255.255, its own
@ -1736,7 +1742,7 @@ bool PolicyCompiler_ipt::bridgingFw::checkForMatchingBroadcastAndMulticast(
* interface, and the netmask is 255.255.255.255, then we get positive
* match because this routine interprets this address as a broadcast.
*/
if (ipv4->getNetmaskPtr()->isHostMask())
if (ip_netm->isHostMask())
continue;
/*
* commented out to fix bug #637694 - "bridge enbaled / management"
@ -1746,10 +1752,8 @@ bool PolicyCompiler_ipt::bridgingFw::checkForMatchingBroadcastAndMulticast(
if ( ipv4->getAddress()==obj1_addr ) return true;
*/
if (*(ipv4->getNetworkAddressPtr()) == *(obj1_addr))
return true;
if (*(ipv4->getBroadcastAddressPtr()) == *(obj1_addr))
return true;
if (*ip_net_addr == *obj1_addr) return true;
if (*ip_bcast_addr == *obj1_addr) return true;
}
}
}

View File

@ -360,16 +360,17 @@ _("Dynamic interface %s should not have an IP address object attached to it. Thi
for (list<FWObject*>::iterator j=la.begin(); j!=la.end(); ++j)
{
const InetAddrMask *ipv4 = IPv4::cast(*j)->getAddressObjectInetAddrMask();
//const InetAddrMask *ipv4 = IPv4::cast(*j)->getAddressObjectInetAddrMask();
const InetAddr *ip_addr = IPv4::cast(*j)->getAddressPtr();
if ( ipv4->getAddressPtr()->isAny())
if ( ip_addr->isAny())
{
char errstr[256];
sprintf(errstr,
"Interface %s (id=%s) has IP address %s.\n",
iface->getName().c_str(),
iface->getId().c_str(),
ipv4->getAddressPtr()->toString().c_str());
ip_addr->toString().c_str());
throw FWException(errstr);
}
}

View File

@ -1405,14 +1405,14 @@ bool NATCompiler_pix::DetectOverlappingStatics::processNext()
*(sc->osrc) == *(scmd->osrc))
{
const InetAddrMask *ia1 =
scmd->iaddr->getAddressObjectInetAddrMask();
scmd->iaddr->getInetAddrMaskObjectPtr();
const InetAddrMask *ia2 =
sc->iaddr->getAddressObjectInetAddrMask();
sc->iaddr->getInetAddrMaskObjectPtr();
const InetAddrMask *oa1 =
scmd->oaddr->getAddressObjectInetAddrMask();
scmd->oaddr->getInetAddrMaskObjectPtr();
const InetAddrMask *oa2 =
sc->oaddr->getAddressObjectInetAddrMask();
sc->oaddr->getInetAddrMaskObjectPtr();
if ( ! getOverlap(*(ia1), *(ia2)).empty() ||
! getOverlap(*(oa1), *(oa2)).empty() )