Kea 3.1.1
isc::radius::RadiusAccess Class Reference

Radius access class. More...

#include <radius_access.h>

+ Inheritance diagram for isc::radius::RadiusAccess:

Public Member Functions

 RadiusAccess ()
 Constructor.
 
virtual ~RadiusAccess ()=default
 Destructor.
 
RadiusAuthHandlerPtr buildAuth (dhcp::Pkt4 &query, uint32_t subnet_id, const std::vector< uint8_t > &id, const std::string &text)
 Build RadiusAuth handler for Access-Request - IPv4.
 
RadiusAuthHandlerPtr buildAuth (dhcp::Pkt6 &query, uint32_t subnet_id, const std::vector< uint8_t > &id, const std::string &text)
 Build RadiusAuth handler for Access-Request - IPv6.
 
bool getIdentifier (dhcp::Pkt4 &query, std::vector< uint8_t > &id, std::string &text)
 Get Identifier – IPv4.
 
bool getIdentifier (dhcp::Pkt6 &query, std::vector< uint8_t > &id, std::string &text)
 Get Identifier – IPv6.
 
- Public Member Functions inherited from isc::radius::RadiusService
 RadiusService (const std::string &name)
 Constructor.
 
virtual ~RadiusService ()=default
 Default destructor.
 
data::ElementPtr toElement () const override
 Unparse service configuration.
 
- Public Member Functions inherited from isc::data::CfgToElement
virtual ~CfgToElement ()
 Destructor.
 

Static Public Member Functions

static bool reselectSubnet (const dhcp::Pkt4Ptr &query, uint32_t &subnet_id, bool &both_global, const std::string &cclass)
 Subnet reselect - class/pool IPv4.
 
static bool reselectSubnet (const dhcp::Pkt6Ptr &query, uint32_t &subnet_id, bool &both_global, const std::string &cclass)
 Subnet reselect - class/pool IPv6.
 
static bool reselectSubnet (const isc::dhcp::Pkt4Ptr &query, uint32_t &subnet_id, bool &both_global, const asiolink::IOAddress &address)
 Subnet reselect - reserved address IPv4.
 
static bool reselectSubnet (const isc::dhcp::Pkt6Ptr &query, uint32_t &subnet_id, bool &both_global, const asiolink::IOAddress &address)
 Subnet reselect - reserved address IPv6.
 
static void terminate4 (RadiusAuthEnv env, int result, AttributesPtr recv_attrs)
 Termination callback - IPv4.
 
static void terminate4Internal (RadiusAuthEnv &env, int result, AttributesPtr recv_attrs, dhcp::Pkt4Ptr &query, bool &drop)
 Termination callback body - IPv4.
 
static void terminate6 (RadiusAuthEnv env, int result, AttributesPtr recv_attrs)
 Termination callback - IPv6.
 
static void terminate6Internal (RadiusAuthEnv &env, int result, AttributesPtr recv_attrs, dhcp::Pkt6Ptr &query, bool &drop)
 Termination callback body - IPv6.
 

Public Attributes

RadiusAuthPendingRequests< dhcp::Pkt4Ptrrequests4_
 Pending RADIUS access requests - IPv4.
 
RadiusAuthPendingRequests< dhcp::Pkt6Ptrrequests6_
 Pending RADIUS access requests - IPv6.
 
- Public Attributes inherited from isc::radius::RadiusService
CfgAttributes attributes_
 Attribute configurations.
 
bool enabled_
 Enable flag.
 
size_t max_pending_requests_
 Maximum number of pending requests.
 
std::string name_
 Name (access or accounting).
 
bool peer_updates_
 Peer updates flag.
 
Servers servers_
 Server list.
 

Detailed Description

Radius access class.

Definition at line 164 of file radius_access.h.

Constructor & Destructor Documentation

◆ RadiusAccess()

isc::radius::RadiusAccess::RadiusAccess ( )

Constructor.

Definition at line 71 of file radius_access.cc.

References isc::radius::RadiusService::RadiusService().

+ Here is the call graph for this function:

◆ ~RadiusAccess()

virtual isc::radius::RadiusAccess::~RadiusAccess ( )
virtualdefault

Destructor.

Member Function Documentation

◆ buildAuth() [1/2]

RadiusAuthHandlerPtr isc::radius::RadiusAccess::buildAuth ( dhcp::Pkt4 & query,
uint32_t subnet_id,
const std::vector< uint8_t > & id,
const std::string & text )

Build RadiusAuth handler for Access-Request - IPv4.

Parameters
queryThe query packet.
subnet_idThe subnet ID.
idThe identifier.
textThe User Name.
Returns
RadiusAuth handler.

Definition at line 295 of file radius_access.cc.

References isc::radius::RadiusService::attributes_, isc::radius::canonize(), isc::radius::Attribute::fromString(), isc::dhcp::Pkt4::getHWAddr(), isc::dhcp::Pkt4::getLabel(), isc::dhcp::Host::IDENT_HWADDR, isc::radius::RadiusImpl::instance(), isc_throw, LOG_ERROR, isc::radius::PW_CALLING_STATION_ID, isc::radius::PW_USER_NAME, isc::radius::RADIUS_ACCESS_BUILD_FAILED, isc::radius::radius_logger, and terminate4().

+ Here is the call graph for this function:

◆ buildAuth() [2/2]

RadiusAuthHandlerPtr isc::radius::RadiusAccess::buildAuth ( dhcp::Pkt6 & query,
uint32_t subnet_id,
const std::vector< uint8_t > & id,
const std::string & text )

Build RadiusAuth handler for Access-Request - IPv6.

Parameters
queryThe query packet.
subnet_idThe subnet ID.
idThe identifier.
textThe User Name.
Returns
RadiusAuth handler.

Definition at line 340 of file radius_access.cc.

References isc::radius::RadiusService::attributes_, isc::radius::canonize(), isc::radius::Attribute::fromString(), isc::dhcp::Pkt6::getLabel(), isc::dhcp::Host::IDENT_HWADDR, isc::radius::RadiusImpl::instance(), isc_throw, LOG_ERROR, isc::radius::PW_CALLING_STATION_ID, isc::radius::PW_USER_NAME, isc::radius::RADIUS_ACCESS_BUILD_FAILED, isc::radius::radius_logger, and terminate6().

+ Here is the call graph for this function:

◆ getIdentifier() [1/2]

bool isc::radius::RadiusAccess::getIdentifier ( dhcp::Pkt4 & query,
std::vector< uint8_t > & id,
std::string & text )

◆ getIdentifier() [2/2]

bool isc::radius::RadiusAccess::getIdentifier ( dhcp::Pkt6 & query,
std::vector< uint8_t > & id,
std::string & text )

Get Identifier – IPv6.

Parameters
queryThe query packet.
[out]idA reference to the identifier.
[out]textA reference to the User Name.
Returns
true if succeeded, false if something went wrong.

Definition at line 208 of file radius_access.cc.

References isc::radius::canonize(), D6O_CLIENTID, isc::dhcp::Host::getIdentifierName(), isc::dhcp::Pkt6::getLabel(), isc::dhcp::Pkt::getOption(), isc::radius::RadiusImpl::id_type6_, isc::dhcp::Host::IDENT_DUID, isc::dhcp::Host::IDENT_FLEX, isc::dhcp::Host::IDENT_HWADDR, isc::radius::RadiusImpl::instance(), isc_throw, LOG_DEBUG, LOG_ERROR, isc::radius::pop0(), isc::radius::RADIUS_ACCESS_GET_IDENTIFIER, isc::radius::RADIUS_ACCESS_GET_IDENTIFIER_FAILED, isc::radius::RADIUS_DBG_TRACE, isc::radius::radius_logger, isc::radius::toHex(), and isc::radius::toPrintable().

+ Here is the call graph for this function:

◆ reselectSubnet() [1/4]

bool isc::radius::RadiusAccess::reselectSubnet ( const dhcp::Pkt4Ptr & query,
uint32_t & subnet_id,
bool & both_global,
const std::string & cclass )
static

Subnet reselect - class/pool IPv4.

First check if the subnet has a pool matching (no guard or a guard equal to the class) the class from Framed-Pool attribute. If not rerun the subnet selection process on the collection of subnets with such pool and update the subnet ID reference (can be updated to SUBNET_ID_UNUSED if no subnet can be reselected).

Parameters
queryThe query packet.
[out]subnet_idThe selected subnet ID.
cclassThe client class name.
[out]both_globalTrue when both selected and reselected subnets use global reservations.
Returns
true if reselected, false if not.

Definition at line 385 of file radius_access.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgSubnets4::initSelector(), isc::dhcp::CfgMgr::instance(), and isc::dhcp::Lease::TYPE_V4.

Referenced by terminate4Internal(), and terminate6Internal().

+ Here is the call graph for this function:

◆ reselectSubnet() [2/4]

bool isc::radius::RadiusAccess::reselectSubnet ( const dhcp::Pkt6Ptr & query,
uint32_t & subnet_id,
bool & both_global,
const std::string & cclass )
static

Subnet reselect - class/pool IPv6.

First check if the subnet has a pool matching (no guard or a guard equal to the class) the class from Framed-Pool attribute. If not rerun the subnet selection process on the collection of subnets with such pool and update the subnet ID reference (can be updated to SUBNET_ID_UNUSED if no subnet can be reselected).

Parameters
queryThe query packet.
[out]subnet_idThe selected subnet ID.
cclassThe client class name.
[out]both_globalTrue when both selected and reselected subnets use global reservations.
Returns
true if reselected, false if not.

Definition at line 438 of file radius_access.cc.

References isc::dhcp::CfgMgr::getCurrentCfg(), isc::dhcp::CfgSubnets6::initSelector(), isc::dhcp::CfgMgr::instance(), and isc::dhcp::Lease::TYPE_NA.

+ Here is the call graph for this function:

◆ reselectSubnet() [3/4]

bool isc::radius::RadiusAccess::reselectSubnet ( const isc::dhcp::Pkt4Ptr & query,
uint32_t & subnet_id,
bool & both_global,
const asiolink::IOAddress & address )
static

Subnet reselect - reserved address IPv4.

First check if the reserved address matches the subnet range. If not rerun the subnet selection process on the collection of subnets with such range and update the subnet ID reference (can be updated to SUBNET_ID_UNUSED if no subnet can be reselected).

Parameters
queryThe query packet.
[out]subnet_idThe selected subnet ID.
addressThe reserved address.
[out]both_globalTrue when both selected and reselected subnets use global reservations.
Returns
true if reselected, false if not.

Definition at line 491 of file radius_access.cc.

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

+ Here is the call graph for this function:

◆ reselectSubnet() [4/4]

bool isc::radius::RadiusAccess::reselectSubnet ( const isc::dhcp::Pkt6Ptr & query,
uint32_t & subnet_id,
bool & both_global,
const asiolink::IOAddress & address )
static

Subnet reselect - reserved address IPv6.

First check if the reserved address matches the subnet range. If not rerun the subnet selection process on the collection of subnets with such range and update the subnet ID reference (can be updated to SUBNET_ID_UNUSED if no subnet can be reselected).

Parameters
queryThe query packet.
[out]subnet_idThe selected subnet ID.
addressThe reserved address.
[out]both_globalTrue when both selected and reselected subnets use global reservations.
Returns
true if reselected, false if not.

Definition at line 525 of file radius_access.cc.

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

+ Here is the call graph for this function:

◆ terminate4()

void isc::radius::RadiusAccess::terminate4 ( RadiusAuthEnv env,
int result,
AttributesPtr recv_attrs )
static

Termination callback - IPv4.

All post response processing is done here.

Parameters
envCommunication environment.
resultreturn code.
recv_attrsreceived attributes.

Definition at line 730 of file radius_access.cc.

References isc::hooks::HooksManager::drop(), LOG_DEBUG, LOG_ERROR, isc::radius::RADIUS_ACCESS_DROP_PARKED_QUERY, isc::radius::RADIUS_ACCESS_RESUME_PARKED_QUERY, isc::radius::RADIUS_ACCESS_TERMINATE_ERROR, isc::radius::RADIUS_DBG_TRACE, isc::radius::radius_logger, isc::radius::RadiusAuthEnv::subnet_id_, terminate4Internal(), and isc::hooks::HooksManager::unpark().

Referenced by buildAuth().

+ Here is the call graph for this function:

◆ terminate4Internal()

void isc::radius::RadiusAccess::terminate4Internal ( RadiusAuthEnv & env,
int result,
AttributesPtr recv_attrs,
dhcp::Pkt4Ptr & query,
bool & drop )
static

◆ terminate6()

void isc::radius::RadiusAccess::terminate6 ( RadiusAuthEnv env,
int result,
AttributesPtr recv_attrs )
static

Termination callback - IPv6.

All post response processing is done here.

Parameters
envCommunication environment.
resultreturn code.
recv_attrsreceived attributes.

Definition at line 975 of file radius_access.cc.

References isc::hooks::HooksManager::drop(), LOG_DEBUG, LOG_ERROR, isc::radius::RADIUS_ACCESS_DROP_PARKED_QUERY, isc::radius::RADIUS_ACCESS_RESUME_PARKED_QUERY, isc::radius::RADIUS_ACCESS_TERMINATE_ERROR, isc::radius::RADIUS_DBG_TRACE, isc::radius::radius_logger, isc::radius::RadiusAuthEnv::subnet_id_, terminate6Internal(), and isc::hooks::HooksManager::unpark().

Referenced by buildAuth().

+ Here is the call graph for this function:

◆ terminate6Internal()

void isc::radius::RadiusAccess::terminate6Internal ( RadiusAuthEnv & env,
int result,
AttributesPtr recv_attrs,
dhcp::Pkt6Ptr & query,
bool & drop )
static

Member Data Documentation

◆ requests4_

RadiusAuthPendingRequests<dhcp::Pkt4Ptr> isc::radius::RadiusAccess::requests4_

Pending RADIUS access requests - IPv4.

Definition at line 326 of file radius_access.h.

◆ requests6_

RadiusAuthPendingRequests<dhcp::Pkt6Ptr> isc::radius::RadiusAccess::requests6_

Pending RADIUS access requests - IPv6.

Definition at line 329 of file radius_access.h.


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