Kea 3.3.1
radius.cc
Go to the documentation of this file.
1// Copyright (C) 2020-2026 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
10#include <dhcpsrv/cfgmgr.h>
11#include <dhcpsrv/host_mgr.h>
15#include <radius.h>
16#include <radius_access.h>
17#include <radius_accounting.h>
18#include <radius_log.h>
19#include <radius_parsers.h>
20#include <radius_tls.h>
21#include <exception>
22#include <sys/resource.h>
23
24using namespace std;
25using namespace isc;
26using namespace isc::asiolink;
27using namespace isc::data;
28using namespace isc::db;
29using namespace isc::dhcp;
30using namespace isc::tcp;
31using namespace isc::util;
32
33namespace isc {
34namespace radius {
35
37
38namespace {
39
41class ExchangeLimitInit {
42public:
44 ExchangeLimitInit() {
45 struct rlimit rlimit;
46 memset(&rlimit, 0, sizeof(rlimit));
47 if (getrlimit(RLIMIT_NOFILE, &rlimit) == 0) {
48 if (rlimit.rlim_cur / 2 > UdpClient::exchangeListMaxSize) {
49 UdpClient::exchangeListMaxSize = rlimit.rlim_cur / 2;
50 }
51 }
52 }
53};
54
55// Create one global object.
56ExchangeLimitInit init;
57} // end of anonymous namespace
58
59UdpClient::UdpClient(const IOServicePtr& io_service, unsigned thread_pool_size)
60 : io_service_(io_service), thread_pool_size_(thread_pool_size) {
61 // Do nothing in ST mode.
62 if (thread_pool_size == 0) {
63 return;
64 }
65
66 // Create our own private IOService.
67 thread_io_service_.reset(new IOService());
68 thread_pool_ =
69 boost::make_shared<IoServiceThreadPool>(thread_io_service_,
70 thread_pool_size_);
71
72 // Add critical section callbacks.
74 [this]() { checkPermissions(); },
75 [this]() { pause(); },
76 [this]() { resume(); });
77}
78
82
83unsigned
85 return (thread_pool_size_);
86}
87
90 return (thread_io_service_);
91}
92
93void
95 if (thread_pool_) {
96 thread_pool_->run();
97
99 .arg(thread_pool_size_);
100 }
101}
102
103void
105 if (thread_pool_) {
107 thread_pool_->stop();
108 for (auto const& exchange : exchange_list_) {
109 exchange->shutdown();
110 }
111 thread_pool_->getIOService()->stopAndPoll();
112 thread_pool_.reset();
113 } else {
114 for (auto const& exchange : exchange_list_) {
115 exchange->shutdown();
116 }
117 io_service_->stopAndPoll();
118 }
119 exchange_list_.clear();
120}
121
122void
124 // Since this function is used as CS callback all exceptions must be
125 // suppressed, unlikely though they may be.
126 try {
127 if (thread_pool_) {
128 thread_pool_->checkPausePermissions();
129 }
130 } catch (const isc::MultiThreadingInvalidOperation& ex) {
132 .arg(ex.what());
133 // The exception needs to be propagated to the caller of the
134 // MultiThreadingCriticalSection constructor.
135 throw;
136 } catch (const exception& ex) {
138 .arg(ex.what());
139 }
140}
141
142void
144 // Since this function is used as CS callback all exceptions must be
145 // suppressed, unlikely though they may be.
146 try {
147 // Pause the thread pool.
148 if (thread_pool_) {
149 thread_pool_->pause();
150 }
151 } catch (const exception& ex) {
153 .arg(ex.what());
154 }
155}
156
157void
159 // Since this function is used as CS callback all exceptions must be
160 // suppressed, unlikely though they may be.
161 try {
162 if (thread_pool_) {
163 thread_pool_->run();
164 }
165 } catch (const exception& ex) {
167 .arg(ex.what());
168 }
169}
170
171void
173 MultiThreadingLock lock(mutex_);
174 exchange_list_.push_back(exchange);
175}
176
177void
179 MultiThreadingLock lock(mutex_);
180 exchange_list_.remove(exchange);
181}
182
183bool
185 MultiThreadingLock lock(mutex_);
186 return (exchange_list_.size() <= exchangeListMaxSize);
187}
188
189std::atomic<bool> RadiusImpl::shutdown_(false);
190
193 return (*instancePtr());
194}
195
196const RadiusImplPtr&
198 static RadiusImplPtr impl(new RadiusImpl());
199 return (impl);
200}
201
204 tls_(new RadiusTls()),
207 clientid_pop0_(false), clientid_printable_(false),
208 deadtime_(0), extract_duid_(true),
211 id_type4_(Host::IDENT_CLIENT_ID), id_type6_(Host::IDENT_DUID),
213 io_context_(new IOService()), io_service_(io_context_) {
214}
215
217 try {
218 cleanup();
219 } catch(exception const& exception) {
221 .arg(exception.what());
222 }
223}
224
226 if (udp_client_) {
227 udp_client_->registerExchange(exchange);
228 }
229}
230
232 if (udp_client_) {
233 udp_client_->unregisterExchange(exchange);
234 }
235}
236
238 if (udp_client_) {
239 return (udp_client_->checkExchangeListRoom());
240 }
241 return (true);
242}
243
248 timeout_ = 10;
249 retries_ = 3;
251 reselect_subnet_pool_ = false;
252 extract_duid_ = true;
253 clientid_printable_ = false;
254 clientid_pop0_ = false;
256 cache_.reset();
257 bindaddr_ = "*";
258 remap_.clear();
259
260 if (backend_) {
262 HostMgr::delBackend("radius");
263 backend_.reset();
264 }
265
266 if (udp_client_) {
267 udp_client_->stop();
268 }
269
270 if (tcp_client_) {
271 tcp_client_->stop();
272 }
273
274 tls_.reset(new RadiusTls());
275 auth_.reset(new RadiusAccess());
276 acct_.reset(new RadiusAccounting());
277
278 if (udp_client_) {
279 udp_client_.reset();
280 }
281
282 if (tcp_client_) {
283 tcp_client_.reset();
284 }
285
286 if (getIOContext()) {
287 getIOContext()->stopAndPoll();
288 }
289
290 io_context_.reset(new IOService());
291
292 if (getIOService()) {
293 getIOService()->stopAndPoll();
294 }
295
296 io_service_ = io_context_;
297}
298
301 std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(this), [](void*) { RadiusImpl::shutdown_ = false; });
302 cleanup();
303}
304
306 tls_.reset(new RadiusTls());
307 auth_.reset(new RadiusAccess());
308 acct_.reset(new RadiusAccounting());
309 RadiusConfigParser parser;
310 parser.parse(config);
313 if (auth_->enabled_) {
316 isc_throw(Unexpected, "Configuring access failed: host cache library not loaded.");
317 return;
318 }
319 backend_.reset(new RadiusBackend());
320 auto radius_factory = [this](const DatabaseConnection::ParameterMap&) {
321 return (backend_);
322 };
323 HostDataSourceFactory::registerFactory("radius", radius_factory);
324 }
325 if (acct_->enabled_) {
327 }
328}
329
330void
332 // Check if Kea core is multi-threaded.
333 ConstElementPtr const& dhcp_config(
334 CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading());
335 bool multi_threaded(false);
336 unsigned thread_pool_size(0);
337 uint32_t dhcp_threads(0);
338 uint32_t dummy_queue_size(0);
339 CfgMultiThreading::extract(dhcp_config, multi_threaded, dhcp_threads,
340 dummy_queue_size);
341
342 if (multi_threaded) {
343 // When threads are configured as zero, use the same number as DHCP
344 // threads. If that is also zero, auto-detect.
345 if (thread_pool_size_ == 0) {
346 if (dhcp_threads == 0) {
347 uint32_t const hardware_threads(
349 if (hardware_threads == 0) {
350 // Keep it single-threaded.
351 multi_threaded = false;
352 thread_pool_size = 0;
353 } else {
354 thread_pool_size = hardware_threads;
355 }
356 } else {
357 thread_pool_size = dhcp_threads;
358 }
359 } else {
360 thread_pool_size = thread_pool_size_;
361 }
362 }
363
364 if (multi_threaded) {
365 // Schedule a start of the services. This ensures we begin after
366 // the dust has settled and Kea MT mode has been firmly established.
367 if (proto_ == PW_PROTO_UDP) {
368 io_service_->post([this, thread_pool_size]() {
369 udp_client_.reset(new UdpClient(io_service_,
370 thread_pool_size));
371
372 io_context_ = udp_client_->getThreadIOService();
373
374 udp_client_->start();
375 });
376 } else {
377 io_service_->post([this, multi_threaded, thread_pool_size]() {
378 tcp_client_.reset(new TcpClient(io_service_,
379 multi_threaded,
380 thread_pool_size,
381 true));
382
383 io_context_ = tcp_client_->getThreadIOService();
384
385 tcp_client_->start();
386 });
387 }
388 } else {
389 if (proto_ == PW_PROTO_UDP) {
390 udp_client_.reset(new UdpClient(io_service_, 0));
391 } else {
392 tcp_client_.reset(new TcpClient(io_service_, false, 0));
393 }
394 }
395}
396
397bool
399 if (shutdown_) {
400 return (false);
401 }
402 if (!auth_ || !auth_->enabled_) {
403 return (false);
404 }
405 if (proto_ != PW_PROTO_TLS) {
406 return (true);
407 }
408 return (tls_ && tls_->enabled_);
409}
410
411bool
413 if (shutdown_) {
414 return (false);
415 }
416 if (!acct_ || !acct_->enabled_) {
417 return (false);
418 }
419 if (proto_ != PW_PROTO_TLS) {
420 return (true);
421 }
422 return (tls_ && tls_->enabled_);
423}
424
425const Servers&
427 if (proto_ != PW_PROTO_TLS) {
428 return (auth_->servers_);
429 } else {
430 return (tls_->servers_);
431 }
432}
433
434const Servers&
436 if (proto_ != PW_PROTO_TLS) {
437 return (acct_->servers_);
438 } else {
439 return (tls_->servers_);
440 }
441}
442
443void
445 if (shutdown_) {
446 return;
447 }
448 if (proto_ != PW_PROTO_TLS) {
449 auth_->setIdleTimer();
450 } else {
451 tls_->setIdleTimer();
452 }
453}
454
455void
457 if (shutdown_) {
458 return;
459 }
460 if (proto_ != PW_PROTO_TLS) {
461 acct_->setIdleTimer();
462 } else {
463 tls_->setIdleTimer();
464 }
465}
466
467namespace {
468
477bool isHostReservationModeGlobal(SubnetPtr subnet, NetworkPtr network) {
478 auto subnet_hr_global = subnet->getReservationsGlobal(Network::Inheritance::NONE);
479 auto subnet_hr_subnet = subnet->getReservationsInSubnet(Network::Inheritance::NONE);
480 if (!subnet_hr_global.unspecified() && !subnet_hr_subnet.unspecified()) {
481 return (subnet_hr_global && !subnet_hr_subnet);
482 }
483 if (!subnet_hr_global.unspecified() || !subnet_hr_subnet.unspecified()) {
484 return (false);
485 }
486 auto network_hr_global = network->getReservationsGlobal(Network::Inheritance::NONE);
487 auto network_hr_subnet = network->getReservationsInSubnet(Network::Inheritance::NONE);
488 if (!network_hr_global.unspecified() && !network_hr_subnet.unspecified()) {
489 return (network_hr_global && !network_hr_subnet);
490 }
491 if (!network_hr_global.unspecified() || !network_hr_subnet.unspecified()) {
492 return (false);
493 }
494 // Inherit from staging (vs current) config for globals.
495 auto global_hr_mode_elem = CfgMgr::instance().getStagingCfg()->
496 getConfiguredGlobal("reservations-global");
497 // Default reservations-global is false.
498 if (!global_hr_mode_elem) {
499 return (false);
500 }
501 auto subnet_hr_mode_elem = CfgMgr::instance().getStagingCfg()->
502 getConfiguredGlobal("reservations-in-subnet");
503 // Default reservations-in-subnet is true.
504 if (!subnet_hr_mode_elem) {
505 return (false);
506 }
507 if (global_hr_mode_elem->getType() != Element::boolean) {
508 isc_throw(Unexpected, "'reservations-global' global value must be a boolean");
509 }
510 if (!global_hr_mode_elem->boolValue()) {
511 return (false);
512 }
513 if (subnet_hr_mode_elem->getType() != Element::boolean) {
514 isc_throw(Unexpected, "'reservations-in-subnet' global value must be a boolean");
515 }
516 if (subnet_hr_mode_elem->boolValue()) {
517 return (false);
518 }
519 return (true);
520}
521
522} // end of anonymous namespace
523
525 auto flag = CfgMgr::instance().getStagingCfg()->
527 if (flag && (flag->boolValue())) {
528 isc_throw(ConfigError, "early-global-reservations-lookup is not "
529 "compatible with RADIUS");
530 }
531}
532
534 bool need_disable_single_query = false;
535 if (CfgMgr::instance().getFamily() == AF_INET) {
536 auto networks = CfgMgr::instance().getStagingCfg()->
537 getCfgSharedNetworks4()->getAll();
538 if (networks->empty()) {
539 return;
540 }
541 need_disable_single_query = true;
542 for (auto const& network : *networks) {
543 auto subnets = network->getAllSubnets();
544 if (subnets->size() <= 1) {
545 continue;
546 }
547 for (auto const& subnet : *subnets) {
548 if (!isHostReservationModeGlobal(subnet, network)) {
549 isc_throw(ConfigError, "subnet " << subnet->getID()
550 << " '" << subnet->toText() << "' of shared "
551 << "network " << network->getName()
552 << " does not use only global host reservations "
553 << "which are required for subnets in "
554 << "shared networks by RADIUS");
555 }
556 }
557 }
558 } else {
559 auto networks = CfgMgr::instance().getStagingCfg()->
560 getCfgSharedNetworks6()->getAll();
561 if (networks->empty()) {
562 return;
563 }
564 need_disable_single_query = true;
565 for (auto const& network : *networks) {
566 auto subnets = network->getAllSubnets();
567 if (subnets->size() <= 1) {
568 continue;
569 }
570 for (auto const& subnet : *subnets) {
571 if (!isHostReservationModeGlobal(subnet, network)) {
572 isc_throw(ConfigError, "subnet " << subnet->getID()
573 << " '" << subnet->toText() << "' of shared "
574 << "network " << network->getName()
575 << " does not use only global host reservations "
576 << "which are required for subnets in "
577 << "shared networks by RADIUS");
578 }
579 }
580 }
581 }
582 if (need_disable_single_query) {
584 }
585}
586
588 if (cache_) {
589 return (true);
590 }
591 // Try only once.
592 static bool already_tried = false;
593 if (already_tried) {
594 return (false);
595 }
596 already_tried = true;
597 // Add backends
598 try {
599 // createManagers can reset the host manager so re-add host cache.
600 // Note that init already checked the factory was registered.
601 if (!HostMgr::instance().getHostDataSource()) {
602 HostMgr::instance().addBackend("type=cache");
603 }
604 HostMgr::instance().addBackend("type=radius");
605 } catch (const std::exception& ex) {
607 .arg("radius")
608 .arg(ex.what());
609 return (false);
610 }
611 // Get a pointer to host cache backend
613 cache_ = boost::dynamic_pointer_cast<CacheHostDataSource>(cache);
614 if (!cache_) {
616 return (false);
617 }
618 return (true);
619}
620
623
624 // dictionary.
625 result->set("dictionary", Element::create(dictionary_));
626
627 // protocol.
628 result->set("protocol", Element::create(protocolToText(proto_)));
629
630 // bindaddr.
631 result->set("bindaddr", Element::create(bindaddr_));
632
633 // canonical-mac-address.
634 result->set("canonical-mac-address",
636
637 // client-id-pop0.
638 result->set("client-id-pop0", Element::create(clientid_pop0_));
639
640 // client-id-printable.
641 result->set("client-id-printable", Element::create(clientid_printable_));
642
643 // deadtime.
644 result->set("deadtime", Element::create(deadtime_));
645
646 // extract-duid.
647 result->set("extract-duid", Element::create(extract_duid_));
648
649 // identifier-type4.
650 result->set("identifier-type4",
652
653 // identifier-type6.
654 result->set("identifier-type6",
656
657 // reselect-subnet-address.
658 result->set("reselect-subnet-address",
660
661 // reselect-subnet-pool.
662 result->set("reselect-subnet-pool",
664
665 // retries.
666 result->set("retries", Element::create(retries_));
667
668 // session-history.
669 result->set("session-history", Element::create(session_history_filename_));
670
671 // thread-pool-size.
672 result->set("thread-pool-size", Element::create(thread_pool_size_));
673
674 // timeout.
675 result->set("timeout", Element::create(timeout_));
676
677 // use-message-authenticator.
678 result->set("use-message-authenticator",
680
681 // services.
682 if (proto_ == PW_PROTO_TLS) {
683 result->set("tls", tls_->toElement());
684 }
685 result->set("access", auth_->toElement());
686 result->set("accounting", acct_->toElement());
687
688 // NAS ports.
689 if (!remap_.empty()) {
691 for (auto const& item : remap_) {
693 if (item.first != 0) {
694 entry->set("subnet-id",
695 Element::create(static_cast<int64_t>(item.first)));
696 }
697 entry->set("port",
698 Element::create(static_cast<int64_t>(item.second)));
699 ports->add(entry);
700 }
701 result->set("nas-ports", ports);
702 }
703
704 return (result);
705}
706
707unordered_set<thread::id> InHook::set_;
708
709mutex InHook::mutex_;
710
712 const auto& id = this_thread::get_id();
713 MultiThreadingLock lock(mutex_);
714 auto ret = set_.insert(id);
715 if (!ret.second) {
716 std::cerr << "InHook insert error on " << id << "\n";
717 }
718}
719
721 const auto& id = this_thread::get_id();
722 MultiThreadingLock lock(mutex_);
723 size_t ret = set_.erase(id);
724 if (ret != 1) {
725 std::cerr << "InHook erase error on " << id << "\n";
726 }
727}
728
730 const auto& id = this_thread::get_id();
731 MultiThreadingLock lock(mutex_);
732 size_t ret = set_.count(id);
733 return (ret == 1);
734}
735
736} // end of namespace isc::radius
737} // end of namespace isc
static ElementPtr create(const Position &pos=ZERO_POSITION())
Create a NullElement.
Definition data.cc:300
@ boolean
Definition data.h:155
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:355
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:350
An exception that is thrown if an error occurs while configuring any server.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown when a worker thread is trying to stop or pause the respective thread pool (which wo...
A generic exception that is thrown when an unexpected error condition occurs.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
static CfgMgr & instance()
returns a single instance of Configuration Manager
Definition cfgmgr.cc:29
SrvConfigPtr getStagingCfg()
Returns a pointer to the staging configuration.
Definition cfgmgr.cc:121
static void extract(data::ConstElementPtr value, bool &enabled, uint32_t &thread_count, uint32_t &queue_size)
Extract multi-threading parameters from a given configuration.
static bool deregisterFactory(const std::string &db_type, bool no_log=false)
Deregister a host data source factory.
static bool registerFactory(const std::string &db_type, const Factory &factory, bool no_log=false, DBVersion db_version=DBVersion())
Register a host data source factory.
static bool registeredFactory(const std::string &db_type)
Check if a host data source factory was registered.
void setDisableSingleQuery(bool disable_single_query)
Sets the disable single query flag.
Definition host_mgr.h:802
static bool delBackend(const std::string &db_type)
Delete an alternate host backend (aka host data source).
Definition host_mgr.cc:62
static void addBackend(const std::string &access)
Add an alternate host backend (aka host data source).
Definition host_mgr.cc:57
HostDataSourcePtr getHostDataSource() const
Returns the first host data source.
Definition host_mgr.cc:84
static HostMgr & instance()
Returns a sole instance of the HostMgr.
Definition host_mgr.cc:114
Represents a device with IPv4 and/or IPv6 reservations.
Definition host.h:327
static std::string getIdentifierName(const IdentifierType &type)
Returns name of the identifier of a specified type.
Definition host.cc:356
@ IDENT_CLIENT_ID
Definition host.h:341
~InHook()
Destructor.
Definition radius.cc:720
static bool check()
Check if the current thread is in hook code or not.
Definition radius.cc:729
InHook()
Constructor.
Definition radius.cc:711
Radius access class.
Radius accounting class.
Host backend for Radius.
Configuration parser for Radius.
void parse(data::ElementPtr &config)
Parses Radius configuration.
Radius hooks library implementation.
Definition radius.h:151
static std::atomic< bool > shutdown_
Flag which indicates that the instance is shutting down.
Definition radius.h:356
unsigned thread_pool_size_
Thread pool size.
Definition radius.h:341
~RadiusImpl()
Destructor.
Definition radius.cc:216
void checkSharedNetworks()
Check shared network server configuration.
Definition radius.cc:533
std::string dictionary_
Dictionary path.
Definition radius.h:281
bool checkHostBackends()
Check host backends (cache and radius).
Definition radius.cc:587
RadiusImpl()
Protected constructor.
Definition radius.cc:202
boost::shared_ptr< RadiusTls > tls_
Pointer to tls (never null).
Definition radius.h:296
dhcp::CacheHostDataSourcePtr cache_
Host cache.
Definition radius.h:305
std::string bindaddr_
bindaddr.
Definition radius.h:311
bool clientid_pop0_
Client Id pop leading zero(s).
Definition radius.h:317
isc::asiolink::IOServicePtr getIOContext()
Get the hook I/O service.
Definition radius.h:234
void setAccountingIdleTimer()
Set the accounting idle timer.
Definition radius.cc:456
const Servers & getAccessServers() const
Get servers for access.
Definition radius.cc:426
dhcp::Host::IdentifierType id_type4_
Identifier type for IPv4.
Definition radius.h:347
void reset()
Reset the state as it was just created.
Definition radius.cc:299
void unregisterExchange(ExchangePtr exchange)
Unregister Exchange.
Definition radius.cc:231
bool reselect_subnet_address_
Reselect subnet using address.
Definition radius.h:332
void init(data::ElementPtr &config)
Initialize.
Definition radius.cc:305
void registerExchange(ExchangePtr exchange)
Register Exchange.
Definition radius.cc:225
boost::shared_ptr< RadiusAccess > auth_
Pointer to access (never null).
Definition radius.h:299
bool extract_duid_
Extract Duid from Client Id.
Definition radius.h:326
void startServices()
Start the I/O mechanisms.
Definition radius.cc:331
unsigned timeout_
Timeout.
Definition radius.h:344
dhcp::Host::IdentifierType id_type6_
Identifier type for IPv6.
Definition radius.h:350
bool canonical_mac_address_
Canonical MAC address.
Definition radius.h:314
unsigned deadtime_
Deadtime.
Definition radius.h:323
bool serveAccounting() const
Check if accounting is served.
Definition radius.cc:412
RadiusBackendPtr backend_
Radius backend.
Definition radius.h:308
boost::shared_ptr< RadiusAccounting > acct_
Pointer to accounting (never null).
Definition radius.h:302
void cleanup()
Clean up members.
Definition radius.cc:244
data::ElementPtr toElement() const override
Unparse implementation configuration.
Definition radius.cc:621
bool checkExchangeListRoom()
Check Exchange List Room.
Definition radius.cc:237
unsigned retries_
Retries.
Definition radius.h:335
std::map< uint32_t, uint32_t > remap_
Subnet ID to NAS port map.
Definition radius.h:293
UdpClientPtr udp_client_
UDP client.
Definition radius.h:287
static const RadiusImplPtr & instancePtr()
Returns pointer to the sole instance of radius implementation.
Definition radius.cc:197
const Servers & getAccountingServers() const
Get servers for accounting.
Definition radius.cc:435
std::string session_history_filename_
Session history filename.
Definition radius.h:338
void setAccessIdleTimer()
Set the access idle timer.
Definition radius.cc:444
bool reselect_subnet_pool_
Reselect subnet using pool.
Definition radius.h:329
isc::tcp::TcpClientPtr tcp_client_
TCP client.
Definition radius.h:290
void checkEarlyGlobalResvLookup()
Check the early global host reservations lookup flag.
Definition radius.cc:524
bool clientid_printable_
Client Id try printable.
Definition radius.h:320
RadiusProtocol proto_
Transport protocol.
Definition radius.h:284
isc::asiolink::IOServicePtr getIOService()
Get the hook I/O service.
Definition radius.h:248
static RadiusImpl & instance()
RadiusImpl is a singleton class.
Definition radius.cc:192
bool serveAccess() const
Check if access is served.
Definition radius.cc:398
bool use_message_authenticator_
Use Message-Authenticator attribute.
Definition radius.h:353
Radius service for TLS transport.
Definition radius_tls.h:16
UDP client class.
Definition radius.h:39
void registerExchange(ExchangePtr exchange)
Register Exchange.
Definition radius.cc:172
void unregisterExchange(ExchangePtr exchange)
Unregister Exchange.
Definition radius.cc:178
~UdpClient()
Destructor.
Definition radius.cc:79
const asiolink::IOServicePtr getThreadIOService() const
Fetches a pointer to the internal IOService used to drive the thread-pool in multi-threaded mode.
Definition radius.cc:89
void checkPermissions()
Check if the current thread can perform thread pool state transition.
Definition radius.cc:123
void resume()
Resumes running the client's thread pool.
Definition radius.cc:158
void stop()
Halts client-side IO activity.
Definition radius.cc:104
static size_t exchangeListMaxSize
Exchange List Maximum Size (currently the max(200,soft_limit/2)).
Definition radius.h:108
UdpClient(const asiolink::IOServicePtr &io_service, unsigned thread_pool_size=0)
Constructor.
Definition radius.cc:59
void pause()
Pauses the client's thread pool.
Definition radius.cc:143
void start()
Starts running the client's thread pool, if multi-threaded.
Definition radius.cc:94
bool checkExchangeListRoom()
Check Exchange List Room.
Definition radius.cc:184
unsigned getThreadPoolSize() const
Fetches the maximum size of the thread pool.
Definition radius.cc:84
TCP/TLS client class.
Definition tcp_client.h:80
static MultiThreadingMgr & instance()
Returns a single instance of Multi Threading Manager.
void removeCriticalSectionCallbacks(const std::string &name)
Removes the set of callbacks associated with a given name from the list of CriticalSection callbacks.
static uint32_t detectThreadCount()
The system current detected hardware concurrency thread count.
void addCriticalSectionCallbacks(const std::string &name, const CSCallbackSet::Callback &check_cb, const CSCallbackSet::Callback &entry_cb, const CSCallbackSet::Callback &exit_cb)
Adds a set of callbacks to the list of CriticalSection callbacks.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
Definition macros.h:32
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
Definition macros.h:20
#define LOG_WARN(LOGGER, MESSAGE)
Macro to conveniently test warn output and log it.
Definition macros.h:26
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
boost::shared_ptr< Element > ElementPtr
Definition data.h:29
boost::shared_ptr< BaseHostDataSource > HostDataSourcePtr
HostDataSource pointer.
boost::shared_ptr< Subnet > SubnetPtr
A generic pointer to either Subnet4 or Subnet6 object.
Definition subnet.h:446
boost::shared_ptr< Network > NetworkPtr
Pointer to the Network object.
Definition network.h:73
const isc::log::MessageID RADIUS_ACCESS_HOST_BACKEND_ERROR
const isc::log::MessageID RADIUS_RESUME_FAILED
boost::shared_ptr< RadiusImpl > RadiusImplPtr
Definition radius.h:148
std::vector< ServerPtr > Servers
Type of RADIUS server collection.
boost::shared_ptr< Exchange > ExchangePtr
Type of shared pointers to RADIUS exchange object.
const isc::log::MessageID RADIUS_CLEANUP_EXCEPTION
string protocolToText(const int proto)
Transport protocol to text.
const isc::log::MessageID RADIUS_PAUSE_FAILED
const isc::log::MessageID RADIUS_ACCESS_NO_HOST_CACHE
isc::log::Logger radius_logger("radius-hooks")
Radius Logger.
Definition radius_log.h:35
const isc::log::MessageID RADIUS_THREAD_POOL_STARTED
const isc::log::MessageID RADIUS_PAUSE_ILLEGAL
const isc::log::MessageID RADIUS_PAUSE_PERMISSIONS_FAILED
Defines the logger used by the top-level component of kea-lfc.
RAII lock object to protect the code in the same scope with a mutex.