Kea: dhcp4_srv.h Source File

| Kea 3.2.0-git

dhcp4_srv.h
Go to the documentation of this file.
1// Copyright (C) 2011-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#ifndef DHCPV4_SRV_H
8#define DHCPV4_SRV_H
9
10#include <asiolink/io_service.h>
11#include <dhcp/dhcp4.h>
12#include <dhcp/option.h>
13#include <dhcp/option_string.h>
14#include <dhcp/option4_client_fqdn.h>
15#include <dhcp/option_custom.h>
16#include <dhcp/pkt4.h>
17#include <dhcp_ddns/ncr_msg.h>
18#include <dhcpsrv/alloc_engine.h>
19#include <dhcpsrv/callout_handle_store.h>
20#include <dhcpsrv/cb_ctl_dhcp4.h>
21#include <dhcpsrv/cfg_option.h>
22#include <dhcpsrv/d2_client_mgr.h>
23#include <dhcpsrv/network_state.h>
24#include <dhcpsrv/subnet.h>
25#include <hooks/callout_handle.h>
26#include <process/daemon.h>
27
28#include <functional>
29#include <iostream>
30#include <queue>
31
32// Undefine the macro OPTIONAL which is defined in some operating
33// systems but conflicts with a member of the RequirementLevel enum in
34// the server class.
35
36#ifdef OPTIONAL
37#undef OPTIONAL
38#endif
39
40namespace isc {
41namespace dhcp {
42
62 class Dhcpv4Exchange {
63public:
78 Dhcpv4Exchange(const AllocEnginePtr& alloc_engine, const Pkt4Ptr& query,
79 AllocEngine::ClientContext4Ptr& context,
80 const ConstSubnet4Ptr& subnet, bool& drop);
81
88 void initResponse();
89
93 void initResponse4o6();
94
96 Pkt4Ptr getQuery() const {
97 return (query_);
98 }
99
103 Pkt4Ptr getResponse() const {
104 return (resp_);
105 }
106
108 void deleteResponse() {
109 resp_.reset();
110 }
111
113 AllocEngine::ClientContext4Ptr getContext() const {
114 return (context_);
115 }
116
118 CfgOptionList& getCfgOptionList() {
119 return (cfg_option_list_);
120 }
121
123 const CfgOptionList& getCfgOptionList() const {
124 return (cfg_option_list_);
125 }
126
128 bool getIPv6OnlyPreferred() const {
129 return (ipv6_only_preferred_);
130 }
131
135 void setIPv6OnlyPreferred(bool ipv6_only_preferred) {
136 ipv6_only_preferred_ = ipv6_only_preferred;
137 }
138
141 void setReservedMessageFields();
142
151 static void setHostIdentifiers(AllocEngine::ClientContext4Ptr context);
152
159 static void removeDependentEvaluatedClasses(const Pkt4Ptr& query);
160
164 static void setReservedClientClasses(AllocEngine::ClientContext4Ptr context);
165
173 void conditionallySetReservedClientClasses();
174
185 static void classifyPacket(const Pkt4Ptr& pkt);
186
197 static void evaluateClasses(const Pkt4Ptr& pkt, bool depend_on_known);
198
199private:
200
207 static void classifyByVendor(const Pkt4Ptr& pkt);
208
218 void copyDefaultFields();
219
229 void copyDefaultOptions();
230
232 AllocEnginePtr alloc_engine_;
233
235 Pkt4Ptr query_;
236
238 Pkt4Ptr resp_;
239
241 AllocEngine::ClientContext4Ptr context_;
242
246 CfgOptionList cfg_option_list_;
247
249 bool ipv6_only_preferred_;
250};
251
253 typedef boost::shared_ptr<Dhcpv4Exchange> Dhcpv4ExchangePtr;
254
267 class Dhcpv4Srv : public process::Daemon {
268private:
269
271 asiolink::IOServicePtr io_service_;
272
273public:
274
276 typedef enum {
277 FORBIDDEN,
278 MANDATORY,
279 OPTIONAL
280 } RequirementLevel;
281
301 Dhcpv4Srv(uint16_t server_port = DHCP4_SERVER_PORT,
302 uint16_t client_port = 0,
303 const bool use_bcast = true,
304 const bool direct_response_desired = true);
305
307 virtual ~Dhcpv4Srv();
308
313 bool inTestMode() const {
314 return (server_port_ == 0);
315 }
316
318 asiolink::IOServicePtr& getIOService() {
319 return (io_service_);
320 }
321
323 NetworkStatePtr& getNetworkState() {
324 return (network_state_);
325 }
326
332 CBControlDHCPv4Ptr getCBControl() const {
333 return (cb_control_);
334 }
335
338 static std::string getVersion(bool extended);
339
346 int run();
347
353 void runOne();
354
361 void processPacketAndSendResponse(Pkt4Ptr query);
362
369 void processPacketAndSendResponseNoThrow(Pkt4Ptr query);
370
377 void sendResponseNoThrow(hooks::CalloutHandlePtr& callout_handle,
378 Pkt4Ptr& query, Pkt4Ptr& rsp,
379 ConstSubnet4Ptr& subnet);
380
389 Pkt4Ptr processPacket(Pkt4Ptr query, bool allow_answer_park = true);
390
399 Pkt4Ptr processDhcp4Query(Pkt4Ptr query, bool allow_answer_park);
400
408 void processDhcp4QueryAndSendResponse(Pkt4Ptr query,
409 bool allow_answer_park);
410
418 Pkt4Ptr processLocalizedQuery4(AllocEngine::ClientContext4Ptr& ctx,
419 bool allow_answer_park);
420
429 void processLocalizedQuery4AndSendResponse(Pkt4Ptr query,
430 AllocEngine::ClientContext4Ptr& ctx,
431 bool allow_answer_park);
432
440 void processLocalizedQuery4AndSendResponse(Pkt4Ptr query,
441 bool allow_answer_park);
442
444 void shutdown() override;
445
449
450
457 uint16_t getServerPort() const;
458
463 bool useBroadcast() const {
464 return (use_bcast_);
465 }
466
467
473 void startD2();
474
480 void stopD2();
481
496 virtual void d2ClientErrorHandler(const dhcp_ddns::
497 NameChangeSender::Result result,
498 dhcp_ddns::NameChangeRequestPtr& ncr);
499
503 void discardPackets();
504
508 bool getSendResponsesToSource() const {
509 return (test_send_responses_to_source_);
510 }
511
516 void initContext0(const Pkt4Ptr& query,
517 AllocEngine::ClientContext4Ptr ctx);
518
526 bool earlyGHRLookup(const Pkt4Ptr& query,
527 AllocEngine::ClientContext4Ptr ctx);
528
529protected:
530
537
538
558 bool accept(const Pkt4Ptr& query);
559
587 bool acceptDirectRequest(const Pkt4Ptr& query);
588
607 bool acceptMessageType(const Pkt4Ptr& query) const;
608
622 bool acceptServerId(const Pkt4Ptr& pkt) const;
624
634 static void sanityCheck(const Pkt4Ptr& query);
635
644 static void sanityCheck(const Pkt4Ptr& query, RequirementLevel serverid);
645
656 Pkt4Ptr processDiscover(Pkt4Ptr& discover, AllocEngine::ClientContext4Ptr& context);
657
672 Pkt4Ptr processRequest(Pkt4Ptr& request, AllocEngine::ClientContext4Ptr& context);
673
682 void processRelease(Pkt4Ptr& release, AllocEngine::ClientContext4Ptr& context);
683
693 void processDecline(Pkt4Ptr& decline, AllocEngine::ClientContext4Ptr& context);
694
701 Pkt4Ptr processInform(Pkt4Ptr& inform, AllocEngine::ClientContext4Ptr& context);
702
709 void reject(Dhcpv4Exchange& ex);
710
717 void buildCfgOptionList(Dhcpv4Exchange& ex);
718
726 void appendRequestedOptions(Dhcpv4Exchange& ex);
727
738 void appendRequestedVendorOptions(Dhcpv4Exchange& ex);
739
753 bool assignZero(ConstSubnet4Ptr& subnet,
754 const ClientClasses& client_classes);
755
770 void assignLease(Dhcpv4Exchange& ex);
771
789 void postAllocateNameUpdate(const AllocEngine::ClientContext4Ptr& ctx,
790 const Lease4Ptr& lease, const Pkt4Ptr& query,
791 const Pkt4Ptr& resp, bool client_name_changed);
792
818 void setTeeTimes(const Lease4Ptr& lease,
819 const ConstSubnet4Ptr& subnet,
820 Pkt4Ptr resp);
821
833 void appendBasicOptions(Dhcpv4Exchange& ex);
834
846 void setFixedFields(Dhcpv4Exchange& ex);
847
885 void processClientName(Dhcpv4Exchange& ex);
886
893 void setPacketStatisticsDefaults();
894
898 void setSendResponsesToSource(bool value) {
899 test_send_responses_to_source_ = value;
900 }
901
916 void serverDecline(hooks::CalloutHandlePtr& callout_handle, Pkt4Ptr& query,
917 Lease4Ptr lease, bool lease_exists);
918
929 void serverDeclineNoThrow(hooks::CalloutHandlePtr& callout_handle, Pkt4Ptr& query,
930 Lease4Ptr lease, bool lease_exists);
931
932public:
933
940 static const std::string VENDOR_CLASS_PREFIX;
941
942private:
953 void processClientFqdnOption(Dhcpv4Exchange& ex);
954
986 void processHostnameOption(Dhcpv4Exchange& ex);
987
1001 void declineLease(const Lease4Ptr& lease, const Pkt4Ptr& decline,
1002 AllocEngine::ClientContext4Ptr& context);
1003
1004protected:
1005
1021 void createNameChangeRequests(const Lease4Ptr& lease,
1022 const Lease4Ptr& old_lease,
1023 const DdnsParams& ddns_params);
1024
1033 void renewLease(const Pkt4Ptr& renew, Pkt4Ptr& reply);
1034
1053 static void appendServerID(Dhcpv4Exchange& ex);
1054
1059 static uint16_t checkRelayPort(const Dhcpv4Exchange& ex);
1060
1095 void adjustIfaceData(Dhcpv4Exchange& ex);
1096
1112 void adjustRemoteAddr(Dhcpv4Exchange& ex);
1113
1120 static std::string srvidToString(const OptionPtr& opt);
1121
1128 isc::dhcp::ConstSubnet4Ptr selectSubnet(const Pkt4Ptr& query,
1129 bool& drop,
1130 bool allow_answer_park = true);
1131
1138 isc::dhcp::ConstSubnet4Ptr selectSubnet4o6(const Pkt4Ptr& query,
1139 bool& drop,
1140 bool allow_answer_park = true);
1141
1146 virtual Pkt4Ptr receivePacket(int timeout);
1147
1152 virtual void sendPacket(const Pkt4Ptr& pkt);
1153
1164 void classifyPacket(const Pkt4Ptr& pkt);
1165
1183 void recoverStashedAgentOption(const Pkt4Ptr& query);
1184
1185protected:
1186
1203 void evaluateAdditionalClasses(Dhcpv4Exchange& ex);
1204
1214 void deferredUnpack(Pkt4Ptr& query);
1215
1222 void processPacketPktSend(hooks::CalloutHandlePtr& callout_handle,
1223 Pkt4Ptr& query, Pkt4Ptr& rsp,
1224 ConstSubnet4Ptr& subnet);
1225
1230 void processPacketBufferSend(hooks::CalloutHandlePtr& callout_handle,
1231 Pkt4Ptr& rsp);
1232
1233private:
1234
1240 void classifyByVendor(const Pkt4Ptr& pkt);
1241
1246 static OptionPtr getNetmaskOption(const ConstSubnet4Ptr& subnet);
1247
1254 static std::tuple<bool, uint32_t> parkingLimitExceeded(std::string const& hook_label);
1255
1256protected:
1257
1259 uint16_t server_port_;
1260
1262 uint16_t client_port_;
1263
1266 volatile bool shutdown_;
1267
1272 boost::shared_ptr<AllocEngine> alloc_engine_;
1273
1275 bool use_bcast_;
1276
1279 NetworkStatePtr network_state_;
1280
1282 CBControlDHCPv4Ptr cb_control_;
1283
1284private:
1285
1288 bool test_send_responses_to_source_;
1289
1290public:
1291
1293
1296 static void processStatsReceived(const Pkt4Ptr& query);
1297
1300 static void processStatsSent(const Pkt4Ptr& response);
1301
1304 static int getHookIndexBuffer4Receive();
1305
1308 static int getHookIndexPkt4Receive();
1309
1312 static int getHookIndexSubnet4Select();
1313
1316 static int getHookIndexLease4Release();
1317
1320 static int getHookIndexPkt4Send();
1321
1324 static int getHookIndexBuffer4Send();
1325
1328 static int getHookIndexLease4Decline();
1329
1335 std::list<std::list<std::string>> jsonPathsToRedact() const final override;
1336};
1337
1338} // namespace dhcp
1339} // namespace isc
1340
1341#endif // DHCP4_SRV_H
alloc_engine.h
callout_handle.h
callout_handle_store.h
cb_ctl_dhcp4.h
cfg_option.h
isc::dhcp::AllocEngine::ClientContext4Ptr
boost::shared_ptr< ClientContext4 > ClientContext4Ptr
Pointer to the ClientContext4.
Definition alloc_engine.h:1402
isc::dhcp::ClientClasses
Container for storing client class names.
Definition classify.h:110
isc::dhcp::DdnsParams
Convenience container for conveying DDNS behavioral parameters It is intended to be created per Packe...
Definition ddns_params.h:23
isc::dhcp::Dhcpv4Exchange
DHCPv4 message exchange.
Definition dhcp4_srv.h:62
isc::dhcp::Dhcpv4Exchange::getContext
AllocEngine::ClientContext4Ptr getContext() const
Returns the copy of the context for the Allocation engine.
Definition dhcp4_srv.h:113
isc::dhcp::Dhcpv4Exchange::deleteResponse
void deleteResponse()
Removes the response message by resetting the pointer to null.
Definition dhcp4_srv.h:108
isc::dhcp::Dhcpv4Exchange::getCfgOptionList
const CfgOptionList & getCfgOptionList() const
Returns the configured option list (const version).
Definition dhcp4_srv.h:123
isc::dhcp::Dhcpv4Exchange::getQuery
Pkt4Ptr getQuery() const
Returns the pointer to the query from the client.
Definition dhcp4_srv.h:96
isc::dhcp::Dhcpv4Exchange::setHostIdentifiers
static void setHostIdentifiers(AllocEngine::ClientContext4Ptr context)
Set host identifiers within a context.
Definition dhcp4_srv.cc:466
isc::dhcp::Dhcpv4Exchange::classifyByVendor
static void classifyByVendor(const Pkt4Ptr &pkt)
Assign class using vendor-class-identifier option.
Definition dhcp4_srv.cc:628
isc::dhcp::Dhcpv4Exchange::initResponse
void initResponse()
Initializes the instance of the response message.
Definition dhcp4_srv.cc:338
isc::dhcp::Dhcpv4Exchange::setReservedMessageFields
void setReservedMessageFields()
Sets reserved values of siaddr, sname and file in the server's response.
Definition dhcp4_srv.cc:606
isc::dhcp::Dhcpv4Exchange::getCfgOptionList
CfgOptionList & getCfgOptionList()
Returns the configured option list (non-const version).
Definition dhcp4_srv.h:118
isc::dhcp::Dhcpv4Exchange::getResponse
Pkt4Ptr getResponse() const
Returns the pointer to the server's response.
Definition dhcp4_srv.h:103
isc::dhcp::Dhcpv4Exchange::setReservedClientClasses
static void setReservedClientClasses(AllocEngine::ClientContext4Ptr context)
Assigns classes retrieved from host reservation database.
Definition dhcp4_srv.cc:582
isc::dhcp::Dhcpv4Exchange::initResponse4o6
void initResponse4o6()
Initializes the DHCPv6 part of the response message.
Definition dhcp4_srv.cc:364
isc::dhcp::Dhcpv4Exchange::evaluateClasses
static void evaluateClasses(const Pkt4Ptr &pkt, bool depend_on_known)
Evaluate classes.
Definition dhcp4_srv.cc:651
isc::dhcp::Dhcpv4Exchange::setIPv6OnlyPreferred
void setIPv6OnlyPreferred(bool ipv6_only_preferred)
Set the IPv6-Only Preferred flag.
Definition dhcp4_srv.h:135
isc::dhcp::Dhcpv4Exchange::Dhcpv4Exchange
Dhcpv4Exchange(const AllocEnginePtr &alloc_engine, const Pkt4Ptr &query, AllocEngine::ClientContext4Ptr &context, const ConstSubnet4Ptr &subnet, bool &drop)
Constructor.
Definition dhcp4_srv.cc:218
isc::dhcp::Dhcpv4Exchange::classifyPacket
static void classifyPacket(const Pkt4Ptr &pkt)
Assigns incoming packet to zero or more classes.
Definition dhcp4_srv.cc:640
isc::dhcp::Dhcpv4Exchange::removeDependentEvaluatedClasses
static void removeDependentEvaluatedClasses(const Pkt4Ptr &query)
Removed evaluated client classes.
Definition dhcp4_srv.cc:567
isc::dhcp::Dhcpv4Exchange::getIPv6OnlyPreferred
bool getIPv6OnlyPreferred() const
Returns the IPv6-Only Preferred flag.
Definition dhcp4_srv.h:128
isc::dhcp::Dhcpv4Exchange::conditionallySetReservedClientClasses
void conditionallySetReservedClientClasses()
Assigns classes retrieved from host reservation database if they haven't been yet set.
Definition dhcp4_srv.cc:592
isc::dhcp::Dhcpv4Srv::initContext0
void initContext0(const Pkt4Ptr &query, AllocEngine::ClientContext4Ptr ctx)
Initialize client context (first part).
Definition dhcp4_srv.cc:1108
isc::dhcp::Dhcpv4Srv::setSendResponsesToSource
void setSendResponsesToSource(bool value)
Sets value of the test_send_responses_to_source_ flag.
Definition dhcp4_srv.h:898
isc::dhcp::Dhcpv4Srv::run
int run()
Main server processing loop.
Definition dhcp4_srv.cc:1191
isc::dhcp::Dhcpv4Srv::declineLease
void declineLease(const Lease4Ptr &lease, const Pkt4Ptr &decline, AllocEngine::ClientContext4Ptr &context)
Marks lease as declined.
Definition dhcp4_srv.cc:4372
isc::dhcp::Dhcpv4Srv::processPacketAndSendResponse
void processPacketAndSendResponse(Pkt4Ptr query)
Process a single incoming DHCPv4 packet and sends the response.
Definition dhcp4_srv.cc:1360
isc::dhcp::Dhcpv4Srv::classifyPacket
void classifyPacket(const Pkt4Ptr &pkt)
Assigns incoming packet to zero or more classes.
Definition dhcp4_srv.cc:5083
isc::dhcp::Dhcpv4Srv::appendRequestedVendorOptions
void appendRequestedVendorOptions(Dhcpv4Exchange &ex)
Appends requested vendor options as requested by client.
Definition dhcp4_srv.cc:2432
isc::dhcp::Dhcpv4Srv::adjustIfaceData
void adjustIfaceData(Dhcpv4Exchange &ex)
Set IP/UDP and interface parameters for the DHCPv4 response.
Definition dhcp4_srv.cc:3647
isc::dhcp::Dhcpv4Srv::checkRelayPort
static uint16_t checkRelayPort(const Dhcpv4Exchange &ex)
Check if the relay port RAI sub-option was set in the query.
Definition dhcp4_srv.cc:3634
isc::dhcp::Dhcpv4Srv::~Dhcpv4Srv
virtual ~Dhcpv4Srv()
Destructor. Used during DHCPv4 service shutdown.
Definition dhcp4_srv.cc:739
isc::dhcp::Dhcpv4Srv::receivePacket
virtual Pkt4Ptr receivePacket(int timeout)
dummy wrapper around IfaceMgr::receive4
Definition dhcp4_srv.cc:1098
isc::dhcp::Dhcpv4Srv::accept
bool accept(const Pkt4Ptr &query)
Checks whether received message should be processed or discarded.
Definition dhcp4_srv.cc:4737
isc::dhcp::Dhcpv4Srv::setTeeTimes
void setTeeTimes(const Lease4Ptr &lease, const ConstSubnet4Ptr &subnet, Pkt4Ptr resp)
Adds the T1 and T2 timers to the outbound response as appropriate.
Definition dhcp4_srv.cc:3595
isc::dhcp::Dhcpv4Srv::appendServerID
static void appendServerID(Dhcpv4Exchange &ex)
Adds server identifier option to the server's response.
Definition dhcp4_srv.cc:2160
isc::dhcp::Dhcpv4Srv::postAllocateNameUpdate
void postAllocateNameUpdate(const AllocEngine::ClientContext4Ptr &ctx, const Lease4Ptr &lease, const Pkt4Ptr &query, const Pkt4Ptr &resp, bool client_name_changed)
Update client name and DNS flags in the lease and response.
Definition dhcp4_srv.cc:3527
isc::dhcp::Dhcpv4Srv::use_bcast_
bool use_bcast_
Should broadcast be enabled on sockets (if true).
Definition dhcp4_srv.h:1275
isc::dhcp::Dhcpv4Srv::runOne
void runOne()
Main server processing step.
Definition dhcp4_srv.cc:1248
isc::dhcp::Dhcpv4Srv::startD2
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
Definition dhcp4_srv.cc:5247
isc::dhcp::Dhcpv4Srv::getHookIndexBuffer4Receive
static int getHookIndexBuffer4Receive()
Returns the index for "buffer4_receive" hook point.
Definition dhcp4_srv.cc:5390
isc::dhcp::Dhcpv4Srv::processRequest
Pkt4Ptr processRequest(Pkt4Ptr &request, AllocEngine::ClientContext4Ptr &context)
Processes incoming REQUEST and returns REPLY response.
Definition dhcp4_srv.cc:4058
isc::dhcp::Dhcpv4Srv::processStatsReceived
static void processStatsReceived(const Pkt4Ptr &query)
Class methods for DHCPv4-over-DHCPv6 handler.
Definition dhcp4_srv.cc:5318
isc::dhcp::Dhcpv4Srv::getHookIndexPkt4Send
static int getHookIndexPkt4Send()
Returns the index for "pkt4_send" hook point.
Definition dhcp4_srv.cc:5406
isc::dhcp::Dhcpv4Srv::processDecline
void processDecline(Pkt4Ptr &decline, AllocEngine::ClientContext4Ptr &context)
Process incoming DHCPDECLINE messages.
Definition dhcp4_srv.cc:4296
isc::dhcp::Dhcpv4Srv::Dhcpv4Srv
Dhcpv4Srv(uint16_t server_port=DHCP4_SERVER_PORT, uint16_t client_port=0, const bool use_bcast=true, const bool direct_response_desired=true)
Default constructor.
Definition dhcp4_srv.cc:677
isc::dhcp::Dhcpv4Srv::getHookIndexSubnet4Select
static int getHookIndexSubnet4Select()
Returns the index for "subnet4_select" hook point.
Definition dhcp4_srv.cc:5398
isc::dhcp::Dhcpv4Srv::selectSubnet
isc::dhcp::ConstSubnet4Ptr selectSubnet(const Pkt4Ptr &query, bool &drop, bool allow_answer_park=true)
Selects a subnet for a given client's packet.
Definition dhcp4_srv.cc:790
isc::dhcp::Dhcpv4Srv::processStatsSent
static void processStatsSent(const Pkt4Ptr &response)
Updates statistics for transmitted packets.
Definition dhcp4_srv.cc:5366
isc::dhcp::Dhcpv4Srv::shutdown
void shutdown() override
Instructs the server to shut down.
Definition dhcp4_srv.cc:784
isc::dhcp::Dhcpv4Srv::getHookIndexLease4Release
static int getHookIndexLease4Release()
Returns the index for "lease4_release" hook point.
Definition dhcp4_srv.cc:5402
isc::dhcp::Dhcpv4Srv::adjustRemoteAddr
void adjustRemoteAddr(Dhcpv4Exchange &ex)
Sets remote addresses for outgoing packet.
Definition dhcp4_srv.cc:3735
isc::dhcp::Dhcpv4Srv::getHookIndexPkt4Receive
static int getHookIndexPkt4Receive()
Returns the index for "pkt4_receive" hook point.
Definition dhcp4_srv.cc:5394
isc::dhcp::Dhcpv4Srv::assignLease
void assignLease(Dhcpv4Exchange &ex)
Assigns a lease and appends corresponding options.
Definition dhcp4_srv.cc:3081
isc::dhcp::Dhcpv4Srv::evaluateAdditionalClasses
void evaluateAdditionalClasses(Dhcpv4Exchange &ex)
Evaluates classes in the additional classes lists.
Definition dhcp4_srv.cc:5087
isc::dhcp::Dhcpv4Srv::processDhcp4Query
Pkt4Ptr processDhcp4Query(Pkt4Ptr query, bool allow_answer_park)
Process a single incoming DHCPv4 query.
Definition dhcp4_srv.cc:1602
isc::dhcp::Dhcpv4Srv::getIOService
asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service used by the server.
Definition dhcp4_srv.h:318
isc::dhcp::Dhcpv4Srv::setFixedFields
void setFixedFields(Dhcpv4Exchange &ex)
Sets fixed fields of the outgoing packet.
Definition dhcp4_srv.cc:3836
isc::dhcp::Dhcpv4Srv::appendBasicOptions
void appendBasicOptions(Dhcpv4Exchange &ex)
Append basic options if they are not present.
Definition dhcp4_srv.cc:2605
isc::dhcp::Dhcpv4Srv::recoverStashedAgentOption
void recoverStashedAgentOption(const Pkt4Ptr &query)
Recover stashed agent options from client address lease.
Definition dhcp4_srv.cc:4654
isc::dhcp::Dhcpv4Srv::processClientName
void processClientName(Dhcpv4Exchange &ex)
Processes Client FQDN and Hostname Options sent by a client.
Definition dhcp4_srv.cc:2648
isc::dhcp::Dhcpv4Srv::alloc_engine_
boost::shared_ptr< AllocEngine > alloc_engine_
Allocation Engine.
Definition dhcp4_srv.h:1272
isc::dhcp::Dhcpv4Srv::serverDecline
void serverDecline(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &query, Lease4Ptr lease, bool lease_exists)
Renders a lease declined after the server has detected, via ping-check or other means,...
Definition dhcp4_srv.cc:4472
isc::dhcp::Dhcpv4Srv::processInform
Pkt4Ptr processInform(Pkt4Ptr &inform, AllocEngine::ClientContext4Ptr &context)
Processes incoming DHCPINFORM messages.
Definition dhcp4_srv.cc:4599
isc::dhcp::Dhcpv4Srv::client_port_
uint16_t client_port_
UDP port number to which server sends all responses.
Definition dhcp4_srv.h:1262
isc::dhcp::Dhcpv4Srv::serverDeclineNoThrow
void serverDeclineNoThrow(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &query, Lease4Ptr lease, bool lease_exists)
Exception safe wrapper around serverDecline().
Definition dhcp4_srv.cc:4588
isc::dhcp::Dhcpv4Srv::processPacketPktSend
void processPacketPktSend(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &query, Pkt4Ptr &rsp, ConstSubnet4Ptr &subnet)
Executes pkt4_send callout.
Definition dhcp4_srv.cc:1996
isc::dhcp::Dhcpv4Srv::processPacketAndSendResponseNoThrow
void processPacketAndSendResponseNoThrow(Pkt4Ptr query)
Process a single incoming DHCPv4 packet and sends the response.
Definition dhcp4_srv.cc:1338
isc::dhcp::Dhcpv4Srv::jsonPathsToRedact
std::list< std::list< std::string > > jsonPathsToRedact() const final override
Return a list of all paths that contain passwords or secrets for kea-dhcp4.
Definition dhcp4_srv.cc:5458
isc::dhcp::Dhcpv4Srv::srvidToString
static std::string srvidToString(const OptionPtr &opt)
converts server-id to text Converts content of server-id option to a text representation,...
Definition dhcp4_srv.cc:2140
isc::dhcp::Dhcpv4Srv::acceptServerId
bool acceptServerId(const Pkt4Ptr &pkt) const
Verifies if the server id belongs to our server.
Definition dhcp4_srv.cc:4862
isc::dhcp::Dhcpv4Srv::VENDOR_CLASS_PREFIX
static const std::string VENDOR_CLASS_PREFIX
this is a prefix added to the content of vendor-class option
Definition dhcp4_srv.h:940
isc::dhcp::Dhcpv4Srv::inTestMode
bool inTestMode() const
Checks if the server is running in unit test mode.
Definition dhcp4_srv.h:313
isc::dhcp::Dhcpv4Srv::createNameChangeRequests
void createNameChangeRequests(const Lease4Ptr &lease, const Lease4Ptr &old_lease, const DdnsParams &ddns_params)
Creates NameChangeRequests which correspond to the lease which has been acquired.
Definition dhcp4_srv.cc:3008
isc::dhcp::Dhcpv4Srv::appendRequestedOptions
void appendRequestedOptions(Dhcpv4Exchange &ex)
Appends options requested by client.
Definition dhcp4_srv.cc:2259
isc::dhcp::Dhcpv4Srv::setPacketStatisticsDefaults
void setPacketStatisticsDefaults()
This function sets statistics related to DHCPv4 packets processing to their initial values.
Definition dhcp4_srv.cc:729
isc::dhcp::Dhcpv4Srv::processLocalizedQuery4AndSendResponse
void processLocalizedQuery4AndSendResponse(Pkt4Ptr query, AllocEngine::ClientContext4Ptr &ctx, bool allow_answer_park)
Process a localized incoming DHCPv4 query.
Definition dhcp4_srv.cc:1673
isc::dhcp::Dhcpv4Srv::getNetworkState
NetworkStatePtr & getNetworkState()
Returns pointer to the network state used by the server.
Definition dhcp4_srv.h:323
isc::dhcp::Dhcpv4Srv::getVersion
static std::string getVersion(bool extended)
returns Kea version on stdout and exit.
Definition dhcp4_srv.cc:5281
isc::dhcp::Dhcpv4Srv::buildCfgOptionList
void buildCfgOptionList(Dhcpv4Exchange &ex)
Build the configured option list.
Definition dhcp4_srv.cc:2185
isc::dhcp::Dhcpv4Srv::shutdown_
volatile bool shutdown_
Indicates if shutdown is in progress.
Definition dhcp4_srv.h:1266
isc::dhcp::Dhcpv4Srv::useBroadcast
bool useBroadcast() const
Return bool value indicating that broadcast flags should be set on sockets.
Definition dhcp4_srv.h:463
isc::dhcp::Dhcpv4Srv::server_port_
uint16_t server_port_
UDP port number on which server listens.
Definition dhcp4_srv.h:1259
isc::dhcp::Dhcpv4Srv::sendResponseNoThrow
void sendResponseNoThrow(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &query, Pkt4Ptr &rsp, ConstSubnet4Ptr &subnet)
Process an unparked DHCPv4 packet and sends the response.
Definition dhcp4_srv.cc:1979
isc::dhcp::Dhcpv4Srv::earlyGHRLookup
bool earlyGHRLookup(const Pkt4Ptr &query, AllocEngine::ClientContext4Ptr ctx)
Initialize client context and perform early global reservations lookup.
Definition dhcp4_srv.cc:1118
isc::dhcp::Dhcpv4Srv::network_state_
NetworkStatePtr network_state_
Holds information about disabled DHCP service and/or disabled subnet/network scopes.
Definition dhcp4_srv.h:1279
isc::dhcp::Dhcpv4Srv::renewLease
void renewLease(const Pkt4Ptr &renew, Pkt4Ptr &reply)
Attempts to renew received addresses.
isc::dhcp::Dhcpv4Srv::processDhcp4QueryAndSendResponse
void processDhcp4QueryAndSendResponse(Pkt4Ptr query, bool allow_answer_park)
Process a single incoming DHCPv4 query.
Definition dhcp4_srv.cc:1573
isc::dhcp::Dhcpv4Srv::getSendResponsesToSource
bool getSendResponsesToSource() const
Returns value of the test_send_responses_to_source_ flag.
Definition dhcp4_srv.h:508
isc::dhcp::Dhcpv4Srv::processDiscover
Pkt4Ptr processDiscover(Pkt4Ptr &discover, AllocEngine::ClientContext4Ptr &context)
Processes incoming DISCOVER and returns response.
Definition dhcp4_srv.cc:3978
isc::dhcp::Dhcpv4Srv::d2ClientErrorHandler
virtual void d2ClientErrorHandler(const dhcp_ddns::NameChangeSender::Result result, dhcp_ddns::NameChangeRequestPtr &ncr)
Implements the error handler for DHCP_DDNS IO errors.
Definition dhcp4_srv.cc:5269
isc::dhcp::Dhcpv4Srv::getServerPort
uint16_t getServerPort() const
Get UDP port on which server should listen.
Definition dhcp4_srv.cc:5423
isc::dhcp::Dhcpv4Srv::sendPacket
virtual void sendPacket(const Pkt4Ptr &pkt)
dummy wrapper around IfaceMgr::send()
Definition dhcp4_srv.cc:1103
isc::dhcp::Dhcpv4Srv::getHookIndexBuffer4Send
static int getHookIndexBuffer4Send()
Returns the index for "buffer4_send" hook point.
Definition dhcp4_srv.cc:5410
isc::dhcp::Dhcpv4Srv::stopD2
void stopD2()
Stops DHCP_DDNS client IO if DDNS updates are enabled.
Definition dhcp4_srv.cc:5259
isc::dhcp::Dhcpv4Srv::getCBControl
CBControlDHCPv4Ptr getCBControl() const
Returns an object which controls access to the configuration backends.
Definition dhcp4_srv.h:332
isc::dhcp::Dhcpv4Srv::sanityCheck
static void sanityCheck(const Pkt4Ptr &query)
Verifies if specified packet meets RFC requirements.
Definition dhcp4_srv.cc:5006
isc::dhcp::Dhcpv4Srv::acceptMessageType
bool acceptMessageType(const Pkt4Ptr &query) const
Check if received message type is valid for the server to process.
Definition dhcp4_srv.cc:4802
isc::dhcp::Dhcpv4Srv::discardPackets
void discardPackets()
Discards parked packets Clears the packet parking lots of all packets.
Definition dhcp4_srv.cc:5418
isc::dhcp::Dhcpv4Srv::selectSubnet4o6
isc::dhcp::ConstSubnet4Ptr selectSubnet4o6(const Pkt4Ptr &query, bool &drop, bool allow_answer_park=true)
Selects a subnet for a given client's DHCP4o6 packet.
Definition dhcp4_srv.cc:925
isc::dhcp::Dhcpv4Srv::getHookIndexLease4Decline
static int getHookIndexLease4Decline()
Returns the index for "lease4_decline" hook point.
Definition dhcp4_srv.cc:5414
isc::dhcp::Dhcpv4Srv::processRelease
void processRelease(Pkt4Ptr &release, AllocEngine::ClientContext4Ptr &context)
Processes incoming DHCPRELEASE messages.
Definition dhcp4_srv.cc:4140
isc::dhcp::Dhcpv4Srv::acceptDirectRequest
bool acceptDirectRequest(const Pkt4Ptr &query)
Check if a message sent by directly connected client should be accepted or discarded.
Definition dhcp4_srv.cc:4765
isc::dhcp::Dhcpv4Srv::cb_control_
CBControlDHCPv4Ptr cb_control_
Controls access to the configuration backends.
Definition dhcp4_srv.h:1282
isc::dhcp::Dhcpv4Srv::RequirementLevel
RequirementLevel
defines if certain option may, must or must not appear
Definition dhcp4_srv.h:276
isc::dhcp::Dhcpv4Srv::OPTIONAL
@ OPTIONAL
Definition dhcp4_srv.h:279
isc::dhcp::Dhcpv4Srv::MANDATORY
@ MANDATORY
Definition dhcp4_srv.h:278
isc::dhcp::Dhcpv4Srv::FORBIDDEN
@ FORBIDDEN
Definition dhcp4_srv.h:277
isc::dhcp::Dhcpv4Srv::processPacket
Pkt4Ptr processPacket(Pkt4Ptr query, bool allow_answer_park=true)
Process a single incoming DHCPv4 packet.
Definition dhcp4_srv.cc:1372
isc::dhcp::Dhcpv4Srv::processPacketBufferSend
void processPacketBufferSend(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &rsp)
Executes buffer4_send callout and sends the response.
Definition dhcp4_srv.cc:2067
isc::dhcp::Dhcpv4Srv::assignZero
bool assignZero(ConstSubnet4Ptr &subnet, const ClientClasses &client_classes)
Assign the 0.0.0.0 address to an IPv6-Only client.
Definition dhcp4_srv.cc:3037
isc::dhcp::Dhcpv4Srv::deferredUnpack
void deferredUnpack(Pkt4Ptr &query)
Perform deferred option unpacking.
Definition dhcp4_srv.cc:5173
isc::dhcp::Dhcpv4Srv::reject
void reject(Dhcpv4Exchange &ex)
Return a NAK.
Definition dhcp4_srv.cc:3070
isc::dhcp::Dhcpv4Srv::processLocalizedQuery4
Pkt4Ptr processLocalizedQuery4(AllocEngine::ClientContext4Ptr &ctx, bool allow_answer_park)
Process a localized incoming DHCPv4 query.
Definition dhcp4_srv.cc:1722
isc::process::Daemon
Base class for all services.
Definition daemon.h:48
d2_client_mgr.h
Defines the D2ClientMgr class.
daemon.h
dhcp4.h
io_service.h
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition io_service.h:35
isc::dhcp_ddns
Definition dhcp_ddns_log.cc:14
isc::dhcp_ddns::NameChangeRequestPtr
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
Definition ncr_msg.h:241
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::Dhcpv4ExchangePtr
boost::shared_ptr< Dhcpv4Exchange > Dhcpv4ExchangePtr
Type representing the pointer to the Dhcpv4Exchange.
Definition dhcp4_srv.h:253
isc::dhcp::ConstSubnet4Ptr
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
Definition subnet.h:455
isc::dhcp::Pkt4Ptr
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
Definition pkt4.h:556
isc::dhcp::AllocEnginePtr
boost::shared_ptr< AllocEngine > AllocEnginePtr
A pointer to the AllocEngine object.
Definition alloc_engine.h:1929
isc::dhcp::NetworkStatePtr
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
Definition network_state.h:220
isc::dhcp::CBControlDHCPv4Ptr
boost::shared_ptr< CBControlDHCPv4 > CBControlDHCPv4Ptr
Definition cb_ctl_dhcp4.h:45
isc::dhcp::Lease4Ptr
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
Definition lease.h:315
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition option.h:37
isc::dhcp::CfgOptionList
std::list< ConstCfgOptionPtr > CfgOptionList
Const pointer list.
Definition cfg_option.h:979
isc::hooks::CalloutHandlePtr
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
Definition callout_handle.h:470
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
ncr_msg.h
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...
network_state.h
option4_client_fqdn.h
option.h
option_custom.h
option_string.h
pkt4.h
subnet.h