Kea 2.7.5
isc::dhcp::Dhcpv6Srv Class Reference

DHCPv6 server service. More...

#include <dhcp6_srv.h>

+ Inheritance diagram for isc::dhcp::Dhcpv6Srv:

Public Types

enum  RequirementLevel { FORBIDDEN , MANDATORY , OPTIONAL }
 defines if certain option may, must or must not appear More...
 

Public Member Functions

 Dhcpv6Srv (uint16_t server_port=DHCP6_SERVER_PORT, uint16_t client_port=0)
 Default constructor.
 
virtual ~Dhcpv6Srv ()
 Destructor. Used during DHCPv6 service shutdown.
 
CBControlDHCPv6Ptr getCBControl () const
 Returns an object which controls access to the configuration backends.
 
asiolink::IOServicePtrgetIOService ()
 Returns pointer to the IO service used by the server.
 
NetworkStatePtrgetNetworkState ()
 Returns pointer to the network state used by the server.
 
OptionPtr getServerID ()
 Returns server-identifier option.
 
bool inTestMode () const
 Checks if the server is running in unit test mode.
 
Pkt6Ptr processDhcp6Query (Pkt6Ptr query)
 Process a single incoming DHCPv6 query.
 
void processDhcp6QueryAndSendResponse (Pkt6Ptr query)
 Process a single incoming DHCPv6 query.
 
Pkt6Ptr processLocalizedQuery6 (AllocEngine::ClientContext6 &ctx)
 Process a localized incoming DHCPv6 query.
 
void processLocalizedQuery6AndSendResponse (Pkt6Ptr query)
 Process a localized incoming DHCPv6 query.
 
void processLocalizedQuery6AndSendResponse (Pkt6Ptr query, AllocEngine::ClientContext6 &ctx)
 Process a localized incoming DHCPv6 query.
 
Pkt6Ptr processPacket (Pkt6Ptr query)
 Process a single incoming DHCPv6 packet.
 
void processPacketAndSendResponse (Pkt6Ptr query)
 Process a single incoming DHCPv6 packet and sends the response.
 
void processPacketAndSendResponseNoThrow (Pkt6Ptr query)
 Process a single incoming DHCPv6 packet and sends the response.
 
int run ()
 Main server processing loop.
 
void runOne ()
 Main server processing step.
 
void sendResponseNoThrow (hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr query, Pkt6Ptr &rsp, ConstSubnet6Ptr &subnet)
 Process an unparked DHCPv6 packet and sends the response.
 
void shutdown () override
 Instructs the server to shut down.
 
- Public Member Functions inherited from isc::process::Daemon
 Daemon ()
 Default constructor.
 
virtual ~Daemon ()
 Destructor.
 
void checkConfigFile () const
 Checks the configuration file name.
 
virtual void cleanup ()
 Performs final deconfiguration.
 
void createPIDFile (int pid=0)
 Creates the PID file.
 
std::string getConfigFile () const
 Returns config file name.
 
int getExitValue ()
 Fetches the exit value.
 
std::string getPIDFileDir () const
 Returns the directory used when forming default PID file name.
 
std::string getPIDFileName () const
 Returns the current PID file name.
 
isc::data::ConstElementPtr redactConfig (isc::data::ConstElementPtr const &config)
 Redact a configuration.
 
void setConfigFile (const std::string &config_file)
 Sets the configuration file name.
 
void setExitValue (int value)
 Sets the exit value.
 
void setPIDFileDir (const std::string &pid_file_dir)
 Sets the PID file directory.
 
void setPIDFileName (const std::string &pid_file_name)
 Sets PID file name.
 
virtual size_t writeConfigFile (const std::string &config_file, isc::data::ConstElementPtr cfg=isc::data::ConstElementPtr()) const
 Writes current configuration to specified file.
 

Static Public Member Functions

static std::string getVersion (bool extended)
 returns Kea version on stdout and exit.
 
- Static Public Member Functions inherited from isc::process::Daemon
static void configureLogger (const isc::data::ConstElementPtr &log_config, const isc::process::ConfigPtr &storage)
 Configures logger.
 
static std::string getDefaultLoggerName ()
 Returns default logger name.
 
static std::string getProcName ()
 returns the process name This value is used as when forming the default PID file name
 
static bool getVerbose ()
 Returns if running in verbose mode.
 
static std::string getVersion (bool extended)
 returns Kea version on stdout and exits.
 
static void loggerInit (const char *log_name, bool verbose)
 Initializes logger.
 
static void setDefaultLoggerName (const std::string &logger)
 Sets the default logger name.
 
static void setProcName (const std::string &proc_name)
 Sets the process name.
 
static void setVerbose (const bool verbose)
 Sets or clears verbose mode.
 

Static Public Attributes

static const size_t MIN_MAC_LEN = 6
 Minimum length of a MAC address to be used in DUID generation.
 

Public accessors returning values required to (re)open sockets.

static const std::string VENDOR_CLASS_PREFIX
 this is a prefix added to the content of vendor-class option
 
uint16_t server_port_
 UDP port number on which server listens.
 
uint16_t client_port_
 UDP port number to which server sends all responses.
 
OptionPtr serverid_
 Server DUID (to be sent in server-identifier option)
 
volatile bool shutdown_
 Indicates if shutdown is in progress.
 
boost::shared_ptr< AllocEnginealloc_engine_
 Allocation Engine.
 
std::queue< isc::dhcp_ddns::NameChangeRequestname_change_reqs_
 Holds a list of isc::dhcp_ddns::NameChangeRequest objects, which are waiting for sending to kea-dhcp-ddns module.
 
NetworkStatePtr network_state_
 Holds information about disabled DHCP service and/or disabled subnet/network scopes.
 
CBControlDHCPv6Ptr cb_control_
 Controls access to the configuration backends.
 
uint16_t getServerPort () const
 Get UDP port on which server should listen.
 
void startD2 ()
 Starts DHCP_DDNS client IO if DDNS updates are enabled.
 
void stopD2 ()
 Stops DHCP_DDNS client IO if DDNS updates are enabled.
 
virtual void d2ClientErrorHandler (const dhcp_ddns::NameChangeSender::Result result, dhcp_ddns::NameChangeRequestPtr &ncr)
 Implements the error handler for DHCP_DDNS IO errors.
 
void discardPackets ()
 Discards parked packets Clears the packet parking lots of all packets.
 
void initContext0 (const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx)
 Initialize client context (first part).
 
bool earlyGHRLookup (const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx)
 Initialize client context and perform early global reservations lookup.
 
void processPacketBufferSend (hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &rsp)
 Executes buffer6_send callout and sends the response.
 
std::list< std::list< std::string > > jsonPathsToRedact () const final override
 Return a list of all paths that contain passwords or secrets for kea-dhcp6.
 
static void setHostIdentifiers (AllocEngine::ClientContext6 &ctx)
 Set host identifiers within a context.
 
static uint16_t checkRelaySourcePort (const Pkt6Ptr &query)
 Used for DHCPv4-over-DHCPv6 too.
 
static void processStatsSent (const Pkt6Ptr &response)
 Updates statistics for transmitted packets.
 
static int getHookIndexBuffer6Send ()
 Returns the index of the buffer6_send hook.
 
void setPacketStatisticsDefaults ()
 This function sets statistics related to DHCPv6 packets processing to their initial values.
 
bool testServerID (const Pkt6Ptr &pkt)
 Compare received server id with our server id.
 
bool testUnicast (const Pkt6Ptr &pkt) const
 Check if the message can be sent to unicast.
 
bool sanityCheck (const Pkt6Ptr &pkt)
 Verifies if specified packet meets RFC requirements.
 
void sanityCheck (const Pkt6Ptr &pkt, RequirementLevel clientid, RequirementLevel serverid)
 verifies if specified packet meets RFC requirements
 
void sanityCheckDUID (const OptionPtr &opt, const std::string &opt_name)
 verifies if received DUID option (client-id or server-id) is sane
 
Pkt6Ptr processSolicit (AllocEngine::ClientContext6 &ctx)
 Processes incoming Solicit and returns response.
 
Pkt6Ptr processRequest (AllocEngine::ClientContext6 &ctx)
 Processes incoming Request and returns Reply response.
 
Pkt6Ptr processRenew (AllocEngine::ClientContext6 &ctx)
 Processes incoming Renew message.
 
Pkt6Ptr processRebind (AllocEngine::ClientContext6 &ctx)
 Processes incoming Rebind message.
 
Pkt6Ptr processConfirm (AllocEngine::ClientContext6 &ctx)
 Processes incoming Confirm message and returns Reply.
 
Pkt6Ptr processRelease (AllocEngine::ClientContext6 &ctx)
 Process incoming Release message.
 
Pkt6Ptr processDecline (AllocEngine::ClientContext6 &ctx)
 Process incoming Decline message.
 
Pkt6Ptr processInfRequest (AllocEngine::ClientContext6 &ctx)
 Processes incoming Information-request message.
 
void processDhcp4Query (const Pkt6Ptr &dhcp4_query)
 Processes incoming DHCPv4-query message.
 
isc::dhcp::ConstSubnet6Ptr selectSubnet (const Pkt6Ptr &question, bool &drop)
 Selects a subnet for a given client's packet.
 
