Kea 3.3.3
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
11#include <dhcpsrv/cfgmgr.h>
13#include <dhcpsrv/host_mgr.h>
14#include <radius/radius.h>
18#include <radius/radius_tls.h>
20
21#include <exception>
22
23#include <radius_log.h>
24#include <sys/resource.h>
25
26using namespace std;
27using namespace isc;
28using namespace isc::asiolink;
29using namespace isc::data;
30using namespace isc::db;
31using namespace isc::dhcp;
32using namespace isc::tcp;
33using namespace isc::util;
34
35namespace isc {
36namespace radius {
37
39
40namespace {
41
43class ExchangeLimitInit {
44public:
46 ExchangeLimitInit() {
47 struct rlimit rlimit;
48 memset(&rlimit, 0, sizeof(rlimit));
49 if (getrlimit(RLIMIT_NOFILE, &rlimit) == 0) {
50 if (rlimit.rlim_cur / 2 > UdpClient::exchangeListMaxSize) {
51 UdpClient::exchangeListMaxSize = rlimit.rlim_cur / 2;
52 }
53 }
54 }
55};
56
57// Create one global object.
58ExchangeLimitInit init;
59} // end of anonymous namespace
60
61UdpClient::UdpClient(const IOServicePtr& io_service, unsigned thread_pool_size)
62 : io_service_(io_service), thread_pool_size_(thread_pool_size) {
63 // Do nothing in ST mode.
64 if (thread_pool_size == 0) {
65 return;
66 }
67
68 // Create our own private IOService.
69 thread_io_service_.reset(new IOService());
70 thread_pool_ =
71 boost::make_shared<IoServiceThreadPool>(thread_io_service_,
72 thread_pool_size_);
73
74 // Add critical section callbacks.
76 [this]() { checkPermissions(); },
77 [this]() { pause(); },
78 [this]() { resume(); });
79}
80
84
85unsigned
87 return (thread_pool_size_);
88}
89
92 return (thread_io_service_);
93}
94
95void
97 if (thread_pool_) {
98 thread_pool_->run();
99
101 .arg(thread_pool_size_);
102 }
103}
104
105void
107 if (thread_pool_) {
109 thread_pool_->stop();
110 for (auto const& exchange : exchange_list_) {
111 exchange->shutdown();
112 }
113 thread_pool_->getIOService()->stopAndPoll();
114 thread_pool_.reset();
115 } else {
116 for (auto const& exchange : exchange_list_) {
117 exchange->shutdown();
118 }
119 io_service_->stopAndPoll();
120 }
121 exchange_list_.clear();
122}
123
124void
126 // Since this function is used as CS callback all exceptions must be
127 // suppressed, unlikely though they may be.
128 try {
129 if (thread_pool_) {
130 thread_pool_->checkPausePermissions();
131 }
132 } catch (const isc::MultiThreadingInvalidOperation& ex) {
134 .arg(ex.what());
135 // The exception needs to be propagated to the caller of the
136 // MultiThreadingCriticalSection constructor.
137 throw;
138 } catch (const exception& ex) {
140 .arg(ex.what());
141 }
142}
143
144void
146 // Since this function is used as CS callback all exceptions must be
147 // suppressed, unlikely though they may be.
148 try {
149 // Pause the thread pool.
150 if (thread_pool_) {
151 thread_pool_->pause();
152 }
153 } catch (const exception& ex) {
155 .arg(ex.what());
156 }
157}
158
159void
161 // Since this function is used as CS callback all exceptions must be
162 // suppressed, unlikely though they may be.
163 try {
164 if (thread_pool_) {
165 thread_pool_->run();
166 }
167 } catch (const exception& ex) {
169 .arg(ex.what());
170 }
171}
172
173void
175 MultiThreadingLock lock(mutex_);
176 exchange_list_.push_back(exchange);
177}
178
179void
181 MultiThreadingLock lock(mutex_);
182 exchange_list_.remove(exchange);
183}
184
185bool
187 MultiThreadingLock lock(mutex_);
188 return (exchange_list_.size() <= exchangeListMaxSize);
189}
190
191std::atomic<bool> RadiusImpl::shutdown_(false);
192
195 return (*instancePtr());
196}
197
198const RadiusImplPtr&
200 static RadiusImplPtr impl(new RadiusImpl());
201 return (impl);
202}
203
206 tls_(new RadiusTls()),
209 clientid_pop0_(false), clientid_printable_(false),
210 deadtime_(0), extract_duid_(true),
213 id_type4_(Host::IDENT_CLIENT_ID), id_type6_(Host::IDENT_DUID),
215 io_context_(new IOService()), io_service_(io_context_) {
216}
217
219 try {
220 cleanup();
221 } catch(exception const& exception) {
223 .arg(exception.what());
224 }
225}
226
228 if (udp_client_) {
229 udp_client_->registerExchange(exchange);
230 }
231}
232
234 if (udp_client_) {
235 udp_client_->unregisterExchange(exchange);
236 }
237}
238
240 if (udp_client_) {
241 return (udp_client_->checkExchangeListRoom());
242 }
243 return (true);
244}
245
250 timeout_ = 10;
251 retries_ = 3;
253 reselect_subnet_pool_ = false;
254 extract_duid_ = true;
255 clientid_printable_ = false;
256 clientid_pop0_ = false;
258 cache_.reset();
259 bindaddr_ = "*";
260 remap_.clear();
261
262 if (backend_) {
264 HostMgr::delBackend("radius");
265 backend_.reset();
266 }
267
268 if (udp_client_) {
269 udp_client_->stop();
270 }
271
272 if (tcp_client_) {
273 tcp_client_->stop();
274 }
275
276 tls_.reset(new RadiusTls());
277 auth_.reset(new RadiusAccess());
278 acct_.reset(new RadiusAccounting());
279
280 if (udp_client_) {
281 udp_client_.reset();
282 }
283
284 if (tcp_client_) {
285 tcp_client_.reset();
286 }
287
288 if (getIOContext()) {
289 getIOContext()->stopAndPoll();
290 }
291
292 io_context_.reset(new IOService());
293
294 if (getIOService()) {
295 getIOService()->stopAndPoll();
296 }
297
298 io_service_ = io_context_;
299}
300
303 std::unique_ptr<void, void(*)(void*)> p(static_cast<void*>(this), [](void*) { RadiusImpl::shutdown_ = false; });
304 cleanup();
305}
306
308 tls_.reset(new RadiusTls());
309 auth_.reset(new RadiusAccess());
310 acct_.reset(new RadiusAccounting());
311 RadiusConfigParser parser;
312 parser.parse(config);
315 if (auth_->enabled_) {
318 isc_throw(Unexpected, "Configuring access failed: host cache library not loaded.");
319 return;
320 }
321 backend_.reset(new RadiusBackend());
322 auto radius_factory = [this](const DatabaseConnection::ParameterMap&) {
323 return (backend_);
324 };
325 HostDataSourceFactory::registerFactory("radius", radius_factory);
326 }
327 if (acct_->enabled_) {
329 }
330}
331
332void
334 // Check if Kea core is multi-threaded.
335 ConstElementPtr const& dhcp_config(
336 CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading());
337 bool multi_threaded(false);
338 unsigned thread_pool_size(0);
339 uint32_t dhcp_threads(0);
340 uint32_t dummy_queue_size(0);
341 CfgMultiThreading::extract(dhcp_config, multi_threaded, dhcp_threads,
342 dummy_queue_size);
343
344 if (multi_threaded) {
345 // When threads are configured as zero, use the same number as DHCP
346 // threads. If that is also zero, auto-detect.
347 if (thread_pool_size_ == 0) {
348 if (dhcp_threads == 0) {
349 uint32_t const hardware_threads(
351 if (hardware_threads == 0) {
352 // Keep it single-threaded.
353 multi_threaded = false;
354 thread_pool_size = 0;
355 } else {
356 thread_pool_size = hardware_threads;
357 }
358 } else {
359 thread_pool_size = dhcp_threads;
360 }
361 } else {
362 thread_pool_size = thread_pool_size_;
363 }
364 }
365
366 if (multi_threaded) {
367 // Schedule a start of the services. This ensures we begin after
368 // the dust has settled and Kea MT mode has been firmly established.
369 if (proto_ == PW_PROTO_UDP) {
370 io_service_->post([this, thread_pool_size]() {
371 udp_client_.reset(new UdpClient(io_service_,
372 thread_pool_size));
373
374 io_context_ = udp_client_->getThreadIOService();
375
376 udp_client_->start();
377 });
378 } else {
379 io_service_->post([this, multi_threaded, thread_pool_size]() {
380 tcp_client_.reset(new TcpClient(io_service_,
381 multi_threaded,
382 thread_pool_size,
383 true));
384
385 io_context_ = tcp_client_->getThreadIOService();
386
387 tcp_client_->start();
388 });
389 }
390 } else {
391 if (proto_ == PW_PROTO_UDP) {
392 udp_client_.reset(new UdpClient(io_service_, 0));
393 } else {
394 tcp_client_.reset(new TcpClient(io_service_, false, 0));
395 }
396 }
397}
398
399bool
401 if (shutdown_) {
402 return (false);
403 }
404 if (!auth_ || !auth_->enabled_) {
405 return (false);
406 }
407 if (proto_ != PW_PROTO_TLS) {
408 return (true);
409 }
410 return (tls_ && tls_->enabled_);
411}
412
413bool
415 if (shutdown_) {
416 return (false);
417 }
418 if (!acct_ || !acct_->enabled_) {
419 return (false);
420 }
421 if (proto_ != PW_PROTO_TLS) {
422 return (true);
423 }
424 return (tls_ && tls_->enabled_);
425}
426
427const Servers&
429 if (proto_ != PW_PROTO_TLS) {
430 return (auth_->servers_);
431 } else {
432 return (tls_->servers_);
433 }
434}
435
436const Servers&
438 if (proto_ != PW_PROTO_TLS) {
439 return (acct_->servers_);
440 } else {
441 return (tls_->servers_);
442 }
443}
444
445void
447 if (shutdown_) {
448 return;
449 }
450 if (proto_ != PW_PROTO_TLS) {
451 auth_->setIdleTimer();
452 } else {
453 tls_->setIdleTimer();
454 }
455}
456
457void
459 if (shutdown_) {
460 return;
461 }
462 if (proto_ != PW_PROTO_TLS) {
463 acct_->setIdleTimer();
464 } else {
465 tls_->setIdleTimer();
466 }
467}
468
469namespace {
470
479bool isHostReservationModeGlobal(SubnetPtr subnet, NetworkPtr network) {
480 auto subnet_hr_global = subnet->getReservationsGlobal(Network::Inheritance::NONE);
481 auto subnet_hr_subnet = subnet->getReservationsInSubnet(Network::Inheritance::NONE);
482 if (!subnet_hr_global.unspecified() && !subnet_hr_subnet.unspecified()) {
483 return (subnet_hr_global && !subnet_hr_subnet);
484 }
485 if (!subnet_hr_global.unspecified() || !subnet_hr_subnet.unspecified()) {
486 return (false);
487 }
488 auto network_hr_global = network->getReservationsGlobal(Network::Inheritance::NONE);
489 auto network_hr_subnet = network->getReservationsInSubnet(Network::Inheritance::NONE);
490 if (!network_hr_global.unspecified() && !network_hr_subnet.unspecified()) {
491 return (network_hr_global && !network_hr_subnet);
492 }
493 if (!network_hr_global.unspecified() || !network_hr_subnet.unspecified()) {
494 return (false);
495 }
496 // Inherit from staging (vs current) config for globals.
497 auto global_hr_mode_elem = CfgMgr::instance().getStagingCfg()->
498 getConfiguredGlobal("reservations-global");
499 // Default reservations-global is false.
500 if (!global_hr_mode_elem) {
501 return (false);
502 }
503 auto subnet_hr_mode_elem = CfgMgr::instance().getStagingCfg()->
504 getConfiguredGlobal("reservations-in-subnet");
505 // Default reservations-in-subnet is true.
506 if (!subnet_hr_mode_elem) {
507 return (false);
508 }
509 if (global_hr_mode_elem->getType() != Element::boolean) {
510 isc_throw(Unexpected, "'reservations-global' global value must be a boolean");
511 }
512 if (!global_hr_mode_elem->boolValue()) {
513 return (false);
514 }
515 if (subnet_hr_mode_elem->getType() != Element::boolean) {
516 isc_throw(Unexpected, "'reservations-in-subnet' global value must be a boolean");
517 }
518 if (subnet_hr_mode_elem->boolValue()) {
519 return (false);
520 }
521 return (true);
522}
523
524} // end of anonymous namespace
525
527 auto flag = CfgMgr::instance().getStagingCfg()->
529 if (flag && (flag->boolValue())) {
530 isc_throw(ConfigError, "early-global-reservations-lookup is not "
531 "compatible with RADIUS");
532 }
533}
534
536 bool need_disable_single_query = false;
537 if (CfgMgr::instance().getFamily() == AF_INET) {
538 auto networks = CfgMgr::instance().getStagingCfg()->
539 getCfgSharedNetworks4()->getAll();
540 if (networks->empty()) {
541 return;
542 }
543 need_disable_single_query = true;
544 for (auto const& network : *networks) {
545 auto subnets = network->getAllSubnets();
546 if (subnets->size() <= 1) {
547 continue;
548 }
549 for (auto const& subnet : *subnets) {
550 if (!isHostReservationModeGlobal(subnet, network)) {
551 isc_throw(ConfigError, "subnet " << subnet->getID()
552 << " '" << subnet->toText() << "' of shared "
553 << "network " << network->getName()
554 << " does not use only global host reservations "
555 << "which are required for subnets in "
556 << "shared networks by RADIUS");
557 }
558 }
559 }
560 } else {
561 auto networks = CfgMgr::instance().getStagingCfg()->
562 getCfgSharedNetworks6()->getAll();
563 if (networks->empty()) {
564 return;
565 }
566 need_disable_single_query = true;
567 for (auto const& network : *networks) {
568 auto subnets = network->getAllSubnets();
569 if (subnets->size() <= 1) {
570 continue;
571 }
572 for (auto const& subnet : *subnets) {
573 if (!isHostReservationModeGlobal(subnet, network)) {
574 isc_throw(ConfigError, "subnet " << subnet->getID()
575 << " '" << subnet->toText() << "' of shared "
576 << "network " << network->getName()
577 << " does not use only global host reservations "
578 << "which are required for subnets in "
579 << "shared networks by RADIUS");
580 }
581 }
582 }
583 }
584 if (need_disable_single_query) {
586 }
587}
588
590 if (cache_) {
591 return (true);
592 }
593 // Try only once.
594 static bool already_tried = false;
595 if (already_tried) {
596 return (false);
597 }
598 already_tried = true;
599 // Add backends
600 try {
601 // createManagers can reset the host manager so re-add host cache.
602 // Note that init already checked the factory was registered.
603 if (!HostMgr::instance().getHostDataSource()) {
604 HostMgr::instance().addBackend("type=cache");
605 }
606 HostMgr::instance().addBackend("type=radius");
607 } catch (const std::exception& ex) {
609 .arg("radius")
610 .arg(ex.what());
611 return (false);
612 }
613 // Get a pointer to host cache backend
615 cache_ = boost::dynamic_pointer_cast<CacheHostDataSource>(cache);
616 if (!cache_) {
618 return (false);
619 }
620 return (true);
621}
622
625
626 // dictionary.
627 result->set("dictionary", Element::create(dictionary_));
628
629 // protocol.
630 result->set("protocol", Element::create(protocolToText(proto_)));
631
632 // bindaddr.
633 result->set("bindaddr", Element::create(bindaddr_));
634
635 // canonical-mac-address.
636 result->set("canonical-mac-address",
638
639 // client-id-pop0.
640 result->set("client-id-pop0", Element::create(clientid_pop0_));
641
642 // client-id-printable.
643 result->set("client-id-printable", Element::create(clientid_printable_));
644
645 // deadtime.
646 result->set("deadtime", Element::create(deadtime_));
647
648 // extract-duid.
649 result->set("extract-duid", Element::create(extract_duid_));
650
651 // identifier-type4.
652 result->set("identifier-type4",
654
655 // identifier-type6.
656 result->set("identifier-type6",
658
659 // reselect-subnet-address.
660 result->set("reselect-subnet-address",
662
663 // reselect-subnet-pool.
664 result->set("reselect-subnet-pool",
666
667 // retries.
668 result->set("retries", Element::create(retries_));
669
670 // session-history.
671 result->set("session-history", Element::create(session_history_filename_));
672
673 // thread-pool-size.
674 result->set("thread-pool-size", Element::create(thread_pool_size_));
675
676 // timeout.
677 result->set("timeout", Element::create(timeout_));
678
679 // use-message-authenticator.
680 result->set("use-message-authenticator",
682
683 // services.
684 if (proto_ == PW_PROTO_TLS) {
685 result->set("tls", tls_->toElement());
686 }
687 result->set("access", auth_->toElement());
688 result->set("accounting", acct_->toElement());
689
690 // NAS ports.
691 if (!remap_.empty()) {
693 for (auto const& item : remap_) {
695 if (item.first != 0) {
696 entry->set("subnet-id",
697 Element::create(static_cast<int64_t>(item.first)));
698 }
699 entry->set("port",
700 Element::create(static_cast<int64_t>(item.second)));
701 ports->add(entry);
702 }
703 result->set("nas-ports", ports);
704 }
705
706 return (result);
707}
708
709unordered_set<thread::id> InHook::set_;
710
711mutex InHook::mutex_;
712
714 const auto& id = this_thread::get_id();
715 MultiThreadingLock lock(mutex_);
716 auto ret = set_.insert(id);
717 if (!ret.second) {
718 std::cerr << "InHook insert error on " << id << "\n";
719 }
720}
721
723 const auto& id = this_thread::get_id();
724 MultiThreadingLock lock(mutex_);
725 size_t ret = set_.erase(id);
726 if (ret != 1) {
727 std::cerr << "InHook erase error on " << id << "\n";
728 }
729}
730
732 const auto& id = this_thread::get_id();
733 MultiThreadingLock lock(mutex_);
734 size_t ret = set_.count(id);
735 return (ret == 1);
736}
737
738} // end of namespace isc::radius
739} // 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:804
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:330
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:344
~InHook()
Destructor.
Definition radius.cc:722
static bool check()
Check if the current thread is in hook code or not.
Definition radius.cc:731
InHook()
Constructor.
Definition radius.cc:713
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:218
void checkSharedNetworks()
Check shared network server configuration.
Definition radius.cc:535
std::string dictionary_
Dictionary path.
Definition radius.h:281
bool checkHostBackends()
Check host backends (cache and radius).
Definition radius.cc:589
RadiusImpl()
Protected constructor.
Definition radius.cc:204
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:458
const Servers & getAccessServers() const
Get servers for access.
Definition radius.cc:428
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:301
void unregisterExchange(ExchangePtr exchange)
Unregister Exchange.
Definition radius.cc:233
bool reselect_subnet_address_
Reselect subnet using address.
Definition radius.h:332
void init(data::ElementPtr &config)
Initialize.
Definition radius.cc:307
void registerExchange(ExchangePtr exchange)
Register Exchange.
Definition radius.cc:227
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:333
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:414
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:246
data::ElementPtr toElement() const override
Unparse implementation configuration.
Definition radius.cc:623
bool checkExchangeListRoom()
Check Exchange List Room.
Definition radius.cc:239
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:199
const Servers & getAccountingServers() const
Get servers for accounting.
Definition radius.cc:437
std::string session_history_filename_
Session history filename.
Definition radius.h:338
void setAccessIdleTimer()
Set the access idle timer.
Definition radius.cc:446
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:526
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:194
bool serveAccess() const
Check if access is served.
Definition radius.cc:400
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:174
void unregisterExchange(ExchangePtr exchange)
Unregister Exchange.
Definition radius.cc:180
~UdpClient()
Destructor.
Definition radius.cc:81
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:91
void checkPermissions()
Check if the current thread can perform thread pool state transition.
Definition radius.cc:125
void resume()
Resumes running the client's thread pool.
Definition radius.cc:160
void stop()
Halts client-side IO activity.
Definition radius.cc:106
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:61
void pause()
Pauses the client's thread pool.
Definition radius.cc:145
void start()
Starts running the client's thread pool, if multi-threaded.
Definition radius.cc:96
bool checkExchangeListRoom()
Check Exchange List Room.
Definition radius.cc:186
unsigned getThreadPoolSize() const
Fetches the maximum size of the thread pool.
Definition radius.cc:86
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.