25 checkLeaseInternal(lease, sanity, subnets);
37 checkLeaseInternal(lease, sanity, subnets);
40 template<
typename LeasePtrType,
typename SubnetsType>
41 void SanityChecker::checkLeaseInternal(LeasePtrType& lease,
const CfgConsistencyPtr& checks,
42 const SubnetsType& subnets) {
48 auto subnet = subnets->getBySubnetId(lease->subnet_id_);
50 if (subnet && subnet->inRange(lease->addr_)) {
59 SubnetID id = findSubnetId(lease, subnets);
61 switch (checks->getLeaseSanityCheck()) {
66 if (lease->subnet_id_ !=
id) {
69 .arg(lease->addr_.toText()).arg(lease->subnet_id_);
74 if (lease->subnet_id_ !=
id) {
79 .arg(lease->addr_.toText()).arg(lease->subnet_id_).arg(
id);
80 lease->subnet_id_ = id;
84 .arg(lease->addr_.toText()).arg(lease->subnet_id_);
90 if (lease->subnet_id_ !=
id) {
95 .arg(lease->addr_.toText()).arg(lease->subnet_id_).arg(
id);
96 lease->subnet_id_ = id;
101 .arg(lease->addr_.toText()).arg(lease->subnet_id_);
108 if (lease->subnet_id_ !=
id) {
110 .arg(lease->addr_.toText()).arg(lease->subnet_id_);
122 template<
typename LeaseType,
typename SubnetsType>
123 SubnetID SanityChecker::findSubnetId(
const LeaseType& lease,
const SubnetsType& subnets) {
126 auto subnet = subnets->selectSubnet(lease->addr_);
131 return (subnet->getID());
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
static CfgMgr & instance()
returns a single instance of Configuration Manager
boost::shared_ptr< SrvConfig > SrvConfigPtr
Non-const pointer to the SrvConfig.
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
boost::shared_ptr< CfgConsistency > CfgConsistencyPtr
Type used to for pointing to CfgConsistency structure.
boost::shared_ptr< CfgSubnets4 > CfgSubnets4Ptr
Non-const pointer.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
boost::shared_ptr< CfgSubnets6 > CfgSubnets6Ptr
Non-const pointer.
Defines the logger used by the top-level component of kea-dhcp-ddns.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
boost::shared_ptr< Lease6 > Lease6Ptr
Pointer to a Lease6 structure.
void checkLease(Lease4Ptr &lease, bool current=true)
Sanity checks and possibly corrects an IPv4 lease.
uint32_t SubnetID
Unique identifier for a subnet (both v4 and v6)
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.