OptionPtr assignIA_NA (const isc::dhcp::Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
 Processes IA_NA option (and assigns addresses if necessary).
 
OptionPtr assignIA_PD (const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, boost::shared_ptr< Option6IA > ia)
 Processes IA_PD option (and assigns prefixes if necessary).
 
OptionPtr extendIA_NA (const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
 Extends lifetime of the specific IA_NA option.
 
OptionPtr extendIA_PD (const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia)
 Extends lifetime of the prefix.
 
OptionPtr releaseIA_NA (const DuidPtr &duid, const Pkt6Ptr &query, int &general_status, boost::shared_ptr< Option6IA > ia, Lease6Ptr &old_lease)
 Releases specific IA_NA option.
 
OptionPtr releaseIA_PD (const DuidPtr &duid, const Pkt6Ptr &query, int &general_status, boost::shared_ptr< Option6IA > ia, Lease6Ptr &old_lease)
 Releases specific IA_PD option.
 
void copyClientOptions (const Pkt6Ptr &question, Pkt6Ptr &answer)
 Copies required options from client message to server answer.
 
void buildCfgOptionList (const Pkt6Ptr &question, AllocEngine::ClientContext6 &ctx, CfgOptionList &co_list)
 Build the configured option list.
 
void appendDefaultOptions (const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list)
 Appends default options to server's answer.
 
void appendRequestedOptions (const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list)
 Appends requested options to server's answer.
 
void appendRequestedVendorOptions (const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const CfgOptionList &co_list)
 Appends requested vendor options to server's answer.
 
void assignLeases (const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
 Assigns leases.
 
void processClientFqdn (const Pkt6Ptr &question, const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
 Processes Client FQDN Option.
 
void createNameChangeRequests (const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx)
 Creates a number of isc::dhcp_ddns::NameChangeRequest objects based on the DHCPv6 Client FQDN Option.
 
void extendLeases (const Pkt6Ptr &query, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
 Attempts to extend the lifetime of IAs.
 
void setTeeTimes (uint32_t preferred_lft, const ConstSubnet6Ptr &subnet, Option6IAPtr &resp)
 Sets the T1 and T2 timers in the outbound IA.
 
void releaseLeases (const Pkt6Ptr &release, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
 Attempts to release received addresses.
 
virtual Pkt6Ptr receivePacket (int timeout)
 dummy wrapper around IfaceMgr::receive6
 
virtual void sendPacket (const Pkt6Ptr &pkt)
 dummy wrapper around IfaceMgr::send()
 
void classifyPacket (const Pkt6Ptr &pkt)
 Assigns incoming packet to zero or more classes.
 
void evaluateClasses (const Pkt6Ptr &pkt, bool depend_on_known)
 Evaluate classes.
 
void setReservedClientClasses (const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx)
 Assigns classes retrieved from host reservation database.
 
void conditionallySetReservedClientClasses (const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx)
 Assigns classes retrieved from host reservation database if they haven't been yet set.
 
void evaluateAdditionalClasses (const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx)
 Evaluates classes in the additional classes lists.
 
void processRSOO (const Pkt6Ptr &query, const Pkt6Ptr &rsp)
 Processes Relay-supplied options, if present.
 
void initContext (AllocEngine::ClientContext6 &ctx, bool &drop)
 Initializes client context for specified packet.
 
bool declineLeases (const Pkt6Ptr &decline, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx)
 Attempts to decline all leases in specified Decline message.
 
OptionPtr declineIA (const Pkt6Ptr &decline, const DuidPtr &duid, int &general_status, boost::shared_ptr< Option6IA > ia, Lease6Collection &new_leases)
 Declines leases in a single IA_NA option.
 
bool declineLease (const Pkt6Ptr &decline, const Lease6Ptr lease, boost::shared_ptr< Option6IA > ia_rsp)
 Declines specific IPv6 lease.
 
void setStatusCode (boost::shared_ptr< Option6IA > &container, const OptionPtr &status)
 A simple utility method that sets the status code.
 
void checkDynamicSubnetChange (const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const ConstSubnet6Ptr orig_subnet)
 Iterates over new leases, update stale DNS entries.
 
OptionPtr getPDExclude (const AllocEngine::ClientContext6 &ctx, const Lease6Ptr &lease)
 Return the PD exclude option to include.
 
void processPacketPktSend (hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &query, Pkt6Ptr &rsp, ConstSubnet6Ptr &subnet)
 Executes pkt6_send callout.
 
static std::string duidToString (const OptionPtr &opt)
 converts DUID to text Converts content of DUID option to a text representation, e.g.
 
static void removeDependentEvaluatedClasses (const Pkt6Ptr &pkt)
 Removed evaluated client classes.
 
static HWAddrPtr getMAC (const Pkt6Ptr &pkt)
 Attempts to get a MAC/hardware address using configured sources.
 

Additional Inherited Members

- Protected Member Functions inherited from isc::process::Daemon
std::string makePIDFileName () const
 Manufacture the pid file name.
 
- Protected Attributes inherited from isc::process::Daemon
isc::asiolink::IOSignalSetPtr signal_set_
 A pointer to the object installing custom signal handlers.
 
boost::posix_time::ptime start_
 Timestamp of the start of the daemon.
 

Detailed Description

DHCPv6 server service.

This singleton class represents DHCPv6 server. It contains all top-level methods and routines necessary for server operation. In particular, it instantiates IfaceMgr, loads or generates DUID that is going to be used as server-identifier, receives incoming packets, processes them, manages leases assignment and generates appropriate responses.

This class does not support any controlling mechanisms directly. See the derived ControlledDhcpv6Srv class for support for command and configuration updates over msgq.

Definition at line 66 of file dhcp6_srv.h.

Member Enumeration Documentation

◆ RequirementLevel

defines if certain option may, must or must not appear

Enumerator
FORBIDDEN 
MANDATORY 
OPTIONAL 

Definition at line 74 of file dhcp6_srv.h.

Constructor & Destructor Documentation

◆ Dhcpv6Srv()

isc::dhcp::Dhcpv6Srv::Dhcpv6Srv ( uint16_t server_port = DHCP6_SERVER_PORT,
uint16_t client_port = 0 )

Default constructor.

Instantiates necessary services, required to run DHCPv6 server. In particular, creates IfaceMgr that will be responsible for network interaction. Will instantiate lease manager, and load old or create new DUID. It is possible to specify alternate port on which DHCPv6 server will listen on and alternate port where DHCPv6 server sends all responses to. Those are mostly useful for testing purposes.

Parameters
server_portspecifies port number to listen on
client_portspecifies port number to send to
Todo
call loadLibraries() when handling configuration changes

Definition at line 256 of file dhcp6_srv.cc.

References alloc_engine_, D6O_SERVERID, isc::dhcp::DBG_DHCP6_START, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_NO_INTERFACES, isc::dhcp::DHCP6_OPEN_SOCKET, isc::dhcp::DHCP6_SRV_CONSTRUCT_ERROR, isc::dhcp::DUIDFactory::get(), isc::dhcp::Dhcp6to4Ipc::instance(), isc::dhcp::IfaceMgr::instance(), LOG_DEBUG, LOG_ERROR, serverid_, setPacketStatisticsDefaults(), shutdown_, and isc::dhcp::Option::V6.

+ Here is the call graph for this function:

◆ ~Dhcpv6Srv()

isc::dhcp::Dhcpv6Srv::~Dhcpv6Srv ( )
virtual

Member Function Documentation

◆ appendDefaultOptions()

void isc::dhcp::Dhcpv6Srv::appendDefaultOptions ( const Pkt6Ptr & question,
Pkt6Ptr & answer,
const CfgOptionList & co_list )
protected

Appends default options to server's answer.

Adds required options to server's answer. In particular, server-id is added. Possibly other mandatory options will be added, depending on type (or content) of client message.

Parameters
questionclient's message
answerserver's message (options will be added here)
co_listconfigured option list (currently unused)

Definition at line 1568 of file dhcp6_srv.cc.

References getServerID().

Referenced by processConfirm(), processDecline(), processInfRequest(), processRebind(), processRelease(), processRenew(), processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ appendRequestedOptions()

void isc::dhcp::Dhcpv6Srv::appendRequestedOptions ( const Pkt6Ptr & question,
Pkt6Ptr & answer,
const CfgOptionList & co_list )
protected

Appends requested options to server's answer.

Appends options requested by client to the server's answer.

Parameters
questionclient's message
answerserver's message (options will be added here)
co_listconfigured option list

Definition at line 1642 of file dhcp6_srv.cc.

References D6O_ORO, D6O_VENDOR_CLASS, D6O_VENDOR_OPTS, DHCP6_OPTION_SPACE, and isc::dhcp::Option::V6.

Referenced by processConfirm(), processInfRequest(), processRebind(), processRenew(), processRequest(), and processSolicit().

◆ appendRequestedVendorOptions()

void isc::dhcp::Dhcpv6Srv::appendRequestedVendorOptions ( const Pkt6Ptr & question,
Pkt6Ptr & answer,
AllocEngine::ClientContext6 & ctx,
const CfgOptionList & co_list )
protected

Appends requested vendor options to server's answer.

This is mostly useful for Cable Labs options for now, but the method is easily extensible to other vendors.

Parameters
questionclient's message
answerserver's message (vendor options will be added here)
ctxclient context (contains subnet, duid and other parameters)
co_listconfigured option list

Definition at line 1802 of file dhcp6_srv.cc.

References D6O_VENDOR_CLASS, D6O_VENDOR_OPTS, DOCSIS3_V6_ORO, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::Option::V6, and VENDOR_ID_CABLE_LABS.

Referenced by processConfirm(), processInfRequest(), processRebind(), processRenew(), processRequest(), and processSolicit().

◆ assignIA_NA()

OptionPtr isc::dhcp::Dhcpv6Srv::assignIA_NA ( const isc::dhcp::Pkt6Ptr & query,
AllocEngine::ClientContext6 & ctx,
Option6IAPtr ia )
protected

Processes IA_NA option (and assigns addresses if necessary).

Generates response to IA_NA. This typically includes selecting (and allocating a lease in case of REQUEST) an address lease and creating IAADDR option. In case of allocation failure, it may contain status code option with non-zero status, denoting cause of the allocation failure.

Parameters
queryclient's message (typically SOLICIT or REQUEST) to the client (if the client sent this option to the server).
ctxclient context (contains subnet, duid and other parameters)
iapointer to client's IA_NA option (client's request)
Returns
IA_NA option (server's response)
Todo
: Handle more than one lease

Definition at line 2577 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::IAContext::addHint(), alloc_engine_, isc::dhcp::AllocEngine::ClientContext6::createIAContext(), isc::dhcp::AllocEngine::ClientContext6::currentIA(), D6O_IA_NA, D6O_IAADDR, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DBG_DHCP6_DETAIL_DATA, isc::dhcp::DHCP6_LEASE_ADVERT, isc::dhcp::DHCP6_LEASE_ADVERT_FAIL, isc::dhcp::DHCP6_LEASE_ALLOC, isc::dhcp::DHCP6_LEASE_ALLOC_FAIL, isc::dhcp::DHCP6_LEASE_DATA, isc::dhcp::DHCP6_LEASE_REUSE, isc::dhcp::DHCP6_PROCESS_IA_NA_REQUEST, isc::dhcp::DHCP6_PROCESS_IA_NA_SOLICIT, isc::dhcp::AllocEngine::ClientContext6::fake_allocation_, isc::stats::StatsMgr::generateName(), isc::dhcp::AllocEngine::ClientContext6::IAContext::ia_rsp_, isc::dhcp::AllocEngine::ClientContext6::IAContext::iaid_, isc::stats::StatsMgr::instance(), isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS(), isc::dhcp::lease6_logger, isc::dhcp::Lease::lifetimeToText(), LOG_DEBUG, LOG_INFO, isc::dhcp::AllocEngine::ClientContext6::IAContext::reused_leases_, setTeeTimes(), STATUS_NoAddrsAvail, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::AllocEngine::ClientContext6::IAContext::type_, and isc::dhcp::Lease::TYPE_NA.

Referenced by assignLeases().

+ Here is the call graph for this function:

◆ assignIA_PD()

OptionPtr isc::dhcp::Dhcpv6Srv::assignIA_PD ( const Pkt6Ptr & query,
AllocEngine::ClientContext6 & ctx,
boost::shared_ptr< Option6IA > ia )
protected

Processes IA_PD option (and assigns prefixes if necessary).

Generates response to IA_PD. This typically includes selecting (and allocating in the case of REQUEST) a prefix lease and creating an IAPREFIX option. In case of an allocation failure, it may contain a status code option with non-zero status denoting the cause of the allocation failure.

Parameters
queryclient's message (typically SOLICIT or REQUEST)
ctxclient context (contains subnet, duid and other parameters)
iapointer to client's IA_PD option (client's request)
Returns
IA_PD option (server's response)

Definition at line 2719 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::IAContext::addHint(), alloc_engine_, isc::dhcp::AllocEngine::ClientContext6::createIAContext(), isc::dhcp::AllocEngine::ClientContext6::currentIA(), D6O_IA_PD, D6O_IAPREFIX, D6O_PD_EXCLUDE, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DHCP6_PD_LEASE_ADVERT, isc::dhcp::DHCP6_PD_LEASE_ADVERT_FAIL, isc::dhcp::DHCP6_PD_LEASE_ALLOC, isc::dhcp::DHCP6_PD_LEASE_ALLOC_FAIL, isc::dhcp::DHCP6_PD_LEASE_REUSE, isc::dhcp::DHCP6_PROCESS_IA_PD_REQUEST, isc::dhcp::DHCP6_PROCESS_IA_PD_SOLICIT, isc::dhcp::AllocEngine::ClientContext6::fake_allocation_, isc::stats::StatsMgr::generateName(), getPDExclude(), isc::dhcp::AllocEngine::ClientContext6::IAContext::ia_rsp_, isc::dhcp::AllocEngine::ClientContext6::IAContext::iaid_, isc::stats::StatsMgr::instance(), isc::asiolink::IOAddress::IPV6_ZERO_ADDRESS(), isc::dhcp::lease6_logger, isc::dhcp::Lease::lifetimeToText(), LOG_DEBUG, LOG_INFO, setTeeTimes(), STATUS_NoPrefixAvail, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::AllocEngine::ClientContext6::IAContext::type_, and isc::dhcp::Lease::TYPE_PD.

Referenced by assignLeases().

+ Here is the call graph for this function:

◆ assignLeases()

void isc::dhcp::Dhcpv6Srv::assignLeases ( const Pkt6Ptr & question,
Pkt6Ptr & answer,
AllocEngine::ClientContext6 & ctx )
protected

Assigns leases.

It supports non-temporary addresses (IA_NA) and prefixes (IA_PD). It does NOT support temporary addresses (IA_TA).

Parameters
questionclient's message (with requested IA options)
answerserver's message (IA options will be added here). This message should contain Client FQDN option being sent by the server to the client (if the client sent this option to the server).
ctxclient context (contains subnet, duid and other parameters)

Definition at line 2210 of file dhcp6_srv.cc.

References assignIA_NA(), assignIA_PD(), checkDynamicSubnetChange(), D6O_IA_NA, D6O_IA_PD, and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ buildCfgOptionList()

void isc::dhcp::Dhcpv6Srv::buildCfgOptionList ( const Pkt6Ptr & question,
AllocEngine::ClientContext6 & ctx,
CfgOptionList & co_list )
protected

Build the configured option list.

Note
The configured option list is an ordered list of CfgOption objects used to append options to the response.
Parameters
questionclient's message
ctxclient context (for the subnet)
co_listconfigured option list to build

Definition at line 1575 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::allocated_resources_, isc::dhcp::AllocEngine::ClientContext6::currentHost(), isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASS_UNCONFIGURED, isc::dhcp::dhcp6_logger, isc::dhcp::CfgMgr::instance(), isc::dhcp::isClientClassBuiltIn(), LOG_DEBUG, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_PD.

Referenced by processConfirm(), processDecline(), processInfRequest(), processRebind(), processRenew(), processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ checkDynamicSubnetChange()

void isc::dhcp::Dhcpv6Srv::checkDynamicSubnetChange ( const Pkt6Ptr & question,
Pkt6Ptr & answer,
AllocEngine::ClientContext6 & ctx,
const ConstSubnet6Ptr orig_subnet )
protected

Iterates over new leases, update stale DNS entries.

Checks the context's current subnet (most recently selected) against an original selected subnet. If they are the same the function simply returns.

If they differ, we treat this as a dynamic subnet change made by the allocation engine. It is possible that DDNS subnet parameters for the new subnet are different and this needs to handled. We first save the current DNS-related values from the context and then re-run processClientFqdn(). This will rebuild the FQDN option to send back to the client based on the new subnet as well as update the context. If the new values are different from the previous values, we iterate over the leases and update the DNS values.

Parameters
questionClient's message.
answerServer's response to a client. If server generated
ctxclient context (contains subnet, duid and other parameters)
orig_subnetthe originally selected subnet
Note
Subnet may be modified by the allocation engine, if the initial subnet belongs to a shared network. Note that this will only handle cases where all IA_xx's in a client request result in a subnet change. It is possible, currently, for the last IA_xx in request to end up using the same subnet as originally selected, and we will miss a change incurred by preceding IA_xx's. In general users should be strongly encouraged to avoid situations where all of the following are true:
  1. clients send more than one IA_xx in a query
  2. subnets in the shared-network are equally eligible (i.e don't have class guards etc)
  3. subnets have differing options or DDNS parameters

Definition at line 5070 of file dhcp6_srv.cc.

References D6O_CLIENT_FQDN, isc::dhcp::DBG_DHCP6_BASIC_DATA, isc::dhcp::DHCP6_SUBNET_DYNAMICALLY_CHANGED, isc::dhcp::AllocEngine::ClientContext6::fake_allocation_, isc::dhcp::AllocEngine::ClientContext6::fwd_dns_update_, isc::dhcp::AllocEngine::ClientContext6::hostname_, isc::dhcp::LeaseMgrFactory::instance(), LOG_DEBUG, isc::dhcp::AllocEngine::ClientContext6::new_leases_, isc::dhcp::packet6_logger, processClientFqdn(), isc::dhcp::AllocEngine::ClientContext6::rev_dns_update_, and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by assignLeases(), and extendLeases().

+ Here is the call graph for this function:

◆ checkRelaySourcePort()

uint16_t isc::dhcp::Dhcpv6Srv::checkRelaySourcePort ( const Pkt6Ptr & query)
static

Used for DHCPv4-over-DHCPv6 too.

Check if the last relay added a relay-source-port option.

Parameters
queryDHCPv6 message to be checked.
Returns
the port to use to join the relay or 0 for the default.

Definition at line 4856 of file dhcp6_srv.cc.

References D6O_RELAY_SOURCE_PORT.

Referenced by isc::dhcp::Dhcp6to4Ipc::handler(), and processLocalizedQuery6().

◆ classifyPacket()

void isc::dhcp::Dhcpv6Srv::classifyPacket ( const Pkt6Ptr & pkt)
protected

Assigns incoming packet to zero or more classes.

Note
This is done in two phases: first the content of the vendor-class-identifier options are used as classes, by calling (private) classifyByVendor. Second, the classification match expressions are evaluated. The resulting classes will be stored in the packet (see isc::dhcp::Pkt6::classes_ and isc::dhcp::Pkt6::inClass).
Parameters
pktpacket to be classified

Definition at line 4476 of file dhcp6_srv.cc.

References evaluateClasses().

Referenced by processPacket().

+ Here is the call graph for this function:

◆ conditionallySetReservedClientClasses()

void isc::dhcp::Dhcpv6Srv::conditionallySetReservedClientClasses ( const Pkt6Ptr & pkt,
const AllocEngine::ClientContext6 & ctx )
protected

Assigns classes retrieved from host reservation database if they haven't been yet set.

This function sets reserved client classes in case they haven't been set after fetching host reservations from the database. This is the case when the client has non-global host reservation and the selected subnet belongs to a shared network.

Parameters
pktPointer to the packet to which classes will be assigned.
ctxReference to the client context.

Definition at line 4538 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::currentHost(), setReservedClientClasses(), and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processConfirm(), processDecline(), processInfRequest(), processRebind(), processRelease(), processRenew(), processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ copyClientOptions()

void isc::dhcp::Dhcpv6Srv::copyClientOptions ( const Pkt6Ptr & question,
Pkt6Ptr & answer )
protected

Copies required options from client message to server answer.

Copies options that must appear in any server response (ADVERTISE, REPLY) to client's messages (SOLICIT, REQUEST, RENEW, REBIND, DECLINE, RELEASE). One notable example is client-id. Other options may be copied as required. Relay information details are also copied here.

Parameters
questionclient's message (options will be copied from here)
answerserver's message (options will be copied here)
Todo
: Should throw if there is no client-id (except anonymous INF-REQUEST)

Definition at line 1552 of file dhcp6_srv.cc.

References D6O_CLIENTID.

Referenced by processConfirm(), processDecline(), processInfRequest(), processRebind(), processRelease(), processRenew(), processRequest(), and processSolicit().

◆ createNameChangeRequests()

void isc::dhcp::Dhcpv6Srv::createNameChangeRequests ( const Pkt6Ptr & answer,
AllocEngine::ClientContext6 & ctx )
protected

Creates a number of isc::dhcp_ddns::NameChangeRequest objects based on the DHCPv6 Client FQDN Option.

The isc::dhcp_ddns::NameChangeRequest class encapsulates the request from the DHCPv6 server to the DHCP-DDNS module to perform DNS Update. The FQDN option carries response to the client about DNS updates that server intends to perform for the DNS client. Based on this, the function will create zero or more isc::dhcp_ddns::NameChangeRequest objects and store them in the internal queue. To catch lease renewals that alter the FQDN, the function first looks at the context's changed list of leases (if any) to determine if DNS entries need to be removed. It then looks at the valid leases to determine if any DNS entries need to be added. If DNS updates are disabled, this method returns immediately.

Todo
Add support for multiple IAADDR options in the IA_NA.
Parameters
answerA message begins sent to the Client. If it holds the
ctxclient context (contains subnet, duid and other parameters) Client FQDN option, this option is used to create NameChangeRequests.
Todo
IA_NA may contain multiple addresses. We should process each address individually. Currently we only process the first one.
Todo
Currently we create NCR with the first IPv6 address that is carried in one of the IA_NAs. In the future, the NCR API should be extended to map multiple IPv6 addresses to a single FQDN. In such case, this return statement will be removed.

Definition at line 2392 of file dhcp6_srv.cc.

References isc::dhcp::calculateDdnsTtl(), isc::dhcp_ddns::CHG_ADD, isc::dhcp_ddns::CHG_REMOVE, D6O_CLIENT_FQDN, D6O_CLIENTID, D6O_IAADDR, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::ddns6_logger, isc::dhcp::DHCP6_DDNS_CREATE_ADD_NAME_CHANGE_REQUEST, isc::dhcp::AllocEngine::ClientContext6::getDdnsParams(), isc::dhcp::AllocEngine::ClientContext6::getIAContexts(), isc::dhcp::CfgMgr::instance(), isc_throw, LOG_DEBUG, isc::dhcp::queueNCR(), isc::dhcp_ddns::StringToConflictResolutionMode(), and isc::dhcp::Lease::TYPE_NA.

Referenced by processRebind(), processRenew(), processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ d2ClientErrorHandler()

void isc::dhcp::Dhcpv6Srv::d2ClientErrorHandler ( const dhcp_ddns::NameChangeSender::Result result,
dhcp_ddns::NameChangeRequestPtr & ncr )
virtual

Implements the error handler for DHCP_DDNS IO errors.

Invoked when a NameChangeRequest send to kea-dhcp-ddns completes with a failed status. These are communications errors, not data related failures.

This method logs the failure and then suspends all further updates. Updating can only be restored by reconfiguration or restarting the server. There is currently no retry logic so the first IO error that occurs will suspend updates.

Todo
We may wish to make this more robust or sophisticated.
Parameters
resultResult code of the send operation.
ncrNameChangeRequest which failed to send.
Todo
We may wish to revisit this, but for now we will simply turn them off.

Definition at line 4781 of file dhcp6_srv.cc.

References isc::dhcp::ddns6_logger, isc::dhcp::DHCP6_DDNS_REQUEST_SEND_FAILED, isc::dhcp::CfgMgr::instance(), and LOG_ERROR.

Referenced by startD2().

+ Here is the call graph for this function:

◆ declineIA()

OptionPtr isc::dhcp::Dhcpv6Srv::declineIA ( const Pkt6Ptr & decline,
const DuidPtr & duid,
int & general_status,
boost::shared_ptr< Option6IA > ia,
Lease6Collection & new_leases )
protected

Declines leases in a single IA_NA option.

This method iterates over all addresses in this IA_NA, verifies whether they belong to the client and calls declineLease. If there's an error, general_status (a status put in the top level scope), will be updated.

Parameters
declineclient's Decline message
duidclient's duid (used to verify if the client owns the lease)
general_status[out] status in top-level message (may be updated)
iaspecific IA_NA option to process.
new_leasesa collection of leases being declined.
Returns
IA_NA option with response (to be included in Reply message)

Definition at line 4154 of file dhcp6_srv.cc.

References D6O_IA_NA, D6O_IAADDR, isc::dhcp::DBG_DHCP6_DETAIL, declineLease(), isc::dhcp::DHCP6_DECLINE_FAIL_DUID_MISMATCH, isc::dhcp::DHCP6_DECLINE_FAIL_IAID_MISMATCH, isc::dhcp::DHCP6_DECLINE_FAIL_LEASE_WITHOUT_DUID, isc::dhcp::DHCP6_DECLINE_FAIL_NO_LEASE, isc::dhcp::DHCP6_DECLINE_PROCESS_IA, isc::dhcp::LeaseMgrFactory::instance(), isc::dhcp::lease6_logger, LOG_DEBUG, LOG_ERROR, LOG_INFO, setStatusCode(), isc::dhcp::Lease::STATE_DEFAULT, STATUS_NoBinding, STATUS_UnspecFail, and isc::dhcp::Lease::TYPE_NA.

Referenced by declineLeases().

+ Here is the call graph for this function:

◆ declineLease()

bool isc::dhcp::Dhcpv6Srv::declineLease ( const Pkt6Ptr & decline,
const Lease6Ptr lease,
boost::shared_ptr< Option6IA > ia_rsp )
protected

Declines specific IPv6 lease.

This method performs the actual decline and all necessary operations:

  • cleans up DNS, if necessary
  • updates subnet[X].declined-addresses (per subnet stat)
  • updates declined-addresses (global stat)
  • disassociates client information from the lease
  • moves the lease to DECLINED state
  • sets lease expiration time to decline-probation-period
  • adds status-code success
Parameters
declineused for generating removal Name Change Request.
leaselease to be declined
ia_rspresponse IA_NA.
Returns
true when expected to continue, false when hooks told us to drop the packet

Definition at line 4287 of file dhcp6_srv.cc.

References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::dhcp_ddns::CHG_REMOVE, isc::dhcp::DBG_DHCP6_DETAIL, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_DECLINE_FAIL, isc::dhcp::DHCP6_DECLINE_LEASE, isc::dhcp::DHCP6_HOOK_DECLINE_DROP, isc::dhcp::DHCP6_HOOK_DECLINE_SKIP, isc::stats::StatsMgr::generateName(), isc::dhcp::getCalloutHandle(), Hooks, isc::hooks::hooks_logger, isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc::stats::StatsMgr::instance(), isc::dhcp::lease6_logger, LOG_DEBUG, LOG_ERROR, LOG_INFO, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::queueNCR(), STATUS_Success, and isc::dhcp::Lease::TYPE_NA.

Referenced by declineIA().

+ Here is the call graph for this function:

◆ declineLeases()

bool isc::dhcp::Dhcpv6Srv::declineLeases ( const Pkt6Ptr & decline,
Pkt6Ptr & reply,
AllocEngine::ClientContext6 & ctx )
protected

Attempts to decline all leases in specified Decline message.

This method iterates over all IA_NA options and calls declineIA on each of them.

Parameters
declineDecline message sent by a client
replyServer's response (IA_NA with status will be added here)
ctxcontext
Returns
true when expected to continue, false when hooks told us to drop the packet

Definition at line 4112 of file dhcp6_srv.cc.

References D6O_IA_NA, declineIA(), isc::dhcp::AllocEngine::ClientContext6::duid_, isc::dhcp::AllocEngine::ClientContext6::new_leases_, and STATUS_Success.

Referenced by processDecline().

+ Here is the call graph for this function:

◆ discardPackets()

void isc::dhcp::Dhcpv6Srv::discardPackets ( )

Discards parked packets Clears the packet parking lots of all packets.

Called during reconfigure and shutdown.

Definition at line 4990 of file dhcp6_srv.cc.

References isc::hooks::HooksManager::clearParkingLots().

Referenced by ~Dhcpv6Srv().

+ Here is the call graph for this function:

◆ duidToString()

std::string isc::dhcp::Dhcpv6Srv::duidToString ( const OptionPtr & opt)
staticprotected

converts DUID to text Converts content of DUID option to a text representation, e.g.

01:ff:02:03:06:80:90:ab:cd:ef

Parameters
optoption that contains DUID
Returns
string representation

Definition at line 1532 of file dhcp6_srv.cc.

Referenced by testServerID().

◆ earlyGHRLookup()

bool isc::dhcp::Dhcpv6Srv::earlyGHRLookup ( const Pkt6Ptr & query,
AllocEngine::ClientContext6 & ctx )

Initialize client context and perform early global reservations lookup.

Parameters
queryThe query message.
ctxReference to client context.
Returns
true if processing can continue, false if the query must be dropped.

Definition at line 487 of file dhcp6_srv.cc.

References alloc_engine_, isc::dhcp::DBG_DHCP6_BASIC, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_CLASS_ASSIGNED, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_PACKET_DROP_DROP_CLASS_EARLY, isc::dhcp::CfgGlobals::EARLY_GLOBAL_RESERVATIONS_LOOKUP, isc::dhcp::AllocEngine::ClientContext6::early_global_reservations_lookup_, evaluateClasses(), isc::dhcp::AllocEngine::ClientContext6::hosts_, initContext0(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), LOG_DEBUG, isc::dhcp::packet6_logger, removeDependentEvaluatedClasses(), and setHostIdentifiers().

Referenced by processDhcp6Query().

+ Here is the call graph for this function:

◆ evaluateAdditionalClasses()

void isc::dhcp::Dhcpv6Srv::evaluateAdditionalClasses ( const Pkt6Ptr & pkt,
AllocEngine::ClientContext6 & ctx )
protected

Evaluates classes in the additional classes lists.

The evaluation takes place after all other classification and lease assignment. It evaluates all classes in the packet's additional classes list plus any contributed via evaluate-additional-classes lists.

Note
Evaluates all classes which were marked for the additional evaluation stage. Classes are collected and evaluated in the following order: pool/pd-pool, subnet, shared-network to produce option precedence pool/pd-pool over subnet over shared-network.
The only-in-additional-list flag is related because it avoids double evaluation (which is not forbidden).
Parameters
pktpacket to be classified
ctxallocation context where to get information

Definition at line 4553 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::allocated_resources_, isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DHCP6_ADDITIONAL_CLASS_EVAL_ERROR, isc::dhcp::DHCP6_ADDITIONAL_CLASS_EVAL_RESULT, isc::dhcp::DHCP6_ADDITIONAL_CLASS_NO_TEST, isc::dhcp::DHCP6_ADDITIONAL_CLASS_UNDEFINED, isc::dhcp::dhcp6_logger, isc::dhcp::evaluateBool(), isc::dhcp::ClientClasses::insert(), isc::dhcp::CfgMgr::instance(), LOG_DEBUG, LOG_ERROR, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::Lease::TYPE_NA, and isc::dhcp::Lease::TYPE_PD.

Referenced by processConfirm(), processDecline(), processInfRequest(), processRebind(), processRelease(), processRenew(), processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ evaluateClasses()

void isc::dhcp::Dhcpv6Srv::evaluateClasses ( const Pkt6Ptr & pkt,
bool depend_on_known )
protected

Evaluate classes.

Note
Second part of the classification.

Evaluate expressions of client classes: if it returns true the class is added to the incoming packet.

Parameters
pktpacket to be classified.
depend_on_knownif false classes depending on the KNOWN or UNKNOWN classes are skipped, if true only these classes are evaluated.

Definition at line 4487 of file dhcp6_srv.cc.

References isc::dhcp::CfgMgr::instance().

Referenced by classifyPacket(), earlyGHRLookup(), and initContext().

+ Here is the call graph for this function:

◆ extendIA_NA()

OptionPtr isc::dhcp::Dhcpv6Srv::extendIA_NA ( const Pkt6Ptr & query,
AllocEngine::ClientContext6 & ctx,
Option6IAPtr ia )
protected

Extends lifetime of the specific IA_NA option.

Generates response to IA_NA in Renew or Rebind. This typically includes finding a lease that corresponds to the received address. If no such lease is found, an IA_NA response is generated with an appropriate status code.

Parameters
queryclient's message (Renew or Rebind) to the client (if the client sent this option to the server).
ctxclient context (contains subnet, duid and other parameters)
iaIA_NA option which carries address for which lease lifetime will be extended.
Returns
IA_NA option (server's response)
Todo
For simplicity and due to limitations of LeaseMgr we don't get the binding for the client for which we don't get subnet id. Subnet id is a required value when searching for the bindings. The fact that we can't identify the subnet for the returning client doesn't really mean that the client has no binding. It is possible that due to server's reconfiguration the subnet has been removed or modified since the client has got his lease. We may need to rethink whether it is appropriate to send no binding if the subnet hasn't been found for the client.

Definition at line 2868 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::IAContext::addHint(), alloc_engine_, isc::dhcp_ddns::CHG_REMOVE, isc::dhcp::AllocEngine::ClientContext6::createIAContext(), isc::dhcp::AllocEngine::ClientContext6::currentIA(), D6O_IA_NA, D6O_IAADDR, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::ddns6_logger, isc::dhcp::DHCP6_DDNS_REMOVE_OLD_LEASE_FQDN, isc::dhcp::DHCP6_LEASE_RENEW, isc::dhcp::DHCP6_LEASE_REUSE, isc::dhcp::DHCP6_PROCESS_IA_NA_EXTEND, isc::util::equalValues(), isc::dhcp::AllocEngine::ClientContext6::fwd_dns_update_, isc::stats::StatsMgr::generateName(), isc::dhcp::AllocEngine::ClientContext6::IAContext::hints_, isc::dhcp::AllocEngine::ClientContext6::hostname_, isc::dhcp::AllocEngine::ClientContext6::IAContext::ia_rsp_, isc::dhcp::AllocEngine::ClientContext6::IAContext::iaid_, isc::stats::StatsMgr::instance(), isc::dhcp::lease6_logger, isc::dhcp::Lease::lifetimeToText(), LOG_DEBUG, LOG_INFO, isc::dhcp::AllocEngine::ClientContext6::IAContext::old_leases_, isc::dhcp::queueNCR(), isc::dhcp::AllocEngine::ClientContext6::rev_dns_update_, setTeeTimes(), STATUS_NoAddrsAvail, STATUS_NoBinding, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::AllocEngine::ClientContext6::IAContext::type_, and isc::dhcp::Lease::TYPE_NA.

Referenced by extendLeases().

+ Here is the call graph for this function:

◆ extendIA_PD()

OptionPtr isc::dhcp::Dhcpv6Srv::extendIA_PD ( const Pkt6Ptr & query,
AllocEngine::ClientContext6 & ctx,
Option6IAPtr ia )
protected

Extends lifetime of the prefix.

This function is called by the logic which processes Renew and Rebind messages to extend the lifetime of the existing prefix.

The behavior of this function is different than extendIA_NA in that when there is no subnet found for the rebinding case, the Rebind message is discarded by the server. That behavior is based on the following statement from the RFC 8415, section 18.3.5:

"If the server chooses to not include any IAs containing IA Address or IA Prefix options with lifetimes of 0 and the server does not include any other IAs with leases and/or status codes, the server does not send a Reply message. In this situation, the server discards the Rebind message".

Todo
We should consider unification of the server behavior for address assignment and prefix delegation with respect to Rebind message processing. The RFC 8415, section 18.3.5 doesn't really differentiate between IA_NA and IA_PD in how they should be processed by the server. The intention of the spec is as follows:
  • If the server finds a lease but addresses and/or prefixes are not appropriate anymore, it sends them with zero lifetimes.
  • If the server doesn't find a lease the server checks if the addresses and/or prefixes the client sends are appropriate and sends them back with zero lifetimes if they aren't.
  • The server may choose to not respond at all, if it cannot determine whether the addresses and/or prefixes are appropriate and it doesn't allocate any other addresses and/or prefixes.
  • If the server cannot find the leases included in the Rebind, the server may either allocate the leases or simply return NoBinding.

The extendIA_PD function drops the Rebind message if it cannot find the client entry (as a result of not finding a subnet for the client), the extendIA_NA function sends NoBinding status code in that case. Perhaps we should introduce an "Authoritative" configuration flag which, if enabled, would cause the server to always respond, either indicating that the address/prefix is inappropriate (with zero lifetimes) or that there is no binding (NoBinding status code) for both addresses and prefixes. When the "Authoritative" flag is disabled the server would drop the Rebind for which there is neither subnet selected nor client entry found (as it could be handled by another DHCP server). If nothing else we could consider unifying the behavior of extendIA_NA and extendIA_PD with respect to Rebind processing.

Parameters
queryclient's message
ctxclient context (contains subnet, duid and other parameters)
iaIA_PD option that is being renewed
Returns
IA_PD option (server's response)
Exceptions
DHCPv6DiscardMessageErrorwhen the message being processed should be discarded by the server, i.e. there is no binding for the client doing Rebind.
Todo
: We may consider in which cases we could determine whether the delegated prefixes are appropriate for the link to which the client's interface is attached. Just not being able to select the subnet may not be enough, because there might be other DHCP servers around that are configured to handle that subnet. Therefore we don't fully follow all the paths in section 18.3.5 of RFC 8415 to respond with zero lifetimes for the prefixes being rebound.

For the leases that we just retired, send the prefixes with 0 lifetimes.

Definition at line 3032 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::IAContext::addHint(), alloc_engine_, isc::dhcp::AllocEngine::ClientContext6::createIAContext(), isc::dhcp::AllocEngine::ClientContext6::currentIA(), D6O_IA_PD, D6O_IAPREFIX, D6O_PD_EXCLUDE, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DHCP6_PD_LEASE_RENEW, isc::dhcp::DHCP6_PD_LEASE_REUSE, isc::dhcp::DHCP6_PROCESS_IA_PD_EXTEND, DHCPV6_RENEW, isc::dhcp::AllocEngine::ClientContext6::duid_, isc::util::equalValues(), isc::stats::StatsMgr::generateName(), getPDExclude(), isc::dhcp::AllocEngine::ClientContext6::IAContext::hints_, isc::dhcp::AllocEngine::ClientContext6::IAContext::ia_rsp_, isc::dhcp::AllocEngine::ClientContext6::IAContext::iaid_, isc::stats::StatsMgr::instance(), isc_throw, isc::dhcp::lease6_logger, isc::dhcp::Lease::lifetimeToText(), LOG_DEBUG, LOG_INFO, isc::dhcp::AllocEngine::ClientContext6::IAContext::old_leases_, setTeeTimes(), STATUS_NoBinding, STATUS_NoPrefixAvail, isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::AllocEngine::ClientContext6::IAContext::type_, and isc::dhcp::Lease::TYPE_PD.

Referenced by extendLeases().

+ Here is the call graph for this function:

◆ extendLeases()

void isc::dhcp::Dhcpv6Srv::extendLeases ( const Pkt6Ptr & query,
Pkt6Ptr & reply,
AllocEngine::ClientContext6 & ctx )
protected

Attempts to extend the lifetime of IAs.

This function is called when a client sends Renew or Rebind message. It iterates through received IA options and attempts to extend corresponding lease lifetimes. Internally, it calls Dhcpv6Srv::extendIA_NA and Dhcpv6Srv::extendIA_PD to extend the lifetime of IA_NA and IA_PD leases accordingly.

Parameters
queryclient's Renew or Rebind message
replyserver's response
ctxclient context (contains subnet, duid and other parameters)
Todo
add support for IA_TA

Definition at line 3227 of file dhcp6_srv.cc.

References checkDynamicSubnetChange(), D6O_IA_NA, D6O_IA_PD, extendIA_NA(), extendIA_PD(), and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processRebind(), and processRenew().

+ Here is the call graph for this function:

◆ getCBControl()

CBControlDHCPv6Ptr isc::dhcp::Dhcpv6Srv::getCBControl ( ) const
inline

Returns an object which controls access to the configuration backends.

Returns
Pointer to the instance of the object which controls access to the configuration backends.

Definition at line 124 of file dhcp6_srv.h.

References cb_control_.

◆ getHookIndexBuffer6Send()

int isc::dhcp::Dhcpv6Srv::getHookIndexBuffer6Send ( )
static

Returns the index of the buffer6_send hook.

Returns
the index of the buffer6_send hook

Definition at line 4951 of file dhcp6_srv.cc.

References Hooks.

Referenced by isc::dhcp::Dhcp6to4Ipc::handler().

◆ getIOService()

asiolink::IOServicePtr & isc::dhcp::Dhcpv6Srv::getIOService ( )
inline

◆ getMAC()

HWAddrPtr isc::dhcp::Dhcpv6Srv::getMAC ( const Pkt6Ptr & pkt)
staticprotected

Attempts to get a MAC/hardware address using configured sources.

Tries to extract MAC/hardware address information from the packet using MAC sources configured in 'mac-sources' configuration parameter.

Parameters
pktwill try to exact MAC address from this packet
Returns
HWaddr pointer (or NULL if configured methods fail)

Definition at line 2537 of file dhcp6_srv.cc.

References isc::dhcp::CfgMgr::instance().

Referenced by initContext0().

+ Here is the call graph for this function:

◆ getNetworkState()

NetworkStatePtr & isc::dhcp::Dhcpv6Srv::getNetworkState ( )
inline

Returns pointer to the network state used by the server.

Definition at line 115 of file dhcp6_srv.h.

References network_state_.

◆ getPDExclude()

OptionPtr isc::dhcp::Dhcpv6Srv::getPDExclude ( const AllocEngine::ClientContext6 & ctx,
const Lease6Ptr & lease )
protected

Return the PD exclude option to include.

Parameters
ctxclient context (contains subnet and hosts).
leaselease (contains address/prefix and prefix length).
Returns
the prefix exclude option or null.

Definition at line 2551 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::currentHost(), isc::dhcp::AllocEngine::ClientContext6::subnet_, isc::dhcp::IPv6Resrv::TYPE_PD, and isc::dhcp::Lease::TYPE_PD.

Referenced by assignIA_PD(), and extendIA_PD().

+ Here is the call graph for this function:

◆ getServerID()

OptionPtr isc::dhcp::Dhcpv6Srv::getServerID ( )
inline

Returns server-identifier option.

Returns
server-id option

Definition at line 135 of file dhcp6_srv.h.

References serverid_.

Referenced by appendDefaultOptions(), and testServerID().

◆ getServerPort()

uint16_t isc::dhcp::Dhcpv6Srv::getServerPort ( ) const

Get UDP port on which server should listen.

Typically, server listens on UDP port number 547. Other ports are used for testing purposes only.

Returns
UDP port on which server should listen.

Definition at line 4995 of file dhcp6_srv.cc.

References server_port_.

◆ getVersion()

std::string isc::dhcp::Dhcpv6Srv::getVersion ( bool extended)
static

returns Kea version on stdout and exit.

redeclaration/redefinition. isc::process::Daemon::getVersion()

Definition at line 4793 of file dhcp6_srv.cc.

References isc::dhcp::HostDataSourceFactory::getDBVersions(), isc::dhcp::LeaseMgrFactory::getDBVersions(), isc::cryptolink::CryptoLink::getVersion(), isc::log::Logger::getVersion(), isc::db::info, and version().

Referenced by main().

+ Here is the call graph for this function:

◆ initContext()

void isc::dhcp::Dhcpv6Srv::initContext ( AllocEngine::ClientContext6 & ctx,
bool & drop )
protected

Initializes client context for specified packet.

This method:

  • Extracts the duid from the packet and saves it to the context
  • Extracts the hardware address from the packet and saves it to the context
  • Performs host reservation lookup and stores the result in the context

Even though the incoming packet type is known to this method, it doesn't set the fake_allocation flag, because of a possibility that the Rapid Commit option is in use. The fake_allocation flag is set appropriately after it has been determined whether the Rapid Commit option was included and that the server respects it.

Parameters
[out]ctxreference to context object to be initialized.
[out]dropif it is true the packet will be dropped.

Definition at line 551 of file dhcp6_srv.cc.

References alloc_engine_, isc::dhcp::AllocEngine::ClientContext6::callout_handle_, isc::dhcp::AllocEngine::ClientContext6::currentHost(), isc::dhcp::DBG_DHCP6_BASIC, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_CLASS_ASSIGNED, isc::dhcp::DHCP6_CLASSES_ASSIGNED_AFTER_SUBNET_SELECTION, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_PACKET_DROP_DROP_CLASS2, isc::dhcp::AllocEngine::ClientContext6::early_global_reservations_lookup_, evaluateClasses(), isc::dhcp::AllocEngine::ClientContext6::fwd_dns_update_, isc::dhcp::getCalloutHandle(), isc::dhcp::AllocEngine::ClientContext6::globalHost(), isc::dhcp::AllocEngine::ClientContext6::hostname_, isc::dhcp::AllocEngine::ClientContext6::hosts_, isc::stats::StatsMgr::instance(), LOG_DEBUG, isc::dhcp::packet6_logger, isc::dhcp::AllocEngine::ClientContext6::query_, removeDependentEvaluatedClasses(), isc::dhcp::AllocEngine::ClientContext6::rev_dns_update_, setHostIdentifiers(), setReservedClientClasses(), and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ initContext0()

void isc::dhcp::Dhcpv6Srv::initContext0 ( const Pkt6Ptr & query,
AllocEngine::ClientContext6 & ctx )

Initialize client context (first part).

Parameters
queryThe query message.
ctxReference to client context.

Definition at line 474 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::duid_, getMAC(), isc::dhcp::AllocEngine::ClientContext6::hwaddr_, and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by earlyGHRLookup(), and processLocalizedQuery6AndSendResponse().

+ Here is the call graph for this function:

◆ inTestMode()

bool isc::dhcp::Dhcpv6Srv::inTestMode ( ) const
inline

Checks if the server is running in unit test mode.

Returns
true if the server is running in unit test mode, false otherwise.

Definition at line 105 of file dhcp6_srv.h.

References server_port_.

◆ jsonPathsToRedact()

std::list< std::list< std::string > > isc::dhcp::Dhcpv6Srv::jsonPathsToRedact ( ) const
finaloverridevirtual

Return a list of all paths that contain passwords or secrets for kea-dhcp6.

Returns
the list of lists of sequential JSON map keys needed to reach the passwords and secrets.

Reimplemented from isc::process::Daemon.

Definition at line 5120 of file dhcp6_srv.cc.

◆ processClientFqdn()

void isc::dhcp::Dhcpv6Srv::processClientFqdn ( const Pkt6Ptr & question,
const Pkt6Ptr & answer,
AllocEngine::ClientContext6 & ctx )
protected

Processes Client FQDN Option.

This function retrieves DHCPv6 Client FQDN Option (if any) from the packet sent by a client and takes necessary actions upon this option. Received option comprises flags field which controls what DNS updates server should do. Server may override client's preference based on the current configuration. Server indicates that it has overridden the preference by storing DHCPv6 Client FQDN option with the appropriate flags in the response to a client. This option is also used to communicate the client's domain-name which should be sent to the DNS in the update. Again, server may act upon the received domain-name, i.e. if the provided domain-name is partial it should generate the fully qualified domain-name.

This function takes into account the host reservation if one is matched to this client when forming the FQDN to be used with DNS as well as the lease name to be stored with the lease. In the following the term "reserved hostname" means a host reservation which includes a non-blank hostname.

  • If there is no Client FQDN and no reserved hostname then there will no be DNS updates and the lease hostname will be empty.
  • If there is no Client FQDN but there is reserved hostname then there will be no DNS updates and the lease hostname will be equal to reserved hostname.
  • If there is a Client FQDN and a reserved hostname, then both the FQDN and lease hostname will be equal to reserved hostname with the qualifying suffix appended.
  • If there is a Client FQDN but no reserved hostname then both the FQDN and lease hostname will be equal to the name provided in the client FQDN adjusted according the DhcpDdns configuration parameters (e.g. ddns-replace-client-name, ddns-qualifying-suffix...).

All the logic required to form appropriate answer to the client is held in this function.

Parameters
questionClient's message.
answerServer's response to a client. If server generated Client FQDN option for the client, this option is stored in this object.
ctxclient context (includes subnet, client-id, hw-addr etc.)

Definition at line 2259 of file dhcp6_srv.cc.

References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::dhcp::AllocEngine::ClientContext6::currentHost(), D6O_CLIENT_FQDN, isc::dhcp::DBG_DHCP6_DETAIL, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::ddns6_logger, isc::dhcp::DHCP6_DDNS_GENERATE_FQDN, isc::dhcp::DHCP6_DDNS_RECEIVE_FQDN, isc::dhcp::DHCP6_DDNS_RESPONSE_FQDN_DATA, isc::dhcp::DHCP6_HOOK_DDNS_UPDATE, isc::dhcp::Option6ClientFqdn::FLAG_N, isc::dhcp::Option6ClientFqdn::FLAG_S, isc::dhcp::Option6ClientFqdn::FULL, isc::dhcp::AllocEngine::ClientContext6::fwd_dns_update_, isc::dhcp::getCalloutHandle(), isc::dhcp::AllocEngine::ClientContext6::getDdnsParams(), Hooks, isc::hooks::hooks_logger, isc::dhcp::AllocEngine::ClientContext6::hostname_, isc::dhcp::CfgMgr::instance(), LOG_DEBUG, isc::dhcp::Option6ClientFqdn::PARTIAL, isc::dhcp::D2ClientConfig::RCM_ALWAYS, isc::dhcp::D2ClientConfig::RCM_WHEN_NOT_PRESENT, isc::dhcp::AllocEngine::ClientContext6::rev_dns_update_, and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by checkDynamicSubnetChange(), processRebind(), processRenew(), processRequest(), and processSolicit().

+ Here is the call graph for this function:

◆ processConfirm()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processConfirm ( AllocEngine::ClientContext6 & ctx)
protected

Processes incoming Confirm message and returns Reply.

This function processes Confirm message from the client according to section 18.3.3. of RFC 8415. It discards the Confirm message if the message sent by the client contains no addresses, i.e. it has no IA_NA options or all IA_NA options contain no IAAddr options.

If the Confirm message contains addresses this function will perform the following checks:

  • check if there is appropriate subnet configured for the client (e.g. subnet from which addresses are assigned for requests received on the particular interface).
  • check if all addresses sent in the Confirm message belong to the selected subnet.

If any of the checks above fails, the Reply message with the status code NotOnLink is returned. Otherwise, the Reply message with the status code Success is returned.

Parameters
ctxReference to client context
Returns
Reply message from the server or NULL pointer if Confirm message should be discarded by the server.

Definition at line 3950 of file dhcp6_srv.cc.

References appendDefaultOptions(), appendRequestedOptions(), appendRequestedVendorOptions(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), D6O_IA_NA, D6O_IAADDR, isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), isc::dhcp::Option6IAAddr::getAddress(), isc_throw, LOG_DEBUG, isc::dhcp::AllocEngine::ClientContext6::query_, STATUS_NotOnLink, STATUS_Success, and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processDecline()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processDecline ( AllocEngine::ClientContext6 & ctx)
protected

Process incoming Decline message.

This method processes Decline message. It conducts standard sanity checks, creates empty reply and copies the necessary options from the client's message. Finally, it calls declineLeases, where the actual address processing takes place.

Parameters
ctxReference to client context
Returns
Reply message to be sent to the client.

Definition at line 4076 of file dhcp6_srv.cc.

References appendDefaultOptions(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), isc::dhcp::DBG_DHCP6_BASIC, declineLeases(), isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), LOG_DEBUG, and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processDhcp4Query()

void isc::dhcp::Dhcpv6Srv::processDhcp4Query ( const Pkt6Ptr & dhcp4_query)
protected

Processes incoming DHCPv4-query message.

It always returns NULL, as there is nothing to be sent back to the client at this time. The message was sent to DHCPv4 server using isc::dhcp::Dhcp6to4Ipc::handler()). We will send back a response to the client once we get back DHCP4-REPLY from the DHCPv4 server.

Parameters
dhcp4_querymessage received from client Does not throw

Definition at line 4434 of file dhcp6_srv.cc.

References D6O_DHCPV4_MSG, and isc::dhcp::Dhcp6to4Ipc::instance().

Referenced by processDhcp6Query().

+ Here is the call graph for this function:

◆ processDhcp6Query()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processDhcp6Query ( Pkt6Ptr query)

Process a single incoming DHCPv6 query.

It localizes the query, calls per-type processXXX methods, generates appropriate answer.

Parameters
queryA pointer to the packet to be processed.
Returns
A pointer to the response.

Definition at line 1025 of file dhcp6_srv.cc.

References DHCPV6_DECLINE, DHCPV6_DHCPV4_QUERY, DHCPV6_REBIND, DHCPV6_RELEASE, DHCPV6_RENEW, DHCPV6_REQUEST, DHCPV6_SOLICIT, earlyGHRLookup(), isc::util::MultiThreadingMgr::instance(), isc::dhcp::makeContinuation(), processDhcp4Query(), processDhcp6QueryAndSendResponse(), processLocalizedQuery6(), selectSubnet(), and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processDhcp6QueryAndSendResponse(), and processPacket().

+ Here is the call graph for this function:

◆ processDhcp6QueryAndSendResponse()

void isc::dhcp::Dhcpv6Srv::processDhcp6QueryAndSendResponse ( Pkt6Ptr query)

Process a single incoming DHCPv6 query.

It localizes the query, calls per-type processXXX methods, generates appropriate answer, sends the answer to the client.

Parameters
queryA pointer to the packet to be processed.

Definition at line 1005 of file dhcp6_srv.cc.

References isc::dhcp::DHCP6_PACKET_PROCESS_EXCEPTION, isc::dhcp::DHCP6_PACKET_PROCESS_STD_EXCEPTION, isc::dhcp::getCalloutHandle(), LOG_ERROR, isc::dhcp::packet6_logger, processDhcp6Query(), and processPacketBufferSend().

Referenced by processDhcp6Query().

+ Here is the call graph for this function:

◆ processInfRequest()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processInfRequest ( AllocEngine::ClientContext6 & ctx)
protected

Processes incoming Information-request message.

Parameters
ctxReference to client context
Returns
Reply message to be sent to the client.

Definition at line 4397 of file dhcp6_srv.cc.

References appendDefaultOptions(), appendRequestedOptions(), appendRequestedVendorOptions(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), LOG_DEBUG, and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processLocalizedQuery6()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processLocalizedQuery6 ( AllocEngine::ClientContext6 & ctx)

Process a localized incoming DHCPv6 query.

It calls per-type processXXX methods, generates appropriate answer.

Parameters
ctxPointer to The client context.
Returns
A pointer to the response.

Definition at line 1109 of file dhcp6_srv.cc.

References isc::dhcp::bad_packet6_logger, isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), checkRelaySourcePort(), client_port_, isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DBG_DHCP6_HOOKS, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_HOOK_LEASES6_COMMITTED_DROP, isc::dhcp::DHCP6_HOOK_LEASES6_COMMITTED_PARK, isc::dhcp::DHCP6_HOOK_LEASES6_PARKING_LOT_FULL, isc::dhcp::DHCP6_PACKET_PROCESS_FAIL, DHCPV6_CONFIRM, DHCPV6_DECLINE, DHCPV6_INFORMATION_REQUEST, DHCPV6_REBIND, DHCPV6_RELEASE, DHCPV6_RENEW, DHCPV6_REQUEST, DHCPV6_SOLICIT, isc::hooks::HooksManager::drop(), isc::dhcp::AllocEngine::ClientContext6::fake_allocation_, isc::dhcp::getCalloutHandle(), isc::hooks::ServerHooks::getServerHooks(), Hooks, isc::hooks::hooks_logger, isc::dhcp::AllocEngine::ClientContext6::ias_, initContext(), isc::dhcp::CfgMgr::instance(), isc::stats::StatsMgr::instance(), isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, isc::dhcp::AllocEngine::ClientContext6::new_leases_, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_PARK, isc::dhcp::packet6_logger, isc::hooks::HooksManager::park(), isc::dhcp::CfgGlobals::PARKED_PACKET_LIMIT, processConfirm(), processDecline(), processInfRequest(), processPacketBufferSend(), processPacketPktSend(), processRebind(), processRelease(), processRenew(), processRequest(), processRSOO(), processSolicit(), isc::dhcp::AllocEngine::ClientContext6::query_, sendResponseNoThrow(), server_port_, isc::dhcp::AllocEngine::ClientContext6::subnet_, and isc::dhcp::Lease::TYPE_PD.

Referenced by processDhcp6Query(), and processLocalizedQuery6AndSendResponse().

+ Here is the call graph for this function:

◆ processLocalizedQuery6AndSendResponse() [1/2]

void isc::dhcp::Dhcpv6Srv::processLocalizedQuery6AndSendResponse ( Pkt6Ptr query)

Process a localized incoming DHCPv6 query.

A variant of the precedent method used to resume processing for packets parked in the subnet6_select callout.

Parameters
queryA pointer to the unparked packet.

Definition at line 1092 of file dhcp6_srv.cc.

References isc::dhcp::getCalloutHandle(), initContext0(), processLocalizedQuery6AndSendResponse(), and isc::dhcp::AllocEngine::ClientContext6::subnet_.

+ Here is the call graph for this function:

◆ processLocalizedQuery6AndSendResponse() [2/2]

void isc::dhcp::Dhcpv6Srv::processLocalizedQuery6AndSendResponse ( Pkt6Ptr query,
AllocEngine::ClientContext6 & ctx )

Process a localized incoming DHCPv6 query.

It calls per-type processXXX methods, generates appropriate answer, sends the answer to the client.

Parameters
queryA pointer to the packet to be processed.
ctxPointer to The client context.

Definition at line 1071 of file dhcp6_srv.cc.

References isc::dhcp::DHCP6_PACKET_PROCESS_EXCEPTION, isc::dhcp::DHCP6_PACKET_PROCESS_STD_EXCEPTION, isc::dhcp::getCalloutHandle(), LOG_ERROR, isc::dhcp::packet6_logger, processLocalizedQuery6(), and processPacketBufferSend().

Referenced by processLocalizedQuery6AndSendResponse(), and selectSubnet().

+ Here is the call graph for this function:

◆ processPacket()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processPacket ( Pkt6Ptr query)

◆ processPacketAndSendResponse()

void isc::dhcp::Dhcpv6Srv::processPacketAndSendResponse ( Pkt6Ptr query)

Process a single incoming DHCPv6 packet and sends the response.

It verifies correctness of the passed packet, calls per-type processXXX methods, generates appropriate answer, sends the answer to the client.

Parameters
queryA pointer to the packet to be processed.

Definition at line 793 of file dhcp6_srv.cc.

References isc::dhcp::getCalloutHandle(), processPacket(), and processPacketBufferSend().

Referenced by processPacketAndSendResponseNoThrow(), and runOne().

+ Here is the call graph for this function:

◆ processPacketAndSendResponseNoThrow()

void isc::dhcp::Dhcpv6Srv::processPacketAndSendResponseNoThrow ( Pkt6Ptr query)

Process a single incoming DHCPv6 packet and sends the response.

It verifies correctness of the passed packet, calls per-type processXXX methods, generates appropriate answer, sends the answer to the client.

Parameters
queryA pointer to the packet to be processed.

Definition at line 779 of file dhcp6_srv.cc.

References isc::dhcp::DHCP6_PACKET_PROCESS_EXCEPTION, isc::dhcp::DHCP6_PACKET_PROCESS_STD_EXCEPTION, LOG_ERROR, isc::dhcp::packet6_logger, and processPacketAndSendResponse().

Referenced by runOne().

+ Here is the call graph for this function:

◆ processPacketBufferSend()

void isc::dhcp::Dhcpv6Srv::processPacketBufferSend ( hooks::CalloutHandlePtr & callout_handle,
Pkt6Ptr & rsp )

◆ processPacketPktSend()

void isc::dhcp::Dhcpv6Srv::processPacketPktSend ( hooks::CalloutHandlePtr & callout_handle,
Pkt6Ptr & query,
Pkt6Ptr & rsp,
ConstSubnet6Ptr & subnet )
protected

Executes pkt6_send callout.

Parameters
callout_handlepointer to the callout handle.
queryPointer to a query.
rspPointer to a response.
subnetA pointer to the selected subnet.

Callouts decided to drop the packet.

Definition at line 1388 of file dhcp6_srv.cc.

References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::dhcp::DBG_DHCP6_HOOKS, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_HOOK_PACKET_SEND_DROP, isc::dhcp::DHCP6_HOOK_PACKET_SEND_SKIP, isc::dhcp::DHCP6_PACK_FAIL, Hooks, isc::hooks::hooks_logger, LOG_DEBUG, LOG_ERROR, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::options6_logger, and isc::dhcp::LibDHCP::splitNtpServerOptions6().

Referenced by processLocalizedQuery6(), and sendResponseNoThrow().

+ Here is the call graph for this function:

◆ processRebind()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processRebind ( AllocEngine::ClientContext6 & ctx)
protected

Processes incoming Rebind message.

Todo
There are cases when the Rebind message should be discarded by the DHCP server. One of those is when the server doesn't have a record of the client and it is unable to determine whether the client is on the appropriate link or not. We don't seem to do it now.
Parameters
ctxReference to client context
Returns
Reply message to be sent to the client.

Definition at line 3910 of file dhcp6_srv.cc.

References alloc_engine_, appendDefaultOptions(), appendRequestedOptions(), appendRequestedVendorOptions(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), createNameChangeRequests(), isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), extendLeases(), isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, processClientFqdn(), and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processRelease()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processRelease ( AllocEngine::ClientContext6 & ctx)
protected

Process incoming Release message.

Parameters
ctxReference to client context
Returns
Reply message to be sent to the client.
Todo
If client sent a release and we should remove outstanding DNS records.

Definition at line 4044 of file dhcp6_srv.cc.

References appendDefaultOptions(), conditionallySetReservedClientClasses(), copyClientOptions(), isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), LOG_DEBUG, isc::dhcp::AllocEngine::ClientContext6::query_, and releaseLeases().

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processRenew()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processRenew ( AllocEngine::ClientContext6 & ctx)
protected

Processes incoming Renew message.

Parameters
ctxReference to client context
Returns
Reply message to be sent to the client.

Definition at line 3870 of file dhcp6_srv.cc.

References alloc_engine_, appendDefaultOptions(), appendRequestedOptions(), appendRequestedVendorOptions(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), createNameChangeRequests(), isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), extendLeases(), isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, processClientFqdn(), and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processRequest()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processRequest ( AllocEngine::ClientContext6 & ctx)
protected

Processes incoming Request and returns Reply response.

Processes incoming Request message and verifies that its sender should be served. In particular IA, TA and PD options are populated with assigned addresses, temporary addresses and delegated prefixes, respectively. Uses LeaseMgr to allocate or update existing leases.

Parameters
ctxReference to client context
Returns
REPLY message or NULL

Definition at line 3830 of file dhcp6_srv.cc.

References alloc_engine_, appendDefaultOptions(), appendRequestedOptions(), appendRequestedVendorOptions(), assignLeases(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), createNameChangeRequests(), isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, DHCPV6_REPLY, evaluateAdditionalClasses(), isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, processClientFqdn(), and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processRSOO()

void isc::dhcp::Dhcpv6Srv::processRSOO ( const Pkt6Ptr & query,
const Pkt6Ptr & rsp )
protected

Processes Relay-supplied options, if present.

This method implements RFC6422. It checks if there are any RSOO options inserted by the relay agents in the query message. If there are, they are copied over to the response if they meet the following criteria:

  • the option is marked as RSOO-enabled (see relay-supplied-options configuration parameter)
  • there is no such option provided by the server)

Definition at line 4823 of file dhcp6_srv.cc.

References D6O_RSOO, and isc::dhcp::CfgMgr::instance().

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processSolicit()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::processSolicit ( AllocEngine::ClientContext6 & ctx)
protected

Processes incoming Solicit and returns response.

Processes received Solicit message and verifies that its sender should be served. In particular IA, TA and PD options are populated with to-be assigned addresses, temporary addresses and delegated prefixes, respectively. In the usual 4 message exchange, server is expected to respond with Advertise message. However, if client requests rapid-commit and server supports it, Reply will be sent instead of Advertise and requested leases will be assigned immediately.

Parameters
ctxReference to client context
Returns
Advertise, Reply message or NULL.

Definition at line 3758 of file dhcp6_srv.cc.

References alloc_engine_, appendDefaultOptions(), appendRequestedOptions(), appendRequestedVendorOptions(), assignLeases(), buildCfgOptionList(), conditionallySetReservedClientClasses(), copyClientOptions(), createNameChangeRequests(), D6O_RAPID_COMMIT, isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DHCP6_CLASSES_ASSIGNED, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_RAPID_COMMIT, DHCPV6_ADVERTISE, DHCPV6_REPLY, evaluateAdditionalClasses(), isc::dhcp::AllocEngine::ClientContext6::fake_allocation_, isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, isc::dhcp::options6_logger, processClientFqdn(), isc::dhcp::AllocEngine::ClientContext6::query_, and isc::dhcp::AllocEngine::ClientContext6::subnet_.

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ processStatsSent()

void isc::dhcp::Dhcpv6Srv::processStatsSent ( const Pkt6Ptr & response)
static

Updates statistics for transmitted packets.

Note
used by DHCPv4-over-DHCPv6 so must be public and static
Parameters
responsepacket transmitted

Definition at line 4927 of file dhcp6_srv.cc.

References DHCPV6_ADVERTISE, DHCPV6_DHCPV4_RESPONSE, DHCPV6_REPLY, and isc::stats::StatsMgr::instance().

Referenced by isc::dhcp::Dhcp6to4Ipc::handler(), and processPacketBufferSend().

+ Here is the call graph for this function:

◆ receivePacket()

Pkt6Ptr isc::dhcp::Dhcpv6Srv::receivePacket ( int timeout)
protectedvirtual

dummy wrapper around IfaceMgr::receive6

This method is useful for testing purposes, where its replacement simulates reception of a packet. For that purpose it is protected.

Definition at line 360 of file dhcp6_srv.cc.

References isc::dhcp::IfaceMgr::instance().

Referenced by runOne().

+ Here is the call graph for this function:

◆ releaseIA_NA()

OptionPtr isc::dhcp::Dhcpv6Srv::releaseIA_NA ( const DuidPtr & duid,
const Pkt6Ptr & query,
int & general_status,
boost::shared_ptr< Option6IA > ia,
Lease6Ptr & old_lease )
protected

Releases specific IA_NA option.

Generates response to IA_NA in Release message. This covers finding and removal of a lease that corresponds to the received address. If no such lease is found, an IA_NA response is generated with an appropriate status code.

The server sends top-level Status Code option. This method may update the passed value of that option, i.e. general_status. It is set to SUCCESS when message processing begins, but may be updated to some error code if the release process fails.

Parameters
duidclient's duid
queryclient's message
general_statusa global status (it may be updated in case of errors)
iaIA_NA option that is being released
old_leasea pointer to the lease being released
Returns
IA_NA option (server's response)

Definition at line 3332 of file dhcp6_srv.cc.

References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::dhcp_ddns::CHG_REMOVE, D6O_IA_NA, D6O_IAADDR, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DBG_DHCP6_HOOKS, isc::dhcp::DHCP6_HOOK_LEASE6_RELEASE_NA_SKIP, isc::dhcp::DHCP6_LEASE_NA_WITHOUT_DUID, isc::dhcp::DHCP6_PROCESS_IA_NA_RELEASE, isc::dhcp::DHCP6_RELEASE_NA, isc::dhcp::DHCP6_RELEASE_NA_DELETED, isc::dhcp::DHCP6_RELEASE_NA_EXPIRED, isc::dhcp::DHCP6_RELEASE_NA_FAIL, isc::dhcp::DHCP6_RELEASE_NA_FAIL_WRONG_DUID, isc::dhcp::DHCP6_RELEASE_NA_FAIL_WRONG_IAID, isc::stats::StatsMgr::generateName(), isc::dhcp::getCalloutHandle(), Hooks, isc::hooks::hooks_logger, isc::dhcp::Lease::INFINITY_LFT, isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc::stats::StatsMgr::instance(), isc::dhcp::lease6_logger, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARN, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::queueNCR(), isc::dhcp::Lease::STATE_RELEASED, STATUS_NoBinding, STATUS_Success, STATUS_UnspecFail, and isc::dhcp::Lease::TYPE_NA.

Referenced by releaseLeases().

+ Here is the call graph for this function:

◆ releaseIA_PD()

OptionPtr isc::dhcp::Dhcpv6Srv::releaseIA_PD ( const DuidPtr & duid,
const Pkt6Ptr & query,
int & general_status,
boost::shared_ptr< Option6IA > ia,
Lease6Ptr & old_lease )
protected

Releases specific IA_PD option.

Generates response to IA_PD in Release message. This covers finding and removal of a lease that corresponds to the received prefix(es). If no such lease is found, an IA_PD response is generated with an appropriate status code.

Parameters
duidclient's duid
queryclient's message
general_statusa global status (it may be updated in case of errors)
iaIA_PD option that is being released
old_leasea pointer to the lease being released
Returns
IA_PD option (server's response)

Definition at line 3549 of file dhcp6_srv.cc.

References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), D6O_IA_PD, D6O_IAPREFIX, isc::dhcp::DBG_DHCP6_HOOKS, isc::dhcp::DHCP6_HOOK_LEASE6_RELEASE_PD_SKIP, isc::dhcp::DHCP6_LEASE_PD_WITHOUT_DUID, isc::dhcp::DHCP6_RELEASE_PD, isc::dhcp::DHCP6_RELEASE_PD_DELETED, isc::dhcp::DHCP6_RELEASE_PD_EXPIRED, isc::dhcp::DHCP6_RELEASE_PD_FAIL, isc::dhcp::DHCP6_RELEASE_PD_FAIL_WRONG_DUID, isc::dhcp::DHCP6_RELEASE_PD_FAIL_WRONG_IAID, isc::stats::StatsMgr::generateName(), isc::dhcp::getCalloutHandle(), Hooks, isc::hooks::hooks_logger, isc::dhcp::Lease::INFINITY_LFT, isc::dhcp::CfgMgr::instance(), isc::dhcp::LeaseMgrFactory::instance(), isc::stats::StatsMgr::instance(), isc::dhcp::lease6_logger, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARN, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::Lease::STATE_RELEASED, STATUS_NoBinding, STATUS_Success, STATUS_UnspecFail, and isc::dhcp::Lease::TYPE_PD.

Referenced by releaseLeases().

+ Here is the call graph for this function:

◆ releaseLeases()

void isc::dhcp::Dhcpv6Srv::releaseLeases ( const Pkt6Ptr & release,
Pkt6Ptr & reply,
AllocEngine::ClientContext6 & ctx )
protected

Attempts to release received addresses.

It iterates through received IA_NA options and attempts to release received addresses. If no such leases are found, or the lease fails proper checks (e.g. belongs to someone else), a proper status code is added to reply message. Released addresses are not added to REPLY packet, just its IA_NA containers.

Parameters
releaseclient's message asking to release
replyserver's response
ctxclient context (includes subnet, client-id, hw-addr etc.)
Todo
Add support for IA_TA
Todo
Todo
Consider supporting more than one address in a single IA. It is allowed by RFC 8415, but it is not widely implemented. The only software that supports that is Dibbler, but its author seriously doubts if anyone is really using it. Clients that want more than one address or prefix just include more instances of IA options.

Definition at line 3274 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::currentIA(), D6O_IA_NA, D6O_IA_PD, isc::dhcp::AllocEngine::ClientContext6::duid_, isc::dhcp::AllocEngine::ClientContext6::IAContext::old_leases_, releaseIA_NA(), releaseIA_PD(), and STATUS_Success.

Referenced by processRelease().

+ Here is the call graph for this function:

◆ removeDependentEvaluatedClasses()

void isc::dhcp::Dhcpv6Srv::removeDependentEvaluatedClasses ( const Pkt6Ptr & pkt)
staticprotected

Removed evaluated client classes.

Todo
: keep the list of dependent evaluated classes so remove only them.
Parameters
pktthe packet.

Definition at line 4512 of file dhcp6_srv.cc.

References isc::dhcp::CfgMgr::instance().

Referenced by earlyGHRLookup(), and initContext().

+ Here is the call graph for this function:

◆ run()

int isc::dhcp::Dhcpv6Srv::run ( )

Main server processing loop.

Main server processing loop. Call the processing step routine until shut down.

Returns
The value returned by Daemon::getExitValue().

Definition at line 643 of file dhcp6_srv.cc.

References isc::dhcp::DHCP6_PACKET_PROCESS_EXCEPTION_MAIN, isc::dhcp::DHCP6_PACKET_PROCESS_STD_EXCEPTION_MAIN, isc::process::Daemon::getExitValue(), getIOService(), isc::asiolink::IOServiceMgr::instance(), isc::config::HttpCommandMgr::instance(), isc::util::MultiThreadingMgr::instance(), isc_throw, LOG_ERROR, isc::dhcp::packet6_logger, runOne(), server_port_, and shutdown_.

+ Here is the call graph for this function:

◆ runOne()

void isc::dhcp::Dhcpv6Srv::runOne ( )

Main server processing step.

Main server processing step. Receives one incoming packet, calls the processing packet routing and (if necessary) transmits a response.

Definition at line 701 of file dhcp6_srv.cc.

References isc::dhcp::bad_packet6_logger, isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DBG_DHCP6_DETAIL, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_BUFFER_RECEIVED, isc::dhcp::DHCP6_BUFFER_WAIT_SIGNAL, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_PACKET_DROP_DHCP_DISABLED, isc::dhcp::DHCP6_PACKET_QUEUE_FULL, isc::dhcp::DHCP6_PACKET_RECEIVE_FAIL, isc::stats::StatsMgr::instance(), isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, LOG_ERROR, network_state_, isc::dhcp::packet6_logger, processPacketAndSendResponse(), processPacketAndSendResponseNoThrow(), and receivePacket().

Referenced by run().

+ Here is the call graph for this function:

◆ sanityCheck() [1/2]

bool isc::dhcp::Dhcpv6Srv::sanityCheck ( const Pkt6Ptr & pkt)
protected

Verifies if specified packet meets RFC requirements.

Checks if mandatory option is really there, that forbidden option is not there, and that client-id or server-id appears only once.

Parameters
pktpacket to be checked
Returns
false if the message should be dropped as a result of the sanity check.

Definition at line 1970 of file dhcp6_srv.cc.

References isc::dhcp::bad_packet6_logger, isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::DHCP6_REQUIRED_OPTIONS_CHECK_FAIL, isc::dhcp::DHCP6_UNKNOWN_MSG_RECEIVED, DHCPV6_CONFIRM, DHCPV6_DECLINE, DHCPV6_DHCPV4_QUERY, DHCPV6_INFORMATION_REQUEST, DHCPV6_REBIND, DHCPV6_RELEASE, DHCPV6_RENEW, DHCPV6_REQUEST, DHCPV6_SOLICIT, FORBIDDEN, isc::stats::StatsMgr::instance(), LOG_DEBUG, MANDATORY, OPTIONAL, and sanityCheck().

Referenced by processPacket(), and sanityCheck().

+ Here is the call graph for this function:

◆ sanityCheck() [2/2]

void isc::dhcp::Dhcpv6Srv::sanityCheck ( const Pkt6Ptr & pkt,
RequirementLevel clientid,
RequirementLevel serverid )
protected

verifies if specified packet meets RFC requirements

Checks if mandatory option is really there, that forbidden option is not there, and that client-id or server-id appears only once.

Parameters
pktpacket to be checked
clientidexpectation regarding client-id option
serveridexpectation regarding server-id option
Exceptions
RFCViolationif any issues are detected

Definition at line 2013 of file dhcp6_srv.cc.

References D6O_CLIENTID, D6O_SERVERID, FORBIDDEN, isc_throw, MANDATORY, OPTIONAL, and sanityCheckDUID().

+ Here is the call graph for this function:

◆ sanityCheckDUID()

void isc::dhcp::Dhcpv6Srv::sanityCheckDUID ( const OptionPtr & opt,
const std::string & opt_name )
protected

verifies if received DUID option (client-id or server-id) is sane

Parameters
optoption to be checked
opt_nametext name to be printed
Exceptions
RFCViolationif any issues are detected

Definition at line 2070 of file dhcp6_srv.cc.

References isc_throw, isc::dhcp::DUID::MAX_DUID_LEN, and isc::dhcp::DUID::MIN_DUID_LEN.

Referenced by sanityCheck().

◆ selectSubnet()

ConstSubnet6Ptr isc::dhcp::Dhcpv6Srv::selectSubnet ( const Pkt6Ptr & question,
bool & drop )
protected

◆ sendPacket()

void isc::dhcp::Dhcpv6Srv::sendPacket ( const Pkt6Ptr & pkt)
protectedvirtual

dummy wrapper around IfaceMgr::send()

This method is useful for testing purposes, where its replacement simulates transmission of a packet. For that purpose it is protected.

Definition at line 364 of file dhcp6_srv.cc.

References isc::dhcp::IfaceMgr::instance().

Referenced by processPacketBufferSend().

+ Here is the call graph for this function:

◆ sendResponseNoThrow()

void isc::dhcp::Dhcpv6Srv::sendResponseNoThrow ( hooks::CalloutHandlePtr & callout_handle,
Pkt6Ptr query,
Pkt6Ptr & rsp,
ConstSubnet6Ptr & subnet )

Process an unparked DHCPv6 packet and sends the response.

Parameters
callout_handlepointer to the callout handle.
queryA pointer to the packet to be processed.
rspA pointer to the response.
subnetA pointer to the selected subnet.

Definition at line 1371 of file dhcp6_srv.cc.

References isc::dhcp::DHCP6_PACKET_PROCESS_EXCEPTION, isc::dhcp::DHCP6_PACKET_PROCESS_STD_EXCEPTION, LOG_ERROR, isc::dhcp::packet6_logger, processPacketBufferSend(), and processPacketPktSend().

Referenced by processLocalizedQuery6().

+ Here is the call graph for this function:

◆ setHostIdentifiers()

void isc::dhcp::Dhcpv6Srv::setHostIdentifiers ( AllocEngine::ClientContext6 & ctx)
static

Set host identifiers within a context.

This method sets an ordered list of host identifier types and values which the server should use to find host reservations. The order of the set is determined by the configuration parameter, host-reservation-identifiers

Parameters
ctxreference to the context.

Definition at line 412 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::addHostIdentifier(), isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::log::DBGLVL_TRACE_BASIC, isc::dhcp::DHCP6_FLEX_ID, isc::dhcp::AllocEngine::ClientContext6::duid_, isc::dhcp::getCalloutHandle(), isc::dhcp::Host::getIdentifierAsText(), Hooks, isc::dhcp::AllocEngine::ClientContext6::hwaddr_, isc::dhcp::Host::IDENT_DUID, isc::dhcp::Host::IDENT_FLEX, isc::dhcp::Host::IDENT_HWADDR, isc::dhcp::CfgMgr::instance(), LOG_DEBUG, isc::hooks::CalloutHandle::NEXT_STEP_CONTINUE, isc::dhcp::packet6_logger, and isc::dhcp::AllocEngine::ClientContext6::query_.

Referenced by earlyGHRLookup(), and initContext().

+ Here is the call graph for this function:

◆ setPacketStatisticsDefaults()

void isc::dhcp::Dhcpv6Srv::setPacketStatisticsDefaults ( )
protected

This function sets statistics related to DHCPv6 packets processing to their initial values.

All of the statistics observed by the DHCPv6 server and with the names like "pkt6-" are reset to 0. This function must be invoked in the class constructor.

Definition at line 301 of file dhcp6_srv.cc.

References isc::stats::StatsMgr::instance().

Referenced by Dhcpv6Srv().

+ Here is the call graph for this function:

◆ setReservedClientClasses()

void isc::dhcp::Dhcpv6Srv::setReservedClientClasses ( const Pkt6Ptr & pkt,
const AllocEngine::ClientContext6 & ctx )
protected

Assigns classes retrieved from host reservation database.

Parameters
pktPointer to the packet to which classes will be assigned.
ctxReference to the client context.

Definition at line 4527 of file dhcp6_srv.cc.

References isc::dhcp::AllocEngine::ClientContext6::currentHost().

Referenced by conditionallySetReservedClientClasses(), and initContext().

+ Here is the call graph for this function:

◆ setStatusCode()

void isc::dhcp::Dhcpv6Srv::setStatusCode ( boost::shared_ptr< Option6IA > & container,
const OptionPtr & status )
protected

A simple utility method that sets the status code.

Removes old status code and sets a new one.

Parameters
containerstatus code will be added here
statusstatus code option

Definition at line 4278 of file dhcp6_srv.cc.

References D6O_STATUS_CODE.

Referenced by declineIA().

◆ setTeeTimes()

void isc::dhcp::Dhcpv6Srv::setTeeTimes ( uint32_t preferred_lft,
const ConstSubnet6Ptr & subnet,
Option6IAPtr & resp )
protected

Sets the T1 and T2 timers in the outbound IA.

This method determines the values for both the T1 and T2 timers for the given IA. It is influenced by the lease's subnet's values for renew-timer, rebind-timer, calculate-tee-times, t1-percent, and t2-percent as follows:

T2:

The value for T2 defaults to zero. If the rebind-timer value is specified then use it. If not and calculate-tee-times is true, then use the value given by: preferred lease time * t2-percent.

T1:

The candidate value for T1 defaults to zero. If the renew-timer value is specified then use it. If not and calculate-tee-times is true, then use the value given by: preferred lease time * t1-percent.

The T1 candidate will be used provided it less than to T2, otherwise it will be set T1 to zero.

Parameters
preferred_lftpreferred lease time of the lease being assigned to the client
subnetthe subnet to which the lease belongs
respoutbound IA option in which the timers are set.
Todo
This logic to be modified if we decide to support infinite lease times.

Definition at line 5032 of file dhcp6_srv.cc.

Referenced by assignIA_NA(), assignIA_PD(), extendIA_NA(), and extendIA_PD().

◆ shutdown()

void isc::dhcp::Dhcpv6Srv::shutdown ( )
overridevirtual

Instructs the server to shut down.

Reimplemented from isc::process::Daemon.

Definition at line 355 of file dhcp6_srv.cc.

References isc::dhcp::DBG_DHCP6_BASIC, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_SHUTDOWN_REQUEST, LOG_DEBUG, and shutdown_.

Referenced by isc::dhcp::ControlledDhcpv6Srv::shutdownServer().

◆ startD2()

void isc::dhcp::Dhcpv6Srv::startD2 ( )

Starts DHCP_DDNS client IO if DDNS updates are enabled.

If updates are enabled, it instructs the D2ClientMgr singleton to enter send mode. If D2ClientMgr encounters errors it may throw D2ClientError. This method does not catch exceptions.

Definition at line 4759 of file dhcp6_srv.cc.

References d2ClientErrorHandler(), and isc::dhcp::CfgMgr::instance().

+ Here is the call graph for this function:

◆ stopD2()

void isc::dhcp::Dhcpv6Srv::stopD2 ( )

Stops DHCP_DDNS client IO if DDNS updates are enabled.

If updates are enabled, it instructs the D2ClientMgr singleton to leave send mode. If D2ClientMgr encounters errors it may throw D2ClientError. This method does not catch exceptions.

Definition at line 4771 of file dhcp6_srv.cc.

References isc::dhcp::CfgMgr::instance().

Referenced by ~Dhcpv6Srv().

+ Here is the call graph for this function:

◆ testServerID()

bool isc::dhcp::Dhcpv6Srv::testServerID ( const Pkt6Ptr & pkt)
protected

Compare received server id with our server id.

Checks if the server id carried in a query from a client matches server identifier being used by the server.

Parameters
pktDHCPv6 packet carrying server identifier to be checked.
Returns
true if server id carried in the query matches server id used by the server; false otherwise.
Todo
Currently we always check server identifier regardless if it is allowed in the received message or not (per RFC 8415). If the server identifier is not allowed in the message, the sanityCheck function should deal with it.

Definition at line 369 of file dhcp6_srv.cc.

References isc::dhcp::bad_packet6_logger, D6O_SERVERID, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_PACKET_DROP_SERVERID_MISMATCH, duidToString(), getServerID(), and LOG_DEBUG.

Referenced by processPacket().

+ Here is the call graph for this function:

◆ testUnicast()

bool isc::dhcp::Dhcpv6Srv::testUnicast ( const Pkt6Ptr & pkt) const
protected

Check if the message can be sent to unicast.

This function checks if the received message conforms to the section 16 of RFC 8415 which says that: "A server MUST discard any Solicit, Confirm, Rebind or Information-request messages it receives with a Layer 3 unicast destination address.

Parameters
pktDHCPv6 message to be checked.
Returns
false if the message has been sent to unicast address but it is not allowed according to RFC3315, section 15; true otherwise.

Definition at line 391 of file dhcp6_srv.cc.

References isc::dhcp::bad_packet6_logger, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_PACKET_DROP_UNICAST, DHCPV6_CONFIRM, DHCPV6_INFORMATION_REQUEST, DHCPV6_REBIND, DHCPV6_SOLICIT, and LOG_DEBUG.

Referenced by processPacket().

Member Data Documentation

◆ alloc_engine_

boost::shared_ptr<AllocEngine> isc::dhcp::Dhcpv6Srv::alloc_engine_
protected

Allocation Engine.

Pointer to the allocation engine that we are currently using It must be a pointer, because we will support changing engines during normal operation (e.g. to use different allocators)

Definition at line 1238 of file dhcp6_srv.h.

Referenced by Dhcpv6Srv(), assignIA_NA(), assignIA_PD(), earlyGHRLookup(), extendIA_NA(), extendIA_PD(), initContext(), processRebind(), processRenew(), processRequest(), and processSolicit().

◆ cb_control_

CBControlDHCPv6Ptr isc::dhcp::Dhcpv6Srv::cb_control_
protected

Controls access to the configuration backends.

Definition at line 1249 of file dhcp6_srv.h.

Referenced by getCBControl().

◆ client_port_

uint16_t isc::dhcp::Dhcpv6Srv::client_port_
protected

UDP port number to which server sends all responses.

Definition at line 1187 of file dhcp6_srv.h.

Referenced by processLocalizedQuery6().

◆ MIN_MAC_LEN

const size_t isc::dhcp::Dhcpv6Srv::MIN_MAC_LEN = 6
static

Minimum length of a MAC address to be used in DUID generation.

Definition at line 81 of file dhcp6_srv.h.

◆ name_change_reqs_

std::queue<isc::dhcp_ddns::NameChangeRequest> isc::dhcp::Dhcpv6Srv::name_change_reqs_
protected

Holds a list of isc::dhcp_ddns::NameChangeRequest objects, which are waiting for sending to kea-dhcp-ddns module.

Definition at line 1242 of file dhcp6_srv.h.

◆ network_state_

NetworkStatePtr isc::dhcp::Dhcpv6Srv::network_state_
protected

Holds information about disabled DHCP service and/or disabled subnet/network scopes.

Definition at line 1246 of file dhcp6_srv.h.

Referenced by getNetworkState(), and runOne().

◆ server_port_

uint16_t isc::dhcp::Dhcpv6Srv::server_port_
protected

UDP port number on which server listens.

Definition at line 1184 of file dhcp6_srv.h.

Referenced by getServerPort(), inTestMode(), processLocalizedQuery6(), and run().

◆ serverid_

OptionPtr isc::dhcp::Dhcpv6Srv::serverid_
protected

Server DUID (to be sent in server-identifier option)

Definition at line 1218 of file dhcp6_srv.h.

Referenced by Dhcpv6Srv(), and getServerID().

◆ shutdown_

volatile bool isc::dhcp::Dhcpv6Srv::shutdown_
protected

Indicates if shutdown is in progress.

Setting it to true will initiate server shutdown procedure.

Definition at line 1222 of file dhcp6_srv.h.

Referenced by Dhcpv6Srv(), run(), and shutdown().

◆ VENDOR_CLASS_PREFIX

const std::string isc::dhcp::Dhcpv6Srv::VENDOR_CLASS_PREFIX
staticprotected

this is a prefix added to the content of vendor-class option

If incoming packet has a vendor class option, its content is prepended with this prefix and then interpreted as a class. For example, a packet that sends vendor class with value of "FOO" will cause the packet to be assigned to class VENDOR_CLASS_FOO.

Definition at line 972 of file dhcp6_srv.h.


The documentation for this class was generated from the following files: