Kea 2.7.5
|
DHCPv6 server service. More...
#include <dhcp6_srv.h>
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::IOServicePtr & | getIOService () |
Returns pointer to the IO service used by the server. | |
NetworkStatePtr & | getNetworkState () |
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< AllocEngine > | alloc_engine_ |
Allocation Engine. | |
std::queue< isc::dhcp_ddns::NameChangeRequest > | name_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. | |
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.
defines if certain option may, must or must not appear
Enumerator | |
---|---|
FORBIDDEN | |
MANDATORY | |
OPTIONAL |
Definition at line 74 of file dhcp6_srv.h.
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.
server_port | specifies port number to listen on |
client_port | specifies port number to send to |
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.
|
virtual |
Destructor. Used during DHCPv6 service shutdown.
Definition at line 311 of file dhcp6_srv.cc.
References isc::dhcp::HostMgr::create(), isc::dhcp::LeaseMgrFactory::destroy(), isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_SRV_D2STOP_ERROR, isc::dhcp::DHCP6_SRV_UNLOAD_LIBRARIES_ERROR, discardPackets(), isc::hooks::HooksManager::getLibraryNames(), isc::dhcp::Dhcp6to4Ipc::instance(), isc::asiolink::IOServiceMgr::instance(), isc::dhcp::IfaceMgr::instance(), LOG_ERROR, isc::hooks::HooksManager::prepareUnloadLibraries(), stopD2(), and isc::hooks::HooksManager::unloadLibraries().
|
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.
question | client's message |
answer | server's message (options will be added here) |
co_list | configured 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().
|
protected |
Appends requested options to server's answer.
Appends options requested by client to the server's answer.
question | client's message |
answer | server's message (options will be added here) |
co_list | configured 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().
|
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.
question | client's message |
answer | server's message (vendor options will be added here) |
ctx | client context (contains subnet, duid and other parameters) |
co_list | configured 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().
|
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.
query | client's message (typically SOLICIT or REQUEST) to the client (if the client sent this option to the server). |
ctx | client context (contains subnet, duid and other parameters) |
ia | pointer to client's IA_NA option (client's request) |
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().
|
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.
query | client's message (typically SOLICIT or REQUEST) |
ctx | client context (contains subnet, duid and other parameters) |
ia | pointer to client's IA_PD option (client's request) |
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().
|
protected |
Assigns leases.
It supports non-temporary addresses (IA_NA) and prefixes (IA_PD). It does NOT support temporary addresses (IA_TA).
question | client's message (with requested IA options) |
answer | server'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). |
ctx | client 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().
|
protected |
Build the configured option list.
CfgOption
objects used to append options to the response.question | client's message |
ctx | client context (for the subnet) |
co_list | configured 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().
|
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.
question | Client's message. |
answer | Server's response to a client. If server generated |
ctx | client context (contains subnet, duid and other parameters) |
orig_subnet | the originally selected subnet |
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().
|
static |
Used for DHCPv4-over-DHCPv6 too.
Check if the last relay added a relay-source-port option.
query | DHCPv6 message to be checked. |
Definition at line 4856 of file dhcp6_srv.cc.
References D6O_RELAY_SOURCE_PORT.
Referenced by isc::dhcp::Dhcp6to4Ipc::handler(), and processLocalizedQuery6().
|
protected |
Assigns incoming packet to zero or more classes.
pkt | packet to be classified |
Definition at line 4476 of file dhcp6_srv.cc.
References evaluateClasses().
Referenced by processPacket().
|
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.
pkt | Pointer to the packet to which classes will be assigned. |
ctx | Reference 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().
|
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.
question | client's message (options will be copied from here) |
answer | server's message (options will be copied here) |
Definition at line 1552 of file dhcp6_srv.cc.
References D6O_CLIENTID.
Referenced by processConfirm(), processDecline(), processInfRequest(), processRebind(), processRelease(), processRenew(), processRequest(), and processSolicit().
|
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.
answer | A message begins sent to the Client. If it holds the |
ctx | client context (contains subnet, duid and other parameters) Client FQDN option, this option is used to create NameChangeRequests. |
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().
|
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.
result | Result code of the send operation. |
ncr | NameChangeRequest which failed to send. |
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().
|
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.
decline | client's Decline message |
duid | client's duid (used to verify if the client owns the lease) |
general_status | [out] status in top-level message (may be updated) |
ia | specific IA_NA option to process. |
new_leases | a collection of leases being declined. |
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().
|
protected |
Declines specific IPv6 lease.
This method performs the actual decline and all necessary operations:
decline | used for generating removal Name Change Request. |
lease | lease to be declined |
ia_rsp | response IA_NA. |
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().
|
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.
decline | Decline message sent by a client |
reply | Server's response (IA_NA with status will be added here) |
ctx | context |
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().
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().
|
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
opt | option that contains DUID |
Definition at line 1532 of file dhcp6_srv.cc.
Referenced by testServerID().
bool isc::dhcp::Dhcpv6Srv::earlyGHRLookup | ( | const Pkt6Ptr & | query, |
AllocEngine::ClientContext6 & | ctx ) |
Initialize client context and perform early global reservations lookup.
query | The query message. |
ctx | Reference to client context. |
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().
|
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.
pkt | packet to be classified |
ctx | allocation 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().
|
protected |
Evaluate classes.
Evaluate expressions of client classes: if it returns true the class is added to the incoming packet.
pkt | packet to be classified. |
depend_on_known | if 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().
|
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.
query | client's message (Renew or Rebind) to the client (if the client sent this option to the server). |
ctx | client context (contains subnet, duid and other parameters) |
ia | IA_NA option which carries address for which lease lifetime will be extended. |
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().
|
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".
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.
query | client's message |
ctx | client context (contains subnet, duid and other parameters) |
ia | IA_PD option that is being renewed |
DHCPv6DiscardMessageError | when the message being processed should be discarded by the server, i.e. there is no binding for the client doing Rebind. |
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().
|
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.
query | client's Renew or Rebind message |
reply | server's response |
ctx | client context (contains subnet, duid and other parameters) |
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().
|
inline |
Returns an object which controls access to the configuration backends.
Definition at line 124 of file dhcp6_srv.h.
References cb_control_.
|
static |
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().
|
inline |
Returns pointer to the IO service used by the server.
Definition at line 110 of file dhcp6_srv.h.
Referenced by isc::dhcp::ControlledDhcpv6Srv::ControlledDhcpv6Srv(), isc::dhcp::ControlledDhcpv6Srv::cleanup(), isc::dhcp::ControlledDhcpv6Srv::init(), run(), and isc::dhcp::ControlledDhcpv6Srv::shutdownServer().
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.
pkt | will try to exact MAC address from this packet |
Definition at line 2537 of file dhcp6_srv.cc.
References isc::dhcp::CfgMgr::instance().
Referenced by initContext0().
|
inline |
Returns pointer to the network state used by the server.
Definition at line 115 of file dhcp6_srv.h.
References network_state_.
|
protected |
Return the PD exclude option to include.
ctx | client context (contains subnet and hosts). |
lease | lease (contains address/prefix and prefix length). |
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().
|
inline |
Returns server-identifier option.
Definition at line 135 of file dhcp6_srv.h.
References serverid_.
Referenced by appendDefaultOptions(), and testServerID().
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.
Definition at line 4995 of file dhcp6_srv.cc.
References server_port_.
|
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().
|
protected |
Initializes client context for specified packet.
This method:
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.
[out] | ctx | reference to context object to be initialized. |
[out] | drop | if 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().
void isc::dhcp::Dhcpv6Srv::initContext0 | ( | const Pkt6Ptr & | query, |
AllocEngine::ClientContext6 & | ctx ) |
Initialize client context (first part).
query | The query message. |
ctx | Reference 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().
|
inline |
Checks if the server is running in unit test mode.
Definition at line 105 of file dhcp6_srv.h.
References server_port_.
|
finaloverridevirtual |
Return a list of all paths that contain passwords or secrets for kea-dhcp6.
Reimplemented from isc::process::Daemon.
Definition at line 5120 of file dhcp6_srv.cc.
|
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.
All the logic required to form appropriate answer to the client is held in this function.
question | Client's message. |
answer | Server's response to a client. If server generated Client FQDN option for the client, this option is stored in this object. |
ctx | client 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().
|
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:
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.
ctx | Reference to client context |
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().
|
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.
ctx | Reference to client context |
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().
|
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.
dhcp4_query | message 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().
Process a single incoming DHCPv6 query.
It localizes the query, calls per-type processXXX methods, generates appropriate answer.
query | A pointer to the packet to be processed. |
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().
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.
query | A 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().
|
protected |
Processes incoming Information-request message.
ctx | Reference to client context |
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().
Pkt6Ptr isc::dhcp::Dhcpv6Srv::processLocalizedQuery6 | ( | AllocEngine::ClientContext6 & | ctx | ) |
Process a localized incoming DHCPv6 query.
It calls per-type processXXX methods, generates appropriate answer.
ctx | Pointer to The client context. |
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().
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.
query | A 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_.
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.
query | A pointer to the packet to be processed. |
ctx | Pointer 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().
Process a single incoming DHCPv6 packet.
It verifies correctness of the passed packet, localizes it, calls per-type processXXX methods, generates appropriate answer.
query | A pointer to the packet to be processed. |
Definition at line 804 of file dhcp6_srv.cc.
References isc::dhcp::bad_packet6_logger, isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), classifyPacket(), isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DBG_DHCP6_DETAIL_DATA, isc::dhcp::DBG_DHCP6_HOOKS, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP6_BUFFER_UNPACK, isc::dhcp::DHCP6_HOOK_BUFFER_RCVD_DROP, isc::dhcp::DHCP6_HOOK_BUFFER_RCVD_SKIP, isc::dhcp::DHCP6_HOOK_PACKET_RCVD_SKIP, isc::dhcp::dhcp6_logger, isc::dhcp::DHCP6_PACKET_DROP_DROP_CLASS, isc::dhcp::DHCP6_PACKET_DROP_PARSE_FAIL, isc::dhcp::DHCP6_PACKET_OPTIONS_SKIPPED, isc::dhcp::DHCP6_PACKET_RECEIVED, isc::dhcp::DHCP6_QUERY_DATA, isc::dhcp::DHCP6_QUERY_LABEL, isc::dhcp::getCalloutHandle(), Hooks, isc::hooks::hooks_logger, isc::stats::StatsMgr::instance(), LOG_DEBUG, LOG_INFO, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::options6_logger, isc::dhcp::packet6_logger, processDhcp6Query(), sanityCheck(), testServerID(), and testUnicast().
Referenced by 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.
query | A 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().
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.
query | A 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().
void isc::dhcp::Dhcpv6Srv::processPacketBufferSend | ( | hooks::CalloutHandlePtr & | callout_handle, |
Pkt6Ptr & | rsp ) |
Executes buffer6_send callout and sends the response.
callout_handle | pointer to the callout handle. |
rsp | pointer to a response. |
Definition at line 1461 of file dhcp6_srv.cc.
References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::dhcp::DBG_DHCP6_DETAIL_DATA, isc::dhcp::DBG_DHCP6_HOOKS, isc::dhcp::DHCP6_HOOK_BUFFER_SEND_SKIP, isc::dhcp::DHCP6_PACKET_SEND, isc::dhcp::DHCP6_PACKET_SEND_FAIL, isc::dhcp::DHCP6_RESPONSE_DATA, Hooks, isc::hooks::hooks_logger, LOG_DEBUG, LOG_ERROR, LOG_INFO, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::packet6_logger, processStatsSent(), and sendPacket().
Referenced by processDhcp6QueryAndSendResponse(), processLocalizedQuery6(), processLocalizedQuery6AndSendResponse(), processPacketAndSendResponse(), and sendResponseNoThrow().
|
protected |
Executes pkt6_send callout.
callout_handle | pointer to the callout handle. |
query | Pointer to a query. |
rsp | Pointer to a response. |
subnet | A 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().
|
protected |
Processes incoming Rebind message.
ctx | Reference to client context |
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().
|
protected |
Process incoming Release message.
ctx | Reference to client context |
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().
|
protected |
Processes incoming Renew message.
ctx | Reference to client context |
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().
|
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.
ctx | Reference to client context |
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().
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:
Definition at line 4823 of file dhcp6_srv.cc.
References D6O_RSOO, and isc::dhcp::CfgMgr::instance().
Referenced by processLocalizedQuery6().
|
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.
ctx | Reference to client context |
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().
|
static |
Updates statistics for transmitted packets.
response | packet 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().
|
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().
|
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.
duid | client's duid |
query | client's message |
general_status | a global status (it may be updated in case of errors) |
ia | IA_NA option that is being released |
old_lease | a pointer to the lease being released |
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().
|
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.
duid | client's duid |
query | client's message |
general_status | a global status (it may be updated in case of errors) |
ia | IA_PD option that is being released |
old_lease | a pointer to the lease being released |
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().
|
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.
release | client's message asking to release |
reply | server's response |
ctx | client context (includes subnet, client-id, hw-addr etc.) |
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().
|
staticprotected |
Removed evaluated client classes.
pkt | the packet. |
Definition at line 4512 of file dhcp6_srv.cc.
References isc::dhcp::CfgMgr::instance().
Referenced by earlyGHRLookup(), and initContext().
int isc::dhcp::Dhcpv6Srv::run | ( | ) |
Main server processing loop.
Main server processing loop. Call the processing step routine until shut down.
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_.
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().
|
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.
pkt | packet to be checked |
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().
|
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.
pkt | packet to be checked |
clientid | expectation regarding client-id option |
serverid | expectation regarding server-id option |
RFCViolation | if 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().
|
protected |
verifies if received DUID option (client-id or server-id) is sane
opt | option to be checked |
opt_name | text name to be printed |
RFCViolation | if 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().
|
protected |
Selects a subnet for a given client's packet.
question | client's message |
drop | if it is true the packet will be dropped |
Definition at line 2086 of file dhcp6_srv.cc.
References isc::hooks::HooksManager::callCallouts(), isc::hooks::HooksManager::calloutsPresent(), isc::dhcp::DBG_DHCP6_BASIC_DATA, isc::dhcp::DBG_DHCP6_DETAIL, isc::dhcp::DBG_DHCP6_DETAIL_DATA, isc::dhcp::DBG_DHCP6_HOOKS, isc::log::DBGLVL_PKT_HANDLING, isc::dhcp::DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL, isc::dhcp::DHCP6_HOOK_SUBNET6_SELECT_DROP, isc::dhcp::DHCP6_HOOK_SUBNET6_SELECT_PARK, isc::dhcp::DHCP6_HOOK_SUBNET6_SELECT_SKIP, isc::dhcp::DHCP6_SUBNET_DATA, isc::dhcp::DHCP6_SUBNET_SELECTED, isc::dhcp::DHCP6_SUBNET_SELECTION_FAILED, isc::hooks::HooksManager::drop(), isc::dhcp::getCalloutHandle(), Hooks, isc::hooks::hooks_logger, isc::dhcp::CfgSubnets6::initSelector(), isc::dhcp::CfgMgr::instance(), isc::util::MultiThreadingMgr::instance(), LOG_DEBUG, isc::hooks::CalloutHandle::NEXT_STEP_DROP, isc::hooks::CalloutHandle::NEXT_STEP_PARK, isc::hooks::CalloutHandle::NEXT_STEP_SKIP, isc::dhcp::packet6_logger, isc::hooks::HooksManager::park(), and processLocalizedQuery6AndSendResponse().
Referenced by processDhcp6Query().
|
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().
void isc::dhcp::Dhcpv6Srv::sendResponseNoThrow | ( | hooks::CalloutHandlePtr & | callout_handle, |
Pkt6Ptr | query, | ||
Pkt6Ptr & | rsp, | ||
ConstSubnet6Ptr & | subnet ) |
Process an unparked DHCPv6 packet and sends the response.
callout_handle | pointer to the callout handle. |
query | A pointer to the packet to be processed. |
rsp | A pointer to the response. |
subnet | A 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().
|
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
ctx | reference 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().
|
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().
|
protected |
Assigns classes retrieved from host reservation database.
pkt | Pointer to the packet to which classes will be assigned. |
ctx | Reference to the client context. |
Definition at line 4527 of file dhcp6_srv.cc.
References isc::dhcp::AllocEngine::ClientContext6::currentHost().
Referenced by conditionallySetReservedClientClasses(), and initContext().
|
protected |
A simple utility method that sets the status code.
Removes old status code and sets a new one.
container | status code will be added here |
status | status code option |
Definition at line 4278 of file dhcp6_srv.cc.
References D6O_STATUS_CODE.
Referenced by declineIA().
|
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.
preferred_lft | preferred lease time of the lease being assigned to the client |
subnet | the subnet to which the lease belongs |
resp | outbound IA option in which the timers are set. |
Definition at line 5032 of file dhcp6_srv.cc.
Referenced by assignIA_NA(), assignIA_PD(), extendIA_NA(), and extendIA_PD().
|
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().
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().
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().
|
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.
pkt | DHCPv6 packet carrying server identifier to be checked. |
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().
|
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.
pkt | DHCPv6 message to be checked. |
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().
|
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().
|
protected |
Controls access to the configuration backends.
Definition at line 1249 of file dhcp6_srv.h.
Referenced by getCBControl().
|
protected |
UDP port number to which server sends all responses.
Definition at line 1187 of file dhcp6_srv.h.
Referenced by processLocalizedQuery6().
|
static |
Minimum length of a MAC address to be used in DUID generation.
Definition at line 81 of file dhcp6_srv.h.
|
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.
|
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().
|
protected |
UDP port number on which server listens.
Definition at line 1184 of file dhcp6_srv.h.
Referenced by getServerPort(), inTestMode(), processLocalizedQuery6(), and run().
|
protected |
Server DUID (to be sent in server-identifier option)
Definition at line 1218 of file dhcp6_srv.h.
Referenced by Dhcpv6Srv(), and getServerID().
|
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().
|
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.