extern const isc::log::MessageID DHCP4_HOOK_PACKET_RCVD_SKIP = "DHCP4_HOOK_PACKET_RCVD_SKIP";
extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_DROP = "DHCP4_HOOK_PACKET_SEND_DROP";
extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_SKIP = "DHCP4_HOOK_PACKET_SEND_SKIP";
+extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_4O6_PARKING_LOT_FULL = "DHCP4_HOOK_SUBNET4_SELECT_4O6_PARKING_LOT_FULL";
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_DROP = "DHCP4_HOOK_SUBNET4_SELECT_DROP";
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_PARK = "DHCP4_HOOK_SUBNET4_SELECT_PARK";
+extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_PARKING_LOT_FULL = "DHCP4_HOOK_SUBNET4_SELECT_PARKING_LOT_FULL";
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_SKIP = "DHCP4_HOOK_SUBNET4_SELECT_SKIP";
extern const isc::log::MessageID DHCP4_INFORM_DIRECT_REPLY = "DHCP4_INFORM_DIRECT_REPLY";
extern const isc::log::MessageID DHCP4_INIT_FAIL = "DHCP4_INIT_FAIL";
"DHCP4_HOOK_PACKET_RCVD_SKIP", "%1: packet is dropped, because a callout set the next step to SKIP",
"DHCP4_HOOK_PACKET_SEND_DROP", "%1: prepared DHCPv4 response was not sent because a callout set the next ste to DROP",
"DHCP4_HOOK_PACKET_SEND_SKIP", "%1: prepared response is not sent, because a callout set the next stp to SKIP",
+ "DHCP4_HOOK_SUBNET4_SELECT_4O6_PARKING_LOT_FULL", "The parked-packet-limit %1, has been reached, dropping query: %2",
"DHCP4_HOOK_SUBNET4_SELECT_DROP", "%1: packet was dropped, because a callout set the next step to 'drop'",
"DHCP4_HOOK_SUBNET4_SELECT_PARK", "%1: packet was parked",
+ "DHCP4_HOOK_SUBNET4_SELECT_PARKING_LOT_FULL", "The parked-packet-limit %1, has been reached, dropping query: %2",
"DHCP4_HOOK_SUBNET4_SELECT_SKIP", "%1: no subnet was selected, because a callout set the next skip flag",
"DHCP4_INFORM_DIRECT_REPLY", "%1: DHCPACK in reply to the DHCPINFORM will be sent directly to %2 over %3",
"DHCP4_INIT_FAIL", "failed to initialize Kea server: %1",
extern const isc::log::MessageID DHCP4_HOOK_PACKET_RCVD_SKIP;
extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_DROP;
extern const isc::log::MessageID DHCP4_HOOK_PACKET_SEND_SKIP;
+extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_4O6_PARKING_LOT_FULL;
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_DROP;
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_PARK;
+extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_PARKING_LOT_FULL;
extern const isc::log::MessageID DHCP4_HOOK_SUBNET4_SELECT_SKIP;
extern const isc::log::MessageID DHCP4_INFORM_DIRECT_REPLY;
extern const isc::log::MessageID DHCP4_INIT_FAIL;
% DHCP4_HOOK_LEASE4_OFFER_PARKING_LOT_FULL The parked-packet-limit %1, has been reached, dropping query: %2
This debug message occurs when the parking lot used to hold client queries
-while hook library work for them completes has reached or exceeded the
+while the hook library work for them completes has reached or exceeded the
limit set by the parked-packet-limit global parameter. This can occur when
kea-dhcp4 is using hook libraries (e.g. ping-check) that implement the
"lease4_offer" callout and client queries are arriving faster than
% DHCP4_HOOK_LEASES4_COMMITTED_PARKING_LOT_FULL The parked-packet-limit %1, has been reached, dropping query: %2
This debug message occurs when the parking lot used to hold client queries
-while hook library work for them completes has reached or exceeded the
+while the hook library work for them completes has reached or exceeded the
limit set by the parked-packet-limit global parameter. This can occur when
kea-dhcp4 is using hook libraries (e.g. HA) that implement the
"leases4-committed" callout and client queries are arriving faster than
the client will not get any response, even though the server processed
client's request and acted on it (e.g. possibly allocated a lease).
+% DHCP4_HOOK_SUBNET4_SELECT_4O6_PARKING_LOT_FULL The parked-packet-limit %1, has been reached, dropping query: %2
+This debug message occurs when the parking lot used to hold client queries
+while the hook library work for them completes has reached or exceeded the
+limit set by the parked-packet-limit global parameter. This can occur when
+kea-dhcp4 is using hook libraries (e.g. radius) that implement the
+"subnet4_select" callout and DHCP4O6 client queries are arriving faster than
+those callouts can fulfill them.
+
% DHCP4_HOOK_SUBNET4_SELECT_DROP %1: packet was dropped, because a callout set the next step to 'drop'
This debug message is printed when a callout installed on the
subnet4_select hook point sets the next step to 'drop' value. For this particular hook
subnet4_select hook point set the park flag. The argument holds the
client and transaction identification information.
+% DHCP4_HOOK_SUBNET4_SELECT_PARKING_LOT_FULL The parked-packet-limit %1, has been reached, dropping query: %2
+This debug message occurs when the parking lot used to hold client queries
+while the hook library work for them completes has reached or exceeded the
+limit set by the parked-packet-limit global parameter. This can occur when
+kea-dhcp4 is using hook libraries (e.g. radius) that implement the
+"subnet4_select" callout and client queries are arriving faster than
+those callouts can fulfill them.
+
% DHCP4_HOOK_SUBNET4_SELECT_SKIP %1: no subnet was selected, because a callout set the next skip flag
This debug message is printed when a callout installed on the
subnet4_select hook point sets the next step to SKIP value. For this particular hook
using namespace isc;
using namespace isc::asiolink;
using namespace isc::cryptolink;
+using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::dhcp_ddns;
using namespace isc::hooks;
cfgmgr.getCurrentCfg()->
getCfgSubnets4()->getAll());
+ auto const tpl(parkingLimitExceeded("subnet4_select"));
+ bool const exceeded(get<0>(tpl));
+ if (exceeded) {
+ uint32_t const limit(get<1>(tpl));
+ // We can't park it so we're going to throw it on the floor.
+ LOG_DEBUG(packet4_logger, DBGLVL_PKT_HANDLING,
+ DHCP4_HOOK_SUBNET4_SELECT_PARKING_LOT_FULL)
+ .arg(limit)
+ .arg(query->getLabel());
+ return (Subnet4Ptr());
+ }
+
// We proactively park the packet.
HooksManager::park(
"subnet4_select", query, [this, query, allow_answer_park, callout_handle_state]() {
cfgmgr.getCurrentCfg()->
getCfgSubnets4()->getAll());
+ auto const tpl(parkingLimitExceeded("subnet4_select"));
+ bool const exceeded(get<0>(tpl));
+ if (exceeded) {
+ uint32_t const limit(get<1>(tpl));
+ // We can't park it so we're going to throw it on the floor.
+ LOG_DEBUG(packet4_logger, DBGLVL_PKT_HANDLING,
+ DHCP4_HOOK_SUBNET4_SELECT_4O6_PARKING_LOT_FULL)
+ .arg(limit)
+ .arg(query->getLabel());
+ return (Subnet4Ptr());
+ }
+
// We proactively park the packet.
HooksManager::park(
"subnet4_select", query, [this, query, allow_answer_park, callout_handle_state]() {
}
if (allow_answer_park) {
- // Get the parking limit. Parsing should ensure the value is present.
- uint32_t parked_packet_limit = 0;
- data::ConstElementPtr ppl = CfgMgr::instance().getCurrentCfg()->
- getConfiguredGlobal(CfgGlobals::PARKED_PACKET_LIMIT);
- if (ppl) {
- parked_packet_limit = ppl->intValue();
- }
-
- if (parked_packet_limit) {
- auto const& parking_lot =
- ServerHooks::getServerHooks().getParkingLotPtr(hook_label);
-
- if (parking_lot && (parking_lot->size() >= parked_packet_limit)) {
- // We can't park it so we're going to throw it on the floor.
- LOG_DEBUG(packet4_logger, DBGLVL_PKT_HANDLING, parking_lot_full_msg)
- .arg(parked_packet_limit)
- .arg(query->getLabel());
- isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
- static_cast<int64_t>(1));
- return (Pkt4Ptr());
- }
+ auto const tpl(parkingLimitExceeded(hook_label));
+ bool const exceeded(get<0>(tpl));
+ if (exceeded) {
+ uint32_t const limit(get<1>(tpl));
+ // We can't park it so we're going to throw it on the floor.
+ LOG_DEBUG(packet4_logger, DBGLVL_PKT_HANDLING, parking_lot_full_msg)
+ .arg(limit)
+ .arg(query->getLabel());
+ isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
+ static_cast<int64_t>(1));
+ return (Pkt4Ptr());
}
// We proactively park the packet. We'll unpark it without invoking
return (opt);
}
+tuple<bool, uint32_t>
+Dhcpv4Srv::parkingLimitExceeded(string const& hook_label) {
+ // Get the parking limit. Parsing should ensure the value is present.
+ uint32_t parked_packet_limit(0);
+ ConstElementPtr const& ppl(
+ CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::PARKED_PACKET_LIMIT));
+ if (ppl) {
+ parked_packet_limit = ppl->intValue();
+ }
+
+ if (parked_packet_limit) {
+ ParkingLotPtr const& parking_lot(
+ ServerHooks::getServerHooks().getParkingLotPtr(hook_label));
+
+ if (parking_lot && parked_packet_limit <= parking_lot->size()) {
+ return make_tuple(true, parked_packet_limit);
+ }
+ }
+ return make_tuple(false, parked_packet_limit);
+}
+
Pkt4Ptr
Dhcpv4Srv::processDiscover(Pkt4Ptr& discover, AllocEngine::ClientContext4Ptr& context) {
bool drop = false;
private:
- /// @public
/// @brief Assign class using vendor-class-identifier option
///
/// @note This is the first part of @ref classifyPacket
/// @param pkt packet to be classified
void classifyByVendor(const Pkt4Ptr& pkt);
- /// @private
/// @brief Constructs netmask option based on subnet4
/// @param subnet subnet for which the netmask will be calculated
///
/// @return Option that contains netmask information
static OptionPtr getNetmaskOption(const Subnet4Ptr& subnet);
+ /// @brief Check if the parking limit has been exceeded for given hook label.
+ ///
+ /// @brief hook_label Hook point name.
+ ///
+ /// @return tuple with boolean value concluding whether the limit has been
+ /// exceeded, and the integer limit as a second value.
+ static std::tuple<bool, uint32_t> parkingLimitExceeded(std::string const& hook_label);
+
protected:
/// UDP port number on which server listens.
namespace isc {
namespace dhcp {
+extern const isc::log::MessageID DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL = "DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL";
extern const isc::log::MessageID DHCP6_ACTIVATE_INTERFACE = "DHCP6_ACTIVATE_INTERFACE";
extern const isc::log::MessageID DHCP6_ADD_GLOBAL_STATUS_CODE = "DHCP6_ADD_GLOBAL_STATUS_CODE";
extern const isc::log::MessageID DHCP6_ADD_STATUS_CODE_FOR_IA = "DHCP6_ADD_STATUS_CODE_FOR_IA";
namespace {
const char* values[] = {
+ "DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL", "The parked-packet-limit %1, has been reached, dropping query: %2",
"DHCP6_ACTIVATE_INTERFACE", "activating interface %1",
"DHCP6_ADD_GLOBAL_STATUS_CODE", "%1: adding Status Code to DHCPv6 packet: %2",
"DHCP6_ADD_STATUS_CODE_FOR_IA", "%1: adding Status Code to IA with iaid=%2: %3",
namespace isc {
namespace dhcp {
+extern const isc::log::MessageID DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL;
extern const isc::log::MessageID DHCP6_ACTIVATE_INTERFACE;
extern const isc::log::MessageID DHCP6_ADD_GLOBAL_STATUS_CODE;
extern const isc::log::MessageID DHCP6_ADD_STATUS_CODE_FOR_IA;
% DHCP6_HOOK_LEASES6_PARKING_LOT_FULL The parked-packet-limit %1, has been reached, dropping query: %2
This debug message occurs when the parking lot used to hold client queries
-while hook library work for them completes has reached or exceeded the
+while the hook library work for them completes has reached or exceeded the
limit set by the parked-packet-limit global parameter. This can occur when
kea-dhcp6 is using hook libraries (e.g. HA) that implement the
"leases6-committed" callout and client queries are arriving faster than
subnet6_select hook point set the park flag. The argument holds the
client and transaction identification information.
+% DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL The parked-packet-limit %1, has been reached, dropping query: %2
+This debug message occurs when the parking lot used to hold client queries
+while the hook library work for them completes has reached or exceeded the
+limit set by the parked-packet-limit global parameter. This can occur when
+kea-dhcp4 is using hook libraries (e.g. radius) that implement the
+"subnet6_select" callout and client queries are arriving faster than
+those callouts can fulfill them.
+
% DHCP6_HOOK_SUBNET6_SELECT_SKIP %1: no subnet was selected because a callout set the next step to SKIP
This debug message is printed when a callout installed on the
subnet6_select hook point set the next step to SKIP value. For this particular hook
using namespace isc;
using namespace isc::asiolink;
using namespace isc::cryptolink;
+using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::dhcp_ddns;
using namespace isc::hooks;
CfgMgr::instance().getCurrentCfg()->
getCfgSubnets6()->getAll());
+ auto const tpl(parkingLimitExceeded("subnet6_select"));
+ bool const exceeded(get<0>(tpl));
+ if (exceeded) {
+ uint32_t const limit(get<1>(tpl));
+ // We can't park it so we're going to throw it on the floor.
+ LOG_DEBUG(packet6_logger, DBGLVL_PKT_HANDLING,
+ DHCP4_HOOK_SUBNET6_SELECT_PARKING_LOT_FULL)
+ .arg(limit)
+ .arg(question->getLabel());
+ return (Subnet6Ptr());
+ }
+
// We proactively park the packet.
// Not MT compatible because the unparking callback can be called
// before the current thread exists from this block.
return (false);
}
+tuple<bool, uint32_t>
+Dhcpv6Srv::parkingLimitExceeded(string const& hook_label) {
+ // Get the parking limit. Parsing should ensure the value is present.
+ uint32_t parked_packet_limit(0);
+ ConstElementPtr const& ppl(
+ CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::PARKED_PACKET_LIMIT));
+ if (ppl) {
+ parked_packet_limit = ppl->intValue();
+ }
+
+ if (parked_packet_limit) {
+ ParkingLotPtr const& parking_lot(
+ ServerHooks::getServerHooks().getParkingLotPtr(hook_label));
+
+ if (parking_lot && parked_packet_limit <= parking_lot->size()) {
+ return make_tuple(true, parked_packet_limit);
+ }
+ }
+ return make_tuple(false, parked_packet_limit);
+}
+
+
void Dhcpv6Srv::discardPackets() {
// Dump all of our current packets, anything that is mid-stream
HooksManager::clearParkingLots();
/// @return true if option has been requested in the ORO.
bool requestedInORO(const Pkt6Ptr& query, const uint16_t code) const;
+ /// @brief Check if the parking limit has been exceeded for given hook label.
+ ///
+ /// @brief hook_label Hook point name.
+ ///
+ /// @return tuple with boolean value concluding whether the limit has been
+ /// exceeded, and the integer limit as a second value.
+ static std::tuple<bool, uint32_t> parkingLimitExceeded(std::string const& hook_label);
+
protected:
/// UDP port number on which server listens.
uint16_t server_port_;