![]() |
Kea
1.5.0
|
Controlled version of the DHCPv6 server. More...
#include <ctrl_dhcp6_srv.h>
Inheritance diagram for isc::dhcp::ControlledDhcpv6Srv:Public Member Functions | |
| ControlledDhcpv6Srv (uint16_t port=DHCP6_SERVER_PORT) | |
| Constructor. More... | |
| virtual | ~ControlledDhcpv6Srv () |
| Destructor. More... | |
| isc::data::ConstElementPtr | checkConfig (isc::data::ConstElementPtr new_config) |
| Configuration checker. More... | |
| void | cleanup () |
| Performs cleanup, immediately before termination. More... | |
| void | init (const std::string &config_file) |
| Initializes the server. More... | |
| isc::data::ConstElementPtr | loadConfigFile (const std::string &file_name) |
| Loads specific configuration file. More... | |
| void | shutdown () |
| Initiates shutdown procedure for the whole DHCPv6 server. More... | |
Public Member Functions inherited from isc::dhcp::Dhcpv6Srv | |
| Dhcpv6Srv (uint16_t port=DHCP6_SERVER_PORT) | |
| Default constructor. More... | |
| virtual | ~Dhcpv6Srv () |
| Destructor. Used during DHCPv6 service shutdown. More... | |
| void | classifyByVendor (const Pkt6Ptr &pkt, std::string &classes) |
| Assign class using vendor-class-identifier option. More... | |
| virtual void | d2ClientErrorHandler (const dhcp_ddns::NameChangeSender::Result result, dhcp_ddns::NameChangeRequestPtr &ncr) |
| Implements the error handler for DHCP_DDNS IO errors. More... | |
| void | discardPackets () |
| Discards cached and parked packets Clears the call_handle store and packet parking lots of all packets. More... | |
| asiolink::IOServicePtr & | getIOService () |
| Returns pointer to the IO service used by the server. More... | |
| NetworkStatePtr & | getNetworkState () |
| Returns pointer to the network state used by the server. More... | |
| uint16_t | getPort () const |
| Get UDP port on which server should listen. More... | |
| OptionPtr | getServerID () |
| Returns server-identifier option. More... | |
| void | processPacket (Pkt6Ptr &query, Pkt6Ptr &rsp) |
| Process a single incoming DHCPv6 packet. More... | |
| void | processPacketBufferSend (hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &rsp) |
| Executes buffer6_send callout and sends the response. More... | |
| bool | run () |
| Main server processing loop. More... | |
| void | run_one () |
| Main server processing step. More... | |
| void | shutdown () |
| Instructs the server to shut down. More... | |
| void | startD2 () |
| Starts DHCP_DDNS client IO if DDNS updates are enabled. More... | |
| void | stopD2 () |
| Stops DHCP_DDNS client IO if DDNS updates are enabled. More... | |
Public Member Functions inherited from isc::process::Daemon | |
| Daemon () | |
| Default constructor. More... | |
| virtual | ~Daemon () |
| Destructor. More... | |
| void | checkConfigFile () const |
| Checks the configuration file name. More... | |
| void | createPIDFile (int pid=0) |
| Creates the PID file. More... | |
| std::string | getConfigFile () const |
| Returns config file name. More... | |
| std::string | getPIDFileDir () const |
| Returns the directory used when forming default PID file name. More... | |
| std::string | getPIDFileName () const |
| Returns the current PID file name. More... | |
| std::string | getProcName () const |
| returns the process name This value is used as when forming the default PID file name More... | |
| void | setConfigFile (const std::string &config_file) |
| Sets the configuration file name. More... | |
| void | setPIDFileDir (const std::string &pid_file_dir) |
| Sets the PID file directory. More... | |
| void | setPIDFileName (const std::string &pid_file_name) |
| Sets PID file name. More... | |
| void | setProcName (const std::string &proc_name) |
| Sets the process name. More... | |
| virtual size_t | writeConfigFile (const std::string &config_file, isc::data::ConstElementPtr cfg=isc::data::ConstElementPtr()) const |
| Writes current configuration to specified file. More... | |
Static Public Member Functions | |
| static ControlledDhcpv6Srv * | getInstance () |
| returns pointer to the sole instance of Dhcpv6Srv More... | |
| static isc::data::ConstElementPtr | processCommand (const std::string &command, isc::data::ConstElementPtr args) |
| command processor More... | |
| static isc::data::ConstElementPtr | processConfig (isc::data::ConstElementPtr new_config) |
| configuration processor More... | |
Static Public Member Functions inherited from isc::dhcp::Dhcpv6Srv | |
| static uint16_t | checkRelaySourcePort (const Pkt6Ptr &query) |
| Used for DHCPv4-over-DHCPv6 too. More... | |
| static int | getHookIndexBuffer6Send () |
| Returns the index of the buffer6_send hook. More... | |
| static std::string | getVersion (bool extended) |
| returns Kea version on stdout and exit. More... | |
| static void | processStatsSent (const Pkt6Ptr &response) |
| Updates statistics for transmitted packets. More... | |
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. More... | |
| static std::string | getDefaultLoggerName () |
| Returns default logger name. More... | |
| static bool | getVerbose () |
| Returns if running in verbose mode. More... | |
| static std::string | getVersion (bool extended) |
| returns Kea version on stdout and exits. More... | |
| static void | loggerInit (const char *log_name, bool verbose) |
| Initializes logger. More... | |
| static void | setDefaultLoggerName (const std::string &logger) |
| Sets the default logger name. More... | |
| static void | setVerbose (const bool verbose) |
| Sets or clears verbose mode. More... | |
Additional Inherited Members | |
Public Types inherited from isc::dhcp::Dhcpv6Srv | |
| enum | RequirementLevel { FORBIDDEN, MANDATORY, OPTIONAL } |
| defines if certain option may, must or must not appear More... | |
Static Public Attributes inherited from isc::dhcp::Dhcpv6Srv | |
| static const size_t | MIN_MAC_LEN = 6 |
| Minimum length of a MAC address to be used in DUID generation. More... | |
Protected Member Functions inherited from isc::dhcp::Dhcpv6Srv | |
| void | appendDefaultOptions (const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list) |
| Appends default options to server's answer. More... | |
| void | appendRequestedOptions (const Pkt6Ptr &question, Pkt6Ptr &answer, const CfgOptionList &co_list) |
| Appends requested options to server's answer. More... | |
| void | appendRequestedVendorOptions (const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, const CfgOptionList &co_list) |
| Appends requested vendor options to server's answer. More... | |
| OptionPtr | assignIA_NA (const isc::dhcp::Pkt6Ptr &query, const isc::dhcp::Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia) |
| Processes IA_NA option (and assigns addresses if necessary). More... | |
| OptionPtr | assignIA_PD (const Pkt6Ptr &query, const isc::dhcp::Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, boost::shared_ptr< Option6IA > ia) |
| Processes IA_PD option (and assigns prefixes if necessary). More... | |
| void | assignLeases (const Pkt6Ptr &question, Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx) |
| Assigns leases. More... | |
| void | buildCfgOptionList (const Pkt6Ptr &question, AllocEngine::ClientContext6 &ctx, CfgOptionList &co_list) |
| Build the configured option list. More... | |
| void | classifyPacket (const Pkt6Ptr &pkt) |
| Assigns incoming packet to zero or more classes. More... | |
| void | copyClientOptions (const Pkt6Ptr &question, Pkt6Ptr &answer) |
| Copies required options from client message to server answer. More... | |
| void | createNameChangeRequests (const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx) |
Creates a number of isc::dhcp_ddns::NameChangeRequest objects based on the DHCPv6 Client FQDN Option. More... | |
| 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. More... | |
| bool | declineLease (const Pkt6Ptr &decline, const Lease6Ptr lease, boost::shared_ptr< Option6IA > ia_rsp) |
| Declines specific IPv6 lease. More... | |
| bool | declineLeases (const Pkt6Ptr &decline, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx) |
| Attempts to decline all leases in specified Decline message. More... | |
| void | evaluateClasses (const Pkt6Ptr &pkt, bool depend_on_known) |
| Evaluate classes. More... | |
| OptionPtr | extendIA_NA (const Pkt6Ptr &query, const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia) |
| Extends lifetime of the specific IA_NA option. More... | |
| OptionPtr | extendIA_PD (const Pkt6Ptr &query, AllocEngine::ClientContext6 &ctx, Option6IAPtr ia) |
| Extends lifetime of the prefix. More... | |
| void | extendLeases (const Pkt6Ptr &query, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx) |
| Attempts to extend the lifetime of IAs. More... | |
| void | initContext (const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx, bool &drop) |
| Initializes client context for specified packet. More... | |
| void | processClientFqdn (const Pkt6Ptr &question, const Pkt6Ptr &answer, AllocEngine::ClientContext6 &ctx) |
| Processes Client FQDN Option. More... | |
| Pkt6Ptr | processConfirm (AllocEngine::ClientContext6 &ctx) |
| Processes incoming Confirm message and returns Reply. More... | |
| Pkt6Ptr | processDecline (AllocEngine::ClientContext6 &ctx) |
| Process incoming Decline message. More... | |
| void | processDhcp4Query (const Pkt6Ptr &dhcp4_query) |
| Processes incoming DHCPv4-query message. More... | |
| Pkt6Ptr | processInfRequest (AllocEngine::ClientContext6 &ctx) |
| Processes incoming Information-request message. More... | |
| void | processPacketPktSend (hooks::CalloutHandlePtr &callout_handle, Pkt6Ptr &query, Pkt6Ptr &rsp) |
| Executes pkt6_send callout. More... | |
| Pkt6Ptr | processRebind (AllocEngine::ClientContext6 &ctx) |
| Processes incoming Rebind message. More... | |
| Pkt6Ptr | processRelease (AllocEngine::ClientContext6 &ctx) |
| Process incoming Release message. More... | |
| Pkt6Ptr | processRenew (AllocEngine::ClientContext6 &ctx) |
| Processes incoming Renew message. More... | |
| Pkt6Ptr | processRequest (AllocEngine::ClientContext6 &ctx) |
| Processes incoming Request and returns Reply response. More... | |
| void | processRSOO (const Pkt6Ptr &query, const Pkt6Ptr &rsp) |
| Processes Relay-supplied options, if present. More... | |
| Pkt6Ptr | processSolicit (AllocEngine::ClientContext6 &ctx) |
| Processes incoming Solicit and returns response. More... | |
| virtual Pkt6Ptr | receivePacket (int timeout) |
| dummy wrapper around IfaceMgr::receive6 More... | |
| 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. More... | |
| 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. More... | |
| void | releaseLeases (const Pkt6Ptr &release, Pkt6Ptr &reply, AllocEngine::ClientContext6 &ctx) |
| Attempts to release received addresses. More... | |
| void | requiredClassify (const Pkt6Ptr &pkt, AllocEngine::ClientContext6 &ctx) |
| Assigns incoming packet to zero or more classes (required pass). More... | |
| bool | sanityCheck (const Pkt6Ptr &pkt) |
| Verifies if specified packet meets RFC requirements. More... | |
| void | sanityCheck (const Pkt6Ptr &pkt, RequirementLevel clientid, RequirementLevel serverid) |
| verifies if specified packet meets RFC requirements More... | |
| void | sanityCheckDUID (const OptionPtr &opt, const std::string &opt_name) |
| verifies if received DUID option (client-id or server-id) is sane More... | |
| isc::dhcp::Subnet6Ptr | selectSubnet (const Pkt6Ptr &question, bool &drop) |
| Selects a subnet for a given client's packet. More... | |
| virtual void | sendPacket (const Pkt6Ptr &pkt) |
| dummy wrapper around IfaceMgr::send() More... | |
| void | setReservedClientClasses (const Pkt6Ptr &pkt, const AllocEngine::ClientContext6 &ctx) |
| Assigns classes retrieved from host reservation database. More... | |
| void | setStatusCode (boost::shared_ptr< Option6IA > &container, const OptionPtr &status) |
| A simple utility method that sets the status code. More... | |
| bool | testServerID (const Pkt6Ptr &pkt) |
| Compare received server id with our server id. More... | |
| bool | testUnicast (const Pkt6Ptr &pkt) const |
| Check if the message can be sent to unicast. More... | |
Protected Member Functions inherited from isc::process::Daemon | |
| virtual void | handleSignal () |
| Invokes handler for the next received signal. More... | |
| std::string | makePIDFileName () const |
| Manufacture the pid file name. More... | |
Static Protected Member Functions inherited from isc::dhcp::Dhcpv6Srv | |
| static std::string | duidToString (const OptionPtr &opt) |
| converts DUID to text Converts content of DUID option to a text representation, e.g. More... | |
| static HWAddrPtr | getMAC (const Pkt6Ptr &pkt) |
| Attempts to get a MAC/hardware address using configured sources. More... | |
Protected Attributes inherited from isc::dhcp::Dhcpv6Srv | |
| boost::shared_ptr< AllocEngine > | alloc_engine_ |
| Allocation Engine. More... | |
| 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. More... | |
| NetworkStatePtr | network_state_ |
| Holds information about disabled DHCP service and/or disabled subnet/network scopes. More... | |
| OptionPtr | serverid_ |
| Server DUID (to be sent in server-identifier option) More... | |
| volatile bool | shutdown_ |
| Indicates if shutdown is in progress. More... | |
Protected Attributes inherited from isc::process::Daemon | |
| isc::util::SignalHandler | signal_handler_ |
| Pointer to the common signal handler invoked by the handleSignal function. More... | |
| isc::util::SignalSetPtr | signal_set_ |
| A pointer to the object installing custom signal handlers. More... | |
Static Protected Attributes inherited from isc::dhcp::Dhcpv6Srv | |
| static const std::string | VENDOR_CLASS_PREFIX |
| this is a prefix added to the content of vendor-class option More... | |
Controlled version of the DHCPv6 server.
This is a class that is responsible for DHCPv6 server being controllable, by reading configuration file from disk.
Definition at line 25 of file ctrl_dhcp6_srv.h.
| isc::dhcp::ControlledDhcpv6Srv::ControlledDhcpv6Srv | ( | uint16_t | port = DHCP6_SERVER_PORT | ) |
Constructor.
| port | UDP port to be opened for DHCP traffic |
Definition at line 740 of file ctrl_dhcp6_srv.cc.
References isc::dhcp::Dhcpv6Srv::getIOService(), isc::dhcp::TimerMgr::instance(), and isc_throw.
Here is the call graph for this function:
|
virtual |
Destructor.
Definition at line 817 of file ctrl_dhcp6_srv.cc.
References cleanup().
Here is the call graph for this function:| isc::data::ConstElementPtr isc::dhcp::ControlledDhcpv6Srv::checkConfig | ( | isc::data::ConstElementPtr | new_config | ) |
Configuration checker.
This is a method for checking incoming configuration.
| new_config | JSON representation of the new configuration |
Definition at line 724 of file ctrl_dhcp6_srv.cc.
References isc::dhcp::configureDhcp6Server(), isc::config::createAnswer(), isc::dhcp::DBG_DHCP6_COMMAND, isc::dhcp::dhcp6_logger, and LOG_DEBUG.
Here is the call graph for this function:
|
virtual |
Performs cleanup, immediately before termination.
This method performs final clean up, just before the Dhcpv6Srv object is destroyed. Currently it is a no-op.
Reimplemented from isc::process::Daemon.
Definition at line 187 of file ctrl_dhcp6_srv.cc.
Referenced by ~ControlledDhcpv6Srv().
|
inlinestatic |
returns pointer to the sole instance of Dhcpv6Srv
Definition at line 118 of file ctrl_dhcp6_srv.h.
| void isc::dhcp::ControlledDhcpv6Srv::init | ( | const std::string & | config_file | ) |
Initializes the server.
It reads the JSON file from disk or may perform any other setup operation. In particular, it also install signal handlers.
This method may throw if initialization fails.
Definition at line 164 of file ctrl_dhcp6_srv.cc.
References isc_throw, and isc::config::parseAnswer().
Here is the call graph for this function:| ConstElementPtr isc::dhcp::ControlledDhcpv6Srv::loadConfigFile | ( | const std::string & | file_name | ) |
Loads specific configuration file.
Configure DHCPv6 server using the configuration file specified.
This utility method is called whenever we know a filename of the config and need to load it. It calls config-set command once the content of the file has been loaded and verified to be a sane JSON configuration. config-set handler will process the config file (apply it as current configuration).
| file_name | name of the file to be loaded |
This function is used to both configure the DHCP server on its startup and dynamically reconfigure the server when SIGHUP signal is received.
It fetches DHCPv6 server's configuration from the 'Dhcp6' section of the JSON configuration file.
| file_name | Configuration file location. |
Definition at line 93 of file ctrl_dhcp6_srv.cc.
References isc::dhcp::dhcp6_logger, isc_throw, LOG_ERROR, isc::asiodns::logger, isc::data::Element::map, isc::config::parseAnswer(), isc::dhcp::Parser6Context::parseFile(), and isc::Exception::what().
Here is the call graph for this function:
|
static |
command processor
This method is uniform for all config backends. It processes received command (as a string + JSON arguments). Internally, it's just a wrapper that calls process*Command() methods and catches exceptions in them.
Currently supported commands are:
| command | Text representation of the command (e.g. "shutdown") |
| args | Optional parameters |
Definition at line 512 of file ctrl_dhcp6_srv.cc.
References isc::config::createAnswer(), isc::dhcp::DBG_DHCP6_COMMAND, isc::dhcp::dhcp6_logger, LOG_DEBUG, and isc::Exception::what().
Here is the call graph for this function:
|
static |
configuration processor
This is a method for handling incoming configuration updates. This method should be called by all configuration backends when the server is starting up or when configuration has changed.
As pointer to this method is used a callback in ASIO used in ModuleCCSession, it has to be static.
| new_config | textual representation of the new configuration |
Definition at line 577 of file ctrl_dhcp6_srv.cc.
References isc::dhcp::configureDhcp6Server(), isc::config::CONTROL_RESULT_ERROR, isc::config::createAnswer(), D6O_SERVERID, isc::dhcp::DBG_DHCP6_COMMAND, isc::dhcp::dhcp6_logger, isc::dhcp::Dhcpv6Srv::getIOService(), isc::dhcp::Dhcpv6Srv::getNetworkState(), isc::dhcp::Dhcpv6Srv::getPort(), Hooks, LOG_DEBUG, LOG_INFO, isc::config::parseAnswer(), and isc::dhcp::Dhcpv6Srv::startD2().
Here is the call graph for this function:
|
virtual |
Initiates shutdown procedure for the whole DHCPv6 server.
Reimplemented from isc::process::Daemon.
Definition at line 812 of file ctrl_dhcp6_srv.cc.
References isc::dhcp::Dhcpv6Srv::shutdown(), and isc::asiolink::IOService::stop().
Here is the call graph for this function: