Kea  2.1.7-git
isc::dhcp::SanityChecker Class Reference

Code used to conduct various sanity checks. More...

#include <sanity_checker.h>

Public Member Functions

void checkLease (Lease4Ptr &lease, bool current=true)
 Sanity checks and possibly corrects an IPv4 lease. More...
 
void checkLease (Lease6Ptr &lease, bool current=true)
 Sanity checks and possibly corrects an IPv6 lease. More...
 
template<typename LeasePtrType , typename SubnetsType >
void checkLeaseInternal (LeasePtrType &lease, const CfgConsistencyPtr &checks, const SubnetsType &subnets)
 

Static Public Member Functions

static bool leaseCheckingEnabled (bool current=true)
 Indicates the specified configuration enables lease sanity checking. More...
 

Detailed Description

Code used to conduct various sanity checks.

Currently used for leases.

This class is expected to be used as a simple interface sanity checker for various run-time and configuration elements. Currently is provides sanity checking and correction for subnet-id parameter in leases.

Definition at line 21 of file sanity_checker.h.

Member Function Documentation

◆ checkLease() [1/2]

void isc::dhcp::SanityChecker::checkLease ( Lease4Ptr lease,
bool  current = true 
)

Sanity checks and possibly corrects an IPv4 lease.

Depending on the sanity-checks/lease-checks parameter value (see CfgConsistency for details), this code may print a warning, correct subnet-id or discard the lease.

Parameters
leaseLease to be sanity-checked
currentspecify whether to use current (true) or staging (false) config

Definition at line 34 of file sanity_checker.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), and isc::dhcp::CfgConsistency::LEASE_CHECK_NONE.

+ Here is the call graph for this function:

◆ checkLease() [2/2]

void isc::dhcp::SanityChecker::checkLease ( Lease6Ptr lease,
bool  current = true 
)

Sanity checks and possibly corrects an IPv6 lease.

Depending on the sanity-checks/lease-checks parameter value (see CfgConsistency for details), this code may print a warning, correct subnet-id or discard the lease. Note that if the lease type is TYPE_PD, it simply returns.

Parameters
leaseLease to be sanity-checked
currentspecify whether to use current (true) or staging (false) config

Definition at line 52 of file sanity_checker.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::CfgConsistency::LEASE_CHECK_NONE, and isc::dhcp::Lease::TYPE_NA.

+ Here is the call graph for this function:

◆ checkLeaseInternal()

template<typename LeasePtrType , typename SubnetsType >
void isc::dhcp::SanityChecker::checkLeaseInternal ( LeasePtrType &  lease,
const CfgConsistencyPtr checks,
const SubnetsType &  subnets 
)

◆ leaseCheckingEnabled()

bool isc::dhcp::SanityChecker::leaseCheckingEnabled ( bool  current = true)
static

Indicates the specified configuration enables lease sanity checking.

Parameters
currentspecifies whether to use current (true) or staging(false) server configuration
Returns
true if the sanity-checks/lease-checks parameter value (see CfgConsistency for details) is not CfgConsistency::LEASE_CHECK_NONE.

Definition at line 18 of file sanity_checker.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), and isc::dhcp::CfgConsistency::LEASE_CHECK_NONE.

Referenced by isc::dhcp::LeaseFileLoader::load().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: