![]() |
Kea 3.1.9
|
Radius hooks library implementation. More...
#include <radius.h>
Public Member Functions | |
| ~RadiusImpl () | |
| Destructor. | |
| void | checkEarlyGlobalResvLookup () |
| Check the early global host reservations lookup flag. | |
| bool | checkHostBackends () |
| Check host backends (cache and radius). | |
| void | checkSharedNetworks () |
| Check shared network server configuration. | |
| const Servers & | getAccessServers () const |
| Get servers for access. | |
| const Servers & | getAccountingServers () const |
| Get servers for accounting. | |
| isc::asiolink::IOServicePtr | getIOContext () |
| Get the hook I/O service. | |
| isc::asiolink::IOServicePtr | getIOService () |
| Get the hook I/O service. | |
| void | init (data::ElementPtr &config) |
| Initialize. | |
| void | registerExchange (ExchangePtr exchange) |
| Register Exchange. | |
| void | reset () |
| Reset the state as it was just created. | |
| bool | serveAccess () const |
| Check if access is served. | |
| bool | serveAccounting () const |
| Check if accounting is served. | |
| void | setAccessIdleTimer () |
| Set the access idle timer. | |
| void | setAccountingIdleTimer () |
| Set the accounting idle timer. | |
| void | setIOContext (isc::asiolink::IOServicePtr io_service) |
| Set the hook I/O service. | |
| void | setIOService (isc::asiolink::IOServicePtr io_service) |
| Set the hook I/O service. | |
| void | startServices () |
| Start the I/O mechanisms. | |
| data::ElementPtr | toElement () const override |
| Unparse implementation configuration. | |
| void | unregisterExchange (ExchangePtr exchange) |
| Unregister Exchange. | |
| Public Member Functions inherited from isc::data::CfgToElement | |
| virtual | ~CfgToElement () |
| Destructor. | |
Static Public Member Functions | |
| static RadiusImpl & | instance () |
| RadiusImpl is a singleton class. | |
Public Attributes | |
| boost::shared_ptr< RadiusAccounting > | acct_ |
| Pointer to accounting (never null). | |
| boost::shared_ptr< RadiusAccess > | auth_ |
| Pointer to access (never null). | |
| RadiusBackendPtr | backend_ |
| Radius backend. | |
| std::string | bindaddr_ |
| bindaddr. | |
| dhcp::CacheHostDataSourcePtr | cache_ |
| Host cache. | |
| bool | canonical_mac_address_ |
| Canonical MAC address. | |
| bool | clientid_pop0_ |
| Client Id pop leading zero(s). | |
| bool | clientid_printable_ |
| Client Id try printable. | |
| unsigned | deadtime_ |
| Deadtime. | |
| std::string | dictionary_ |
| Dictionary path. | |
| bool | extract_duid_ |
| Extract Duid from Client Id. | |
| dhcp::Host::IdentifierType | id_type4_ |
| Identifier type for IPv4. | |
| dhcp::Host::IdentifierType | id_type6_ |
| Identifier type for IPv6. | |
| RadiusProtocol | proto_ |
| Transport protocol. | |
| std::map< uint32_t, uint32_t > | remap_ |
| Subnet ID to NAS port map. | |
| bool | reselect_subnet_address_ |
| Reselect subnet using address. | |
| bool | reselect_subnet_pool_ |
| Reselect subnet using pool. | |
| unsigned | retries_ |
| Retries. | |
| std::string | session_history_filename_ |
| Session history filename. | |
| isc::tcp::TcpClientPtr | tcp_client_ |
| TCP client. | |
| unsigned | thread_pool_size_ |
| Thread pool size. | |
| unsigned | timeout_ |
| Timeout. | |
| boost::shared_ptr< RadiusTls > | tls_ |
| Pointer to tls (never null). | |
| UdpClientPtr | udp_client_ |
| UDP client. | |
| bool | use_message_authenticator_ |
| Use Message-Authenticator attribute. | |
Static Public Attributes | |
| static std::atomic< bool > | shutdown_ |
| Flag which indicates that the instance is shutting down. | |
Protected Member Functions | |
| RadiusImpl () | |
| Protected constructor. | |
| void | cleanup () |
| Clean up members. | |
Static Protected Member Functions | |
| static const RadiusImplPtr & | instancePtr () |
| Returns pointer to the sole instance of radius implementation. | |
| isc::radius::RadiusImpl::~RadiusImpl | ( | ) |
Destructor.
Definition at line 187 of file radius.cc.
References cleanup(), LOG_WARN, isc::radius::RADIUS_CLEANUP_EXCEPTION, and isc::radius::radius_logger.
|
protected |
Protected constructor.
Definition at line 173 of file radius.cc.
References acct_, auth_, bindaddr_, canonical_mac_address_, clientid_pop0_, clientid_printable_, deadtime_, extract_duid_, id_type4_, id_type6_, proto_, isc::radius::PW_PROTO_UDP, reselect_subnet_address_, reselect_subnet_pool_, retries_, tcp_client_, thread_pool_size_, timeout_, tls_, udp_client_, and use_message_authenticator_.
Referenced by instancePtr().
| void isc::radius::RadiusImpl::checkEarlyGlobalResvLookup | ( | ) |
Check the early global host reservations lookup flag.
| ConfigError | when the server configuration is not compatible. |
Definition at line 488 of file radius.cc.
References isc::dhcp::CfgGlobals::EARLY_GLOBAL_RESERVATIONS_LOOKUP, isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), and isc_throw.
Referenced by init().
| bool isc::radius::RadiusImpl::checkHostBackends | ( | ) |
Check host backends (cache and radius).
As a side effect when the host cache backend is found the cache_ field is set.
Definition at line 551 of file radius.cc.
References isc::dhcp::HostMgr::addBackend(), cache_, isc::dhcp::HostMgr::getHostDataSource(), isc::dhcp::HostMgr::instance(), LOG_ERROR, isc::radius::RADIUS_ACCESS_HOST_BACKEND_ERROR, isc::radius::RADIUS_ACCESS_NO_HOST_CACHE, and isc::radius::radius_logger.
| void isc::radius::RadiusImpl::checkSharedNetworks | ( | ) |
Check shared network server configuration.
This verifies the compatibility of the server configuration with the RADIUS hook, in particular with shared networks:
| ConfigError | when the server configuration is not compatible. |
Definition at line 497 of file radius.cc.
References isc::dhcp::CfgMgr::getStagingCfg(), isc::dhcp::CfgMgr::instance(), isc::dhcp::HostMgr::instance(), isc_throw, and isc::dhcp::HostMgr::setDisableSingleQuery().
Referenced by init().
|
protected |
Clean up members.
Definition at line 208 of file radius.cc.
References acct_, auth_, backend_, bindaddr_, cache_, canonical_mac_address_, clientid_pop0_, clientid_printable_, isc::dhcp::HostMgr::delBackend(), isc::dhcp::HostDataSourceFactory::deregisterFactory(), extract_duid_, getIOContext(), getIOService(), id_type4_, id_type6_, isc::dhcp::Host::IDENT_CLIENT_ID, isc::dhcp::Host::IDENT_DUID, remap_, reselect_subnet_address_, reselect_subnet_pool_, retries_, session_history_filename_, tcp_client_, timeout_, tls_, and udp_client_.
Referenced by ~RadiusImpl(), and reset().
| const Servers & isc::radius::RadiusImpl::getAccessServers | ( | ) | const |
Get servers for access.
Definition at line 390 of file radius.cc.
References auth_, proto_, isc::radius::PW_PROTO_TLS, and tls_.
Referenced by isc::radius::RadiusRequest::RadiusRequest().
| const Servers & isc::radius::RadiusImpl::getAccountingServers | ( | ) | const |
Get servers for accounting.
Definition at line 399 of file radius.cc.
References acct_, proto_, isc::radius::PW_PROTO_TLS, and tls_.
Referenced by isc::radius::RadiusRequest::RadiusRequest().
|
inline |
|
inline |
| void isc::radius::RadiusImpl::init | ( | data::ElementPtr & | config | ) |
Initialize.
| config | Configuration specified for the hooks library. |
| ConfigError | when configuration fails. |
Definition at line 269 of file radius.cc.
References acct_, auth_, backend_, checkEarlyGlobalResvLookup(), checkSharedNetworks(), isc_throw, LOG_ERROR, isc::radius::RadiusConfigParser::parse(), isc::radius::RADIUS_ACCESS_NO_HOST_CACHE, isc::radius::radius_logger, isc::dhcp::HostDataSourceFactory::registeredFactory(), isc::dhcp::HostDataSourceFactory::registerFactory(), session_history_filename_, and tls_.
|
static |
RadiusImpl is a singleton class.
This method returns reference to its sole instance.
Definition at line 163 of file radius.cc.
References instancePtr().
Referenced by isc::radius::RadiusAcctHandler::RadiusAcctHandler(), isc::radius::RadiusAcctStatus::RadiusAcctStatus(), isc::radius::RadiusAuthHandler::RadiusAuthHandler(), isc::radius::RadiusAuthStatus::RadiusAuthStatus(), isc::radius::RadiusRequest::RadiusRequest(), isc::radius::RadiusTlsStatus::RadiusTlsStatus(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), isc::radius::RadiusAccounting::buildAcct6(), isc::radius::RadiusAccess::buildAuth(), isc::radius::RadiusAccess::buildAuth(), isc::radius::Exchange::buildRequest(), command_processed(), dhcp4_srv_configured(), dhcp6_srv_configured(), isc::radius::RadiusBackendImpl::get4(), isc::radius::RadiusBackendImpl::get6(), isc::radius::RadiusAccess::getIdentifier(), isc::radius::RadiusAccess::getIdentifier(), isc::radius::getNASPort(), isc::radius::RadiusAccess::IdleTimerCallback(), isc::radius::RadiusAccounting::IdleTimerCallback(), isc::radius::RadiusAcctStatus::invokeCallback(), isc::radius::RadiusAsyncAcct::invokeCallback(), isc::radius::RadiusAsyncAuth::invokeCallback(), isc::radius::RadiusAuthStatus::invokeCallback(), isc::radius::RadiusTlsStatus::invokeCallback(), lease4_decline(), lease4_expire(), lease4_release(), lease4_renew(), lease4_select(), lease6_decline(), lease6_expire(), lease6_rebind(), lease6_release(), lease6_renew(), lease6_select(), load(), isc::radius::RadiusConfigParser::parse(), isc::radius::RadiusServerParser::parse(), isc::radius::RadiusServiceParser::parse(), isc::radius::Exchange::processResponse(), isc::radius::RadiusAccess::setIdleTimer(), isc::radius::RadiusAccounting::setIdleTimer(), isc::radius::RadiusTls::setIdleTimer(), isc::radius::RadiusSyncAcct::start(), isc::radius::RadiusSyncAuth::start(), isc::radius::TcpExchange::start(), subnet4_select(), subnet6_select(), isc::radius::RadiusAccess::terminate4Internal(), isc::radius::RadiusAccess::terminate6Internal(), and unload().
|
staticprotected |
Returns pointer to the sole instance of radius implementation.
Definition at line 168 of file radius.cc.
References RadiusImpl().
Referenced by instance().
| void isc::radius::RadiusImpl::registerExchange | ( | ExchangePtr | exchange | ) |
Register Exchange.
| exchange | The exchange to register. |
Definition at line 196 of file radius.cc.
References udp_client_.
Referenced by isc::radius::RadiusAccess::IdleTimerCallback(), and isc::radius::RadiusAccounting::IdleTimerCallback().
| void isc::radius::RadiusImpl::reset | ( | ) |
| bool isc::radius::RadiusImpl::serveAccess | ( | ) | const |
| bool isc::radius::RadiusImpl::serveAccounting | ( | ) | const |
| void isc::radius::RadiusImpl::setAccessIdleTimer | ( | ) |
Set the access idle timer.
Definition at line 408 of file radius.cc.
References auth_, proto_, isc::radius::PW_PROTO_TLS, shutdown_, and tls_.
Referenced by isc::radius::RadiusAsyncAuth::invokeCallback(), isc::radius::RadiusAuthStatus::invokeCallback(), isc::radius::RadiusTlsStatus::invokeCallback(), and isc::radius::RadiusSyncAuth::start().
| void isc::radius::RadiusImpl::setAccountingIdleTimer | ( | ) |
Set the accounting idle timer.
Definition at line 420 of file radius.cc.
References acct_, proto_, isc::radius::PW_PROTO_TLS, shutdown_, and tls_.
Referenced by isc::radius::RadiusAcctStatus::invokeCallback(), isc::radius::RadiusAsyncAcct::invokeCallback(), and isc::radius::RadiusSyncAcct::start().
|
inline |
|
inline |
| void isc::radius::RadiusImpl::startServices | ( | ) |
Start the I/O mechanisms.
Start the thread pool for MT or create the IO context for ST.
Definition at line 295 of file radius.cc.
References isc::util::MultiThreadingMgr::detectThreadCount(), isc::dhcp::CfgMultiThreading::extract(), isc::dhcp::CfgMgr::instance(), proto_, isc::radius::PW_PROTO_UDP, tcp_client_, thread_pool_size_, and udp_client_.
Referenced by dhcp4_srv_configured(), and dhcp6_srv_configured().
|
overridevirtual |
Unparse implementation configuration.
Implements isc::data::CfgToElement.
Definition at line 585 of file radius.cc.
References acct_, auth_, bindaddr_, canonical_mac_address_, clientid_pop0_, clientid_printable_, Element::create(), Element::createList(), Element::createMap(), deadtime_, dictionary_, extract_duid_, isc::dhcp::Host::getIdentifierName(), id_type4_, id_type6_, proto_, isc::radius::protocolToText(), isc::radius::PW_PROTO_TLS, remap_, reselect_subnet_address_, reselect_subnet_pool_, retries_, session_history_filename_, thread_pool_size_, timeout_, tls_, and use_message_authenticator_.
| void isc::radius::RadiusImpl::unregisterExchange | ( | ExchangePtr | exchange | ) |
Unregister Exchange.
| exchange | The exchange to unregister. |
Definition at line 202 of file radius.cc.
References udp_client_.
Referenced by isc::radius::RadiusAcctStatus::invokeCallback(), isc::radius::RadiusAsyncAcct::invokeCallback(), isc::radius::RadiusAsyncAuth::invokeCallback(), and isc::radius::RadiusAuthStatus::invokeCallback().
| boost::shared_ptr<RadiusAccounting> isc::radius::RadiusImpl::acct_ |
Pointer to accounting (never null).
Definition at line 287 of file radius.h.
Referenced by isc::radius::RadiusAcctStatus::RadiusAcctStatus(), RadiusImpl(), cleanup(), getAccountingServers(), init(), isc::radius::RadiusConfigParser::parse(), serveAccounting(), setAccountingIdleTimer(), and toElement().
| boost::shared_ptr<RadiusAccess> isc::radius::RadiusImpl::auth_ |
Pointer to access (never null).
Definition at line 284 of file radius.h.
Referenced by isc::radius::RadiusAuthStatus::RadiusAuthStatus(), RadiusImpl(), cleanup(), getAccessServers(), init(), isc::radius::RadiusConfigParser::parse(), serveAccess(), setAccessIdleTimer(), and toElement().
| RadiusBackendPtr isc::radius::RadiusImpl::backend_ |
| std::string isc::radius::RadiusImpl::bindaddr_ |
bindaddr.
Definition at line 296 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), isc::radius::RadiusServerParser::parse(), and toElement().
| dhcp::CacheHostDataSourcePtr isc::radius::RadiusImpl::cache_ |
Host cache.
Definition at line 290 of file radius.h.
Referenced by checkHostBackends(), and cleanup().
| bool isc::radius::RadiusImpl::canonical_mac_address_ |
Canonical MAC address.
Definition at line 299 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| bool isc::radius::RadiusImpl::clientid_pop0_ |
Client Id pop leading zero(s).
Definition at line 302 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| bool isc::radius::RadiusImpl::clientid_printable_ |
Client Id try printable.
Definition at line 305 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| unsigned isc::radius::RadiusImpl::deadtime_ |
Deadtime.
Definition at line 308 of file radius.h.
Referenced by RadiusImpl(), isc::radius::RadiusConfigParser::parse(), isc::radius::RadiusServerParser::parse(), and toElement().
| std::string isc::radius::RadiusImpl::dictionary_ |
Dictionary path.
Definition at line 266 of file radius.h.
Referenced by isc::radius::RadiusConfigParser::parse(), and toElement().
| bool isc::radius::RadiusImpl::extract_duid_ |
Extract Duid from Client Id.
Definition at line 311 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| dhcp::Host::IdentifierType isc::radius::RadiusImpl::id_type4_ |
Identifier type for IPv4.
Definition at line 332 of file radius.h.
Referenced by RadiusImpl(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct4(), cleanup(), isc::radius::RadiusAccess::getIdentifier(), isc::radius::RadiusConfigParser::parse(), and toElement().
| dhcp::Host::IdentifierType isc::radius::RadiusImpl::id_type6_ |
Identifier type for IPv6.
Definition at line 335 of file radius.h.
Referenced by RadiusImpl(), isc::radius::RadiusAccounting::buildAcct(), isc::radius::RadiusAccounting::buildAcct6(), cleanup(), isc::radius::RadiusAccess::getIdentifier(), isc::radius::RadiusConfigParser::parse(), and toElement().
| RadiusProtocol isc::radius::RadiusImpl::proto_ |
Transport protocol.
Definition at line 269 of file radius.h.
Referenced by RadiusImpl(), getAccessServers(), getAccountingServers(), isc::radius::RadiusConfigParser::parse(), isc::radius::RadiusServiceParser::parse(), serveAccess(), serveAccounting(), setAccessIdleTimer(), setAccountingIdleTimer(), startServices(), and toElement().
| std::map<uint32_t, uint32_t> isc::radius::RadiusImpl::remap_ |
Subnet ID to NAS port map.
Definition at line 278 of file radius.h.
Referenced by cleanup(), isc::radius::getNASPort(), isc::radius::RadiusConfigParser::parse(), and toElement().
| bool isc::radius::RadiusImpl::reselect_subnet_address_ |
Reselect subnet using address.
Definition at line 317 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| bool isc::radius::RadiusImpl::reselect_subnet_pool_ |
Reselect subnet using pool.
Definition at line 314 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| unsigned isc::radius::RadiusImpl::retries_ |
Retries.
Definition at line 320 of file radius.h.
Referenced by isc::radius::RadiusAcctStatus::RadiusAcctStatus(), isc::radius::RadiusAuthStatus::RadiusAuthStatus(), RadiusImpl(), isc::radius::RadiusRequest::RadiusRequest(), isc::radius::RadiusTlsStatus::RadiusTlsStatus(), cleanup(), isc::radius::RadiusConfigParser::parse(), and toElement().
| std::string isc::radius::RadiusImpl::session_history_filename_ |
Session history filename.
Definition at line 323 of file radius.h.
Referenced by cleanup(), init(), isc::radius::RadiusConfigParser::parse(), and toElement().
|
static |
Flag which indicates that the instance is shutting down.
Definition at line 341 of file radius.h.
Referenced by isc::radius::UdpExchange::open(), isc::radius::UdpExchange::receivedHandler(), isc::radius::TcpExchange::RequestHandler(), reset(), isc::radius::UdpExchange::sentHandler(), serveAccess(), serveAccounting(), setAccessIdleTimer(), setAccountingIdleTimer(), and isc::radius::TcpExchange::start().
| isc::tcp::TcpClientPtr isc::radius::RadiusImpl::tcp_client_ |
TCP client.
Definition at line 275 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::TcpExchange::start(), and startServices().
| unsigned isc::radius::RadiusImpl::thread_pool_size_ |
Thread pool size.
Definition at line 326 of file radius.h.
Referenced by RadiusImpl(), isc::radius::RadiusConfigParser::parse(), startServices(), and toElement().
| unsigned isc::radius::RadiusImpl::timeout_ |
Timeout.
Definition at line 329 of file radius.h.
Referenced by RadiusImpl(), cleanup(), isc::radius::RadiusConfigParser::parse(), isc::radius::RadiusServerParser::parse(), and toElement().
| boost::shared_ptr<RadiusTls> isc::radius::RadiusImpl::tls_ |
Pointer to tls (never null).
Definition at line 281 of file radius.h.
Referenced by RadiusImpl(), isc::radius::RadiusTlsStatus::RadiusTlsStatus(), cleanup(), getAccessServers(), getAccountingServers(), init(), isc::radius::RadiusConfigParser::parse(), serveAccess(), serveAccounting(), setAccessIdleTimer(), setAccountingIdleTimer(), and toElement().
| UdpClientPtr isc::radius::RadiusImpl::udp_client_ |
UDP client.
Definition at line 272 of file radius.h.
Referenced by RadiusImpl(), cleanup(), registerExchange(), startServices(), and unregisterExchange().
| bool isc::radius::RadiusImpl::use_message_authenticator_ |
Use Message-Authenticator attribute.
Definition at line 338 of file radius.h.
Referenced by RadiusImpl(), isc::radius::RadiusConfigParser::parse(), and toElement().