Kea 2.5.4
cfg_iface.cc
Go to the documentation of this file.
1// Copyright (C) 2014-2022 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#include <dhcp/iface_mgr.h>
10#include <dhcpsrv/cfg_iface.h>
11#include <dhcpsrv/timer_mgr.h>
12#include <util/reconnect_ctl.h>
14#include <util/strutil.h>
15#include <algorithm>
16#include <functional>
17
18using namespace isc::asiolink;
19using namespace isc::data;
20using namespace isc::util;
21namespace ph = std::placeholders;
22
23namespace isc {
24namespace dhcp {
25
26const char* CfgIface::ALL_IFACES_KEYWORD = "*";
27
29
31 : wildcard_used_(false), socket_type_(SOCKET_RAW), re_detect_(false),
32 service_socket_require_all_(false), service_sockets_retry_wait_time_(5000),
33 service_sockets_max_retries_(0),
34 outbound_iface_(SAME_AS_INBOUND) {
35}
36
37void
40}
41
42bool
43CfgIface::equals(const CfgIface& other) const {
44 return (iface_set_ == other.iface_set_ &&
45 address_map_ == other.address_map_ &&
46 wildcard_used_ == other.wildcard_used_ &&
47 socket_type_ == other.socket_type_);
48}
49
50bool
51CfgIface::multipleAddressesPerInterfaceActive() {
52 for (IfacePtr iface : IfaceMgr::instance().getIfaces()) {
53 if (iface->countActive4() > 1) {
54 return (true);
55 }
56 }
57 return (false);
58}
59
60void
61CfgIface::openSockets(const uint16_t family, const uint16_t port,
62 const bool use_bcast) {
63 // Close any open sockets because we're going to modify some properties
64 // of the IfaceMgr. Those modifications require that sockets are closed.
66 // The loopback interface can be used only when:
67 // - UDP socket will be used, i.e. not IPv4 and RAW socket
68 // - the loopback interface is in the interface set or the address map.
69 bool loopback_used_ = false;
70 if ((family == AF_INET6) || (socket_type_ == SOCKET_UDP)) {
71 // Check interface set
72 for (IfaceSet::const_iterator iface_name = iface_set_.begin();
73 iface_name != iface_set_.end(); ++iface_name) {
74 IfacePtr iface = IfaceMgr::instance().getIface(*iface_name);
75 if (iface && iface->flag_loopback_) {
76 loopback_used_ = true;
77 }
78 }
79 // Check address map
80 for (ExplicitAddressMap::const_iterator unicast = address_map_.begin();
81 unicast != address_map_.end(); ++unicast) {
82 IfacePtr iface = IfaceMgr::instance().getIface(unicast->first);
83 if (iface && iface->flag_loopback_) {
84 loopback_used_ = true;
85 }
86 }
87 }
88 // If wildcard interface '*' was not specified, set all interfaces to
89 // inactive state. We will later enable them selectively using the
90 // interface names specified by the user. If wildcard interface was
91 // specified, mark all interfaces active. Mark loopback inactive when
92 // not explicitly allowed.
93 setState(family, !wildcard_used_, !loopback_used_);
94 IfaceMgr& iface_mgr = IfaceMgr::instance();
95 // Remove selection of unicast addresses from all interfaces.
96 iface_mgr.clearUnicasts();
97 // Allow the loopback interface when required.
98 iface_mgr.setAllowLoopBack(loopback_used_);
99 // For the DHCPv4 server, if the user has selected that raw sockets
100 // should be used, we will try to configure the Interface Manager to
101 // support the direct responses to the clients that don't have the
102 // IP address. This should effectively turn on the use of raw
103 // sockets. However, this may be unsupported on some operating
104 // systems, so there is no guarantee.
105 if ((family == AF_INET) && (!IfaceMgr::instance().isTestMode())) {
106 iface_mgr.setMatchingPacketFilter(socket_type_ == SOCKET_RAW);
107 if ((socket_type_ == SOCKET_RAW) &&
108 !iface_mgr.isDirectResponseSupported()) {
110 }
111 }
112 // If there is no wildcard interface specified, we will have to iterate
113 // over the names specified by the caller and enable them.
114 if (!wildcard_used_) {
115 for (IfaceSet::const_iterator iface_name = iface_set_.begin();
116 iface_name != iface_set_.end(); ++iface_name) {
117 IfacePtr iface = IfaceMgr::instance().getIface(*iface_name);
118 // This shouldn't really happen because we are checking the
119 // names of interfaces when they are being added (use()
120 // function). But, if someone has triggered detection of
121 // interfaces since then, some interfaces may have disappeared.
122 if (iface == NULL) {
124 "fail to open socket on interface '"
125 << *iface_name << "' as this interface doesn't"
126 " exist");
127
128 } else if (family == AF_INET) {
129 iface->inactive4_ = false;
130 setIfaceAddrsState(family, true, *iface);
131
132 } else {
133 iface->inactive6_ = false;
134 }
135 }
136 }
137
138 // Select unicast sockets for DHCPv6 or activate specific IPv4 addresses
139 // for DHCPv4.
140 for (ExplicitAddressMap::const_iterator unicast = address_map_.begin();
141 unicast != address_map_.end(); ++unicast) {
142 IfacePtr iface = IfaceMgr::instance().getIface(unicast->first);
143 if (iface == NULL) {
145 "fail to open unicast socket on interface '"
146 << unicast->first << "' as this interface doesn't"
147 " exist");
148 }
149 if (family == AF_INET6) {
150 iface->addUnicast(unicast->second);
151 iface->inactive6_ = false;
152
153 } else {
154 iface->setActive(unicast->second, true);
155 iface->inactive4_ = false;
156 }
157 }
158
159 // Use broadcast only if we're using raw sockets. For the UDP sockets,
160 // we only handle the relayed (unicast) traffic.
161 const bool can_use_bcast = use_bcast && (socket_type_ == SOCKET_RAW);
162
163 // Opening multiple raw sockets handling brodcast traffic on the single
164 // interface may lead to processing the same message multiple times.
165 // We don't prohibit such configuration because raw sockets can as well
166 // handle the relayed traffic. We have to issue a warning, however, to
167 // draw administrator's attention.
168 if (family == AF_INET && can_use_bcast && multipleAddressesPerInterfaceActive()) {
170 }
171
172 reconnect_ctl_ = makeReconnectCtl();
173 auto sopen = openSocketsWithRetry(reconnect_ctl_, family, port, can_use_bcast);
174
175 if (!sopen) {
176 // If no socket were opened, log a warning because the server will
177 // not respond to any queries.
179 }
180}
181
182std::pair<bool, bool>
183CfgIface::openSocketsForFamily(const uint16_t family, const uint16_t port,
184 const bool can_use_bcast, const bool skip_opened) {
185 bool no_errors = true;
186
187 // Set the callbacks which are called when the socket fails to open
188 // for some specific interface.
189 auto error_callback = [&no_errors](const std::string& errmsg) {
190 socketOpenErrorHandler(errmsg);
191 no_errors = false;
192 };
193
195
196 bool sopen = false;
197 if (family == AF_INET) {
198 sopen = IfaceMgr::instance().openSockets4(port, can_use_bcast,
199 error_callback, skip_opened);
200 } else {
201 // use_bcast is ignored for V6.
202 sopen = IfaceMgr::instance().openSockets6(port, error_callback,
203 skip_opened);
204 }
205
206 return (std::make_pair(sopen, no_errors));
207}
208
209ReconnectCtlPtr CfgIface::makeReconnectCtl() const {
210 // Create unique timer name per instance.
211 std::string timer_name = "SocketReopenTimer";
212
213 auto on_fail_action = OnFailAction::SERVE_RETRY_CONTINUE;
215 on_fail_action = OnFailAction::SERVE_RETRY_EXIT;
216 }
217
218 // Add one attempt for an initial call.
219 auto reconnect_ctl = boost::make_shared<ReconnectCtl>("Socket", timer_name,
222 on_fail_action);
223
224 return (reconnect_ctl);
225}
226
227bool
228CfgIface::openSocketsWithRetry(ReconnectCtlPtr reconnect_ctl,
229 const uint16_t family, const uint16_t port,
230 const bool can_use_bcast) {
232
233 // Skip opened sockets in the retry calls.
234 bool is_initial_call = (reconnect_ctl->retriesLeft() == reconnect_ctl->maxRetries());
235 auto result_pair = openSocketsForFamily(family, port, can_use_bcast, !is_initial_call);
236 bool sopen = result_pair.first;
237 bool has_errors = !result_pair.second;
238
239 auto timer_name = reconnect_ctl->timerName();
240
241 // On the initial call, unregister the previous, pending timer.
242 if (is_initial_call && TimerMgr::instance()->isTimerRegistered(timer_name)) {
243 TimerMgr::instance()->unregisterTimer(timer_name);
244 }
245
246 // Has errors and can retry
247 if (has_errors && reconnect_ctl->retriesLeft() > 0) {
248 // Initial call is excluded from retries counter.
249 reconnect_ctl->checkRetries();
250 // Start the timer.
251 if (!TimerMgr::instance()->isTimerRegistered(timer_name)) {
252 TimerMgr::instance()->registerTimer(timer_name,
253 std::bind(&CfgIface::openSocketsWithRetry,
254 reconnect_ctl, family,
255 port, can_use_bcast),
256 reconnect_ctl->retryInterval(),
258 }
259 TimerMgr::instance()->setup(timer_name);
260 } else {
261 // Cancel the timer.
262 if (TimerMgr::instance()->isTimerRegistered(timer_name)) {
263 TimerMgr::instance()->unregisterTimer(timer_name);
264 }
265 // Has errors but retries exceed
266 if (has_errors) {
268 open_sockets_failed_callback_(reconnect_ctl);
269 }
270 }
271 }
272
273 return (sopen);
274}
275
276void
278 wildcard_used_ = false;
279 iface_set_.clear();
280 address_map_.clear();
281 useSocketType(AF_INET, SOCKET_RAW);
282}
283
284void
285CfgIface::setState(const uint16_t family, const bool inactive,
286 const bool loopback_inactive) const {
287 for (IfacePtr iface : IfaceMgr::instance().getIfaces()) {
288 bool iface_inactive = iface->flag_loopback_ ? loopback_inactive : inactive;
289 if (family == AF_INET) {
290 iface->inactive4_ = iface_inactive;
291 } else {
292 iface->inactive6_ = iface_inactive;
293 }
294
295 // Activate/deactivate all addresses.
296 setIfaceAddrsState(family, !inactive, *iface);
297 }
298}
299
300void
301CfgIface::setIfaceAddrsState(const uint16_t family, const bool active,
302 Iface& iface) const {
303 // Activate/deactivate all addresses.
304 for (Iface::Address addr : iface.getAddresses()) {
305 if (addr.get().getFamily() == family) {
306 iface.setActive(addr.get(), active);
307 }
308 }
309}
310
311void
312CfgIface::socketOpenErrorHandler(const std::string& errmsg) {
314}
315
316std::string
318 switch (socket_type_) {
319 case SOCKET_RAW:
320 return ("raw");
321
322 case SOCKET_UDP:
323 return ("udp");
324
325 default:
326 ;
327 }
328
329 isc_throw(Unexpected, "unsupported socket type " << socket_type_);
330}
331
333CfgIface::textToSocketType(const std::string& socket_type_name) const {
334 if (socket_type_name == "udp") {
335 return (SOCKET_UDP);
336
337 } else if (socket_type_name == "raw") {
338 return (SOCKET_RAW);
339
340 } else {
341 isc_throw(InvalidSocketType, "unsupported socket type '"
342 << socket_type_name << "'");
343 }
344}
345
348 return (outbound_iface_);
349}
350
351std::string
353 switch (outbound_iface_) {
354 case SAME_AS_INBOUND:
355 return ("same-as-inbound");
356 case USE_ROUTING:
357 return ("use-routing");
358 default:
359 isc_throw(Unexpected, "unsupported outbound-type " << socket_type_);
360 }
361
362}
363
365CfgIface::textToOutboundIface(const std::string& txt) {
366 if (txt == "same-as-inbound") {
367 return (SAME_AS_INBOUND);
368
369 } else if (txt == "use-routing") {
370 return (USE_ROUTING);
371
372 } else {
373 isc_throw(BadValue, "unsupported outbound interface type '"
374 << txt << "'");
375 }
376}
377
378void
380 outbound_iface_ = outbound_iface;
381}
382
383void
384CfgIface::use(const uint16_t family, const std::string& iface_name) {
385 // The interface name specified may have two formats:
386 // - "interface-name", e.g. eth0
387 // - "interface-name/address", e.g. eth0/10.0.0.1 or eth/2001:db8:1::1
388 // The latter format is used to open unicast socket on the specified
389 // interface. Here we are detecting which format was used and we strip
390 // all extraneous spaces.
391 size_t pos = iface_name.find("/");
392 std::string name;
393 std::string addr_str;
394 // There is no unicast address so the whole string is an interface name.
395 if (pos == std::string::npos) {
396 name = util::str::trim(iface_name);
397 if (name.empty()) {
399 "empty interface name used in configuration");
400
401 } else if (name != ALL_IFACES_KEYWORD) {
402 if (IfaceMgr::instance().getIface(name) == NULL) {
403 isc_throw(NoSuchIface, "interface '" << name
404 << "' doesn't exist in the system");
405 }
406
407 } else if (wildcard_used_) {
408 isc_throw(DuplicateIfaceName, "the wildcard interface '"
409 << ALL_IFACES_KEYWORD << "' can only be specified once");
410
411 } else {
414 wildcard_used_ = true;
415
416 }
417
418 } else {
419 // The interface name includes the address on which the socket should
420 // be opened, and we need to split interface name and the address to
421 // two variables.
422 name = util::str::trim(iface_name.substr(0, pos));
423 addr_str = util::str::trim(iface_name.substr(pos + 1));
424
425 // Interface name must not be empty.
426 if (name.empty()) {
428 "empty interface name specified in the"
429 " interface configuration");
430
431 }
432 // An address following the interface name must not be empty.
433 if (addr_str.empty()) {
435 "empty address specified in the interface"
436 << " configuration");
437
438 }
439
440 // Interface name must not be the wildcard name.
441 if (name == ALL_IFACES_KEYWORD) {
443 "wildcard interface name '" << ALL_IFACES_KEYWORD
444 << "' must not be used in conjunction with an"
445 " address");
446
447 }
448
449 // Interface must exist.
450 IfacePtr iface = IfaceMgr::instance().getIface(name);
451 if (!iface) {
452 isc_throw(NoSuchIface, "interface '" << name
453 << "' doesn't exist in the system");
454
455 }
456
457 // Convert address string. This may throw an exception if the address
458 // is invalid.
459 IOAddress addr(addr_str);
460
461 // Validate V6 address.
462 if (family == AF_INET6) {
463 // Check that the address is a valid unicast address.
464 if (!addr.isV6() || addr.isV6Multicast()) {
465 isc_throw(InvalidIfaceName, "address '" << addr << "' is not"
466 " a valid IPv6 unicast address");
467 }
468
469 // There are valid cases where link local address can be specified to
470 // receive unicast traffic, e.g. sent by relay agent.
471 if (addr.isV6LinkLocal()) {
473 .arg(addr.toText()).arg(name);
474 }
475
476 } else {
477 if (!addr.isV4()) {
478 isc_throw(InvalidIfaceName, "address '" << addr << "' is not"
479 " a valid IPv4 address");
480 }
481 }
482
483 // Interface must have this address assigned.
484 if (!iface->hasAddress(addr)) {
486 "interface '" << name << "' doesn't have address '"
487 << addr << "' assigned");
488 }
489
490 // For the IPv4, if the interface name was specified (instead of the interface-
491 // address tuple) all addresses are already activated. Adding an explicit address
492 // for the interface should result in error.
493 if ((family == AF_INET) && (iface_set_.find(iface->getName()) != iface_set_.end())) {
494 isc_throw(DuplicateIfaceName, "interface '" << iface->getName()
495 << "' has already been selected");
496 }
497
498 // Check if the address hasn't been selected already.
499 std::pair<const std::string, IOAddress> iface_address_tuple(name, addr);
500 if (std::find(address_map_.begin(), address_map_.end(),
501 iface_address_tuple) != address_map_.end()) {
502 isc_throw(DuplicateAddress, "must not select address '"
503 << addr << "' for interface '" << name << "' "
504 "because this address is already selected");
505 }
506
507 if (family == AF_INET6) {
509 .arg(addr.toText()).arg(name);
510
511 } else {
513 .arg(addr.toText()).arg(name);
514 }
515 address_map_.insert(std::pair<std::string, IOAddress>(name, addr));
516 }
517
518 // If interface name was explicitly specified without an address, we will
519 // insert the interface name to the set of enabled interfaces.
520 if ((name != ALL_IFACES_KEYWORD) && addr_str.empty()) {
521 // An interface has been selected or an IPv4 address on this interface
522 // has been selected it is not allowed to select the whole interface.
523 if ((iface_set_.find(name) != iface_set_.end()) ||
524 ((family == AF_INET) && address_map_.count(name) > 0)) {
525 isc_throw(DuplicateIfaceName, "interface '" << name
526 << "' has already been specified");
527 }
528
529 // Log that we're listening on the specific interface and that the
530 // address is not explicitly specified.
531 if (addr_str.empty()) {
533 }
534 iface_set_.insert(name);
535 }
536}
537
538void
539CfgIface::useSocketType(const uint16_t family,
540 const SocketType& socket_type) {
541 if (family != AF_INET) {
542 isc_throw(InvalidSocketType, "socket type must not be specified for"
543 " the DHCPv6 server");
544 }
545 socket_type_ = socket_type;
547 .arg(socketTypeToText());
548}
549
550void
551CfgIface::useSocketType(const uint16_t family,
552 const std::string& socket_type_name) {
553 useSocketType(family, textToSocketType(socket_type_name));
554}
555
559
560 // Set user context
561 contextToElement(result);
562
563 // Set interfaces
565 if (wildcard_used_) {
566 ifaces->add(Element::create(std::string(ALL_IFACES_KEYWORD)));
567 }
568 for (IfaceSet::const_iterator iface = iface_set_.cbegin();
569 iface != iface_set_.cend(); ++iface) {
570 ifaces->add(Element::create(*iface));
571 }
572 for (ExplicitAddressMap::const_iterator address = address_map_.cbegin();
573 address != address_map_.cend(); ++address) {
574 std::string spec = address->first + "/" + address->second.toText();
575 ifaces->add(Element::create(spec));
576 }
577 result->set("interfaces", ifaces);
578
579 // Set dhcp-socket-type (no default because it is DHCPv4 specific)
580 // @todo emit raw if and only if DHCPv4
581 if (socket_type_ != SOCKET_RAW) {
582 result->set("dhcp-socket-type", Element::create(std::string("udp")));
583 }
584
585 if (outbound_iface_ != SAME_AS_INBOUND) {
586 result->set("outbound-interface", Element::create(outboundTypeToText()));
587 }
588
589 // Set re-detect
590 result->set("re-detect", Element::create(re_detect_));
591
592 // Set server socket binding
593 if (service_socket_require_all_) {
594 result->set("service-sockets-require-all", Element::create(service_socket_require_all_));
595 }
596
597 if (service_sockets_max_retries_ != 0) {
598 result->set("service-sockets-max-retries", Element::create(static_cast<int>(service_sockets_max_retries_)));
599 // If the max retries parameter is zero, the wait time is not used.
600 result->set("service-sockets-retry-wait-time", Element::create(static_cast<int>(service_sockets_retry_wait_time_)));
601 }
602
603 return (result);
604}
605
606} // end of isc::dhcp namespace
607} // end of isc namespace
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown when an unexpected error condition occurs.
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition: data.cc:249
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition: data.cc:304
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition: data.cc:299
Represents selection of interfaces for DHCP server.
Definition: cfg_iface.h:131
static const char * ALL_IFACES_KEYWORD
Keyword used to enable all interfaces.
Definition: cfg_iface.h:155
void closeSockets() const
Convenience function which closes all open sockets.
Definition: cfg_iface.cc:38
std::string socketTypeToText() const
Returns the socket type in the textual format.
Definition: cfg_iface.cc:317
void reset()
Puts the interface configuration into default state.
Definition: cfg_iface.cc:277
uint32_t getServiceSocketsRetryWaitTime() const
Indicates the socket service binding retry interval between attempts.
Definition: cfg_iface.h:330
OutboundIface
Indicates how outbound interface is selected for relayed traffic.
Definition: cfg_iface.h:143
@ USE_ROUTING
Server uses routing to determine the right interface to send response.
Definition: cfg_iface.h:148
@ SAME_AS_INBOUND
Server sends responses over the same interface on which queries are received.
Definition: cfg_iface.h:146
OutboundIface getOutboundIface() const
Returns outbound interface selection mode.
Definition: cfg_iface.cc:347
CfgIface()
Constructor.
Definition: cfg_iface.cc:30
bool getServiceSocketsRequireAll() const
Indicates that Kea must successfully bind all socket services on init.
Definition: cfg_iface.h:316
void openSockets(const uint16_t family, const uint16_t port, const bool use_bcast=true)
Tries to open sockets on selected interfaces.
Definition: cfg_iface.cc:61
static OutboundIface textToOutboundIface(const std::string &txt)
Converts text to outbound interface selection mode.
Definition: cfg_iface.cc:365
void use(const uint16_t family, const std::string &iface_name)
Select interface to be used to receive DHCP traffic.
Definition: cfg_iface.cc:384
bool equals(const CfgIface &other) const
Compares two CfgIface objects for equality.
Definition: cfg_iface.cc:43
SocketType
Socket type used by the DHCPv4 server.
Definition: cfg_iface.h:135
@ SOCKET_UDP
Datagram socket, i.e. IP/UDP socket.
Definition: cfg_iface.h:139
@ SOCKET_RAW
Raw socket, used for direct DHCPv4 traffic.
Definition: cfg_iface.h:137
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
Definition: cfg_iface.cc:557
std::string outboundTypeToText() const
Returns outbound interface selection mode as string.
Definition: cfg_iface.cc:352
void setOutboundIface(const OutboundIface &outbound_iface)
Sets outbound interface selection mode.
Definition: cfg_iface.cc:379
SocketType textToSocketType(const std::string &socket_type_name) const
Converts the socket type in the textual format to the type represented by the SocketType.
Definition: cfg_iface.cc:333
static OpenSocketsFailedCallback open_sockets_failed_callback_
Optional callback function to invoke if all retries of the opening sockets fail.
Definition: cfg_iface.h:361
void useSocketType(const uint16_t family, const SocketType &socket_type)
Sets the specified socket type to be used by the server.
Definition: cfg_iface.cc:539
std::function< void(util::ReconnectCtlPtr)> OpenSocketsFailedCallback
Represents a callback invoked if all retries of the opening sockets fail.
Definition: cfg_iface.h:357
uint32_t getServiceSocketsMaxRetries() const
Indicates the maximum number of service sockets bind attempts.
Definition: cfg_iface.h:344
Exception thrown when duplicated address specified.
Definition: cfg_iface.h:45
Exception thrown when duplicated interface names specified.
Definition: cfg_iface.h:24
Handles network interfaces, transmission and reception.
Definition: iface_mgr.h:656
bool openSockets4(const uint16_t port=DHCP4_SERVER_PORT, const bool use_bcast=true, IfaceMgrErrorMsgCallback error_handler=0, const bool skip_opened=false)
Opens IPv4 sockets on detected interfaces.
Definition: iface_mgr.cc:483
IfacePtr getIface(const unsigned int ifindex)
Returns interface specified interface index.
Definition: iface_mgr.cc:866
bool openSockets6(const uint16_t port=DHCP6_SERVER_PORT, IfaceMgrErrorMsgCallback error_handler=0, const bool skip_opened=false)
Opens IPv6 sockets on detected interfaces.
Definition: iface_mgr.cc:613
void detectIfaces(bool update_only=false)
Detects network interfaces.
void clearUnicasts()
Clears unicast addresses on all interfaces.
Definition: iface_mgr.cc:913
static IfaceMgr & instance()
IfaceMgr is a singleton class.
Definition: iface_mgr.cc:54
bool isDirectResponseSupported() const
Check if packet be sent directly to the client having no address.
Definition: iface_mgr.cc:322
void closeSockets()
Closes all open sockets.
Definition: iface_mgr.cc:289
void setMatchingPacketFilter(const bool direct_response_desired=false)
Set Packet Filter object to handle send/receive packets.
void setAllowLoopBack(const bool allow_loopback)
Allows or disallows the loopback interface.
Definition: iface_mgr.h:741
util::Optional< asiolink::IOAddress > Address
Address type.
Definition: iface_mgr.h:125
Exception thrown when specified interface name is invalid.
Definition: cfg_iface.h:31
Exception thrown when invalid socket type has been specified for the given family.
Definition: cfg_iface.h:61
Exception thrown when specified unicast address is not assigned to the interface specified.
Definition: cfg_iface.h:53
Exception thrown when specified interface doesn't exist in a system.
Definition: cfg_iface.h:38
static const TimerMgrPtr & instance()
Returns pointer to the sole instance of the TimerMgr.
Definition: timer_mgr.cc:449
RAII class creating a critical section.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#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
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
Definition: macros.h:14
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
Definition: dhcpsrv_log.h:56
const isc::log::MessageID DHCPSRV_CFGMGR_ADD_IFACE
boost::shared_ptr< Iface > IfacePtr
Type definition for the pointer to an Iface object.
Definition: iface_mgr.h:487
const isc::log::MessageID DHCPSRV_CFGMGR_USE_ADDRESS
const isc::log::MessageID DHCPSRV_MULTIPLE_RAW_SOCKETS_PER_IFACE
const isc::log::MessageID DHCPSRV_CFGMGR_SOCKET_TYPE_SELECT
const isc::log::MessageID DHCPSRV_CFGMGR_ALL_IFACES_ACTIVE
const isc::log::MessageID DHCPSRV_CFGMGR_UNICAST_LINK_LOCAL
const isc::log::MessageID DHCPSRV_NO_SOCKETS_OPEN
const isc::log::MessageID DHCPSRV_OPEN_SOCKET_FAIL
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
Definition: dhcpsrv_log.h:26
const isc::log::MessageID DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED
const isc::log::MessageID DHCPSRV_CFGMGR_USE_UNICAST
string trim(const string &instring)
Trim Leading and Trailing Spaces.
Definition: strutil.cc:53
Definition: edns.h:19
boost::shared_ptr< ReconnectCtl > ReconnectCtlPtr
Pointer to an instance of ReconnectCtl.
Defines the logger used by the top-level component of kea-lfc.
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
Definition: user_context.cc:15