mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[#1915] DROP reasons are now debuglevel 15
This commit is contained in:
committed by
Razvan Becheriu
parent
4448a4ef75
commit
af3fa21939
@@ -258,7 +258,7 @@ Dhcpv4Exchange::Dhcpv4Exchange(const AllocEnginePtr& alloc_engine,
|
|||||||
|
|
||||||
// Check the DROP special class.
|
// Check the DROP special class.
|
||||||
if (query_->inClass("DROP")) {
|
if (query_->inClass("DROP")) {
|
||||||
LOG_DEBUG(packet4_logger, DBGLVL_TRACE_BASIC, DHCP4_PACKET_DROP_0013)
|
LOG_DEBUG(packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0013)
|
||||||
.arg(query_->toText());
|
.arg(query_->toText());
|
||||||
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
||||||
static_cast<int64_t>(1));
|
static_cast<int64_t>(1));
|
||||||
@@ -1023,8 +1023,7 @@ Dhcpv4Srv::run_one() {
|
|||||||
|
|
||||||
// If the DHCP service has been globally disabled, drop the packet.
|
// If the DHCP service has been globally disabled, drop the packet.
|
||||||
if (!network_state_->isServiceEnabled()) {
|
if (!network_state_->isServiceEnabled()) {
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_BASIC,
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0008)
|
||||||
DHCP4_PACKET_DROP_0008)
|
|
||||||
.arg(query->getLabel());
|
.arg(query->getLabel());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -1143,8 +1142,7 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp, bool allow_packet_park) {
|
|||||||
.arg(e.what());
|
.arg(e.what());
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
// Failed to parse the packet.
|
// Failed to parse the packet.
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL,
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0001)
|
||||||
DHCP4_PACKET_DROP_0001)
|
|
||||||
.arg(query->getRemoteAddr().toText())
|
.arg(query->getRemoteAddr().toText())
|
||||||
.arg(query->getLocalAddr().toText())
|
.arg(query->getLocalAddr().toText())
|
||||||
.arg(query->getIface())
|
.arg(query->getIface())
|
||||||
@@ -1229,7 +1227,7 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp, bool allow_packet_park) {
|
|||||||
|
|
||||||
// Check the DROP special class.
|
// Check the DROP special class.
|
||||||
if (query->inClass("DROP")) {
|
if (query->inClass("DROP")) {
|
||||||
LOG_DEBUG(packet4_logger, DBGLVL_TRACE_BASIC, DHCP4_PACKET_DROP_0010)
|
LOG_DEBUG(packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0010)
|
||||||
.arg(query->toText());
|
.arg(query->toText());
|
||||||
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
||||||
static_cast<int64_t>(1));
|
static_cast<int64_t>(1));
|
||||||
@@ -1320,8 +1318,7 @@ Dhcpv4Srv::processDhcp4Query(Pkt4Ptr& query, Pkt4Ptr& rsp,
|
|||||||
// (The problem is logged as a debug message because debug is
|
// (The problem is logged as a debug message because debug is
|
||||||
// disabled by default - it prevents a DDOS attack based on the
|
// disabled by default - it prevents a DDOS attack based on the
|
||||||
// sending of problem packets.)
|
// sending of problem packets.)
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_BASIC,
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0007)
|
||||||
DHCP4_PACKET_DROP_0007)
|
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(e.what());
|
.arg(e.what());
|
||||||
|
|
||||||
@@ -3487,7 +3484,7 @@ Dhcpv4Srv::accept(const Pkt4Ptr& query) const {
|
|||||||
// Check if the message from directly connected client (if directly
|
// Check if the message from directly connected client (if directly
|
||||||
// connected) should be dropped or processed.
|
// connected) should be dropped or processed.
|
||||||
if (!acceptDirectRequest(query)) {
|
if (!acceptDirectRequest(query)) {
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0002)
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0002)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(query->getIface());
|
.arg(query->getIface());
|
||||||
return (false);
|
return (false);
|
||||||
@@ -3496,7 +3493,7 @@ Dhcpv4Srv::accept(const Pkt4Ptr& query) const {
|
|||||||
// Check if the DHCPv4 packet has been sent to us or to someone else.
|
// Check if the DHCPv4 packet has been sent to us or to someone else.
|
||||||
// If it hasn't been sent to us, drop it!
|
// If it hasn't been sent to us, drop it!
|
||||||
if (!acceptServerId(query)) {
|
if (!acceptServerId(query)) {
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0003)
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0003)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(query->getIface());
|
.arg(query->getIface());
|
||||||
return (false);
|
return (false);
|
||||||
@@ -3552,7 +3549,7 @@ Dhcpv4Srv::acceptMessageType(const Pkt4Ptr& query) const {
|
|||||||
type = query->getType();
|
type = query->getType();
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0004)
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0004)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(query->getIface());
|
.arg(query->getIface());
|
||||||
return (false);
|
return (false);
|
||||||
@@ -3577,19 +3574,19 @@ Dhcpv4Srv::acceptMessageType(const Pkt4Ptr& query) const {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DHCP_NOTYPE:
|
case DHCP_NOTYPE:
|
||||||
LOG_INFO(bad_packet4_logger, DHCP4_PACKET_DROP_0009)
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0009)
|
||||||
.arg(query->getLabel());
|
.arg(query->getLabel());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// If we receive a message with a non-existing type, we are logging it.
|
// If we receive a message with a non-existing type, we are logging it.
|
||||||
if (type >= DHCP_TYPES_EOF) {
|
if (type >= DHCP_TYPES_EOF) {
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0005)
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0005)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(type);
|
.arg(type);
|
||||||
} else {
|
} else {
|
||||||
// Exists but we don't support it.
|
// Exists but we don't support it.
|
||||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0006)
|
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0006)
|
||||||
.arg(query->getLabel())
|
.arg(query->getLabel())
|
||||||
.arg(type);
|
.arg(type);
|
||||||
}
|
}
|
||||||
|
@@ -321,8 +321,7 @@ Dhcpv6Srv::testServerID(const Pkt6Ptr& pkt) {
|
|||||||
// Let us test received ServerID if it is same as ServerID
|
// Let us test received ServerID if it is same as ServerID
|
||||||
// which is being used by server
|
// which is being used by server
|
||||||
if (getServerID()->getData() != server_id->getData()){
|
if (getServerID()->getData() != server_id->getData()){
|
||||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL_DATA,
|
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_SERVERID_MISMATCH)
|
||||||
DHCP6_PACKET_DROP_SERVERID_MISMATCH)
|
|
||||||
.arg(pkt->getLabel())
|
.arg(pkt->getLabel())
|
||||||
.arg(duidToString(server_id))
|
.arg(duidToString(server_id))
|
||||||
.arg(duidToString(getServerID()));
|
.arg(duidToString(getServerID()));
|
||||||
@@ -341,7 +340,7 @@ Dhcpv6Srv::testUnicast(const Pkt6Ptr& pkt) const {
|
|||||||
case DHCPV6_REBIND:
|
case DHCPV6_REBIND:
|
||||||
case DHCPV6_INFORMATION_REQUEST:
|
case DHCPV6_INFORMATION_REQUEST:
|
||||||
if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
|
if (pkt->relay_info_.empty() && !pkt->getLocalAddr().isV6Multicast()) {
|
||||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL, DHCP6_PACKET_DROP_UNICAST)
|
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_UNICAST)
|
||||||
.arg(pkt->getLabel())
|
.arg(pkt->getLabel())
|
||||||
.arg(pkt->getName());
|
.arg(pkt->getName());
|
||||||
return (false);
|
return (false);
|
||||||
@@ -500,8 +499,7 @@ Dhcpv6Srv::initContext(const Pkt6Ptr& pkt,
|
|||||||
|
|
||||||
// Check the DROP special class.
|
// Check the DROP special class.
|
||||||
if (pkt->inClass("DROP")) {
|
if (pkt->inClass("DROP")) {
|
||||||
LOG_DEBUG(packet6_logger, DBG_DHCP6_BASIC,
|
LOG_DEBUG(packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_DROP_CLASS2)
|
||||||
DHCP6_PACKET_DROP_DROP_CLASS2)
|
|
||||||
.arg(pkt->toText());
|
.arg(pkt->toText());
|
||||||
StatsMgr::instance().addValue("pkt6-receive-drop",
|
StatsMgr::instance().addValue("pkt6-receive-drop",
|
||||||
static_cast<int64_t>(1));
|
static_cast<int64_t>(1));
|
||||||
@@ -605,8 +603,7 @@ void Dhcpv6Srv::run_one() {
|
|||||||
|
|
||||||
// If the DHCP service has been globally disabled, drop the packet.
|
// If the DHCP service has been globally disabled, drop the packet.
|
||||||
if (!network_state_->isServiceEnabled()) {
|
if (!network_state_->isServiceEnabled()) {
|
||||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL_DATA,
|
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_DHCP_DISABLED)
|
||||||
DHCP6_PACKET_DROP_DHCP_DISABLED)
|
|
||||||
.arg(query->getLabel());
|
.arg(query->getLabel());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -719,8 +716,7 @@ Dhcpv6Srv::processPacket(Pkt6Ptr& query, Pkt6Ptr& rsp) {
|
|||||||
.arg(e.what());
|
.arg(e.what());
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
// Failed to parse the packet.
|
// Failed to parse the packet.
|
||||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL,
|
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_PARSE_FAIL)
|
||||||
DHCP6_PACKET_DROP_PARSE_FAIL)
|
|
||||||
.arg(query->getRemoteAddr().toText())
|
.arg(query->getRemoteAddr().toText())
|
||||||
.arg(query->getLocalAddr().toText())
|
.arg(query->getLocalAddr().toText())
|
||||||
.arg(query->getIface())
|
.arg(query->getIface())
|
||||||
|
@@ -13,6 +13,7 @@ namespace log {
|
|||||||
/// enabled without giving a level.
|
/// enabled without giving a level.
|
||||||
extern const int DBGLVL_START_SHUT = 0;
|
extern const int DBGLVL_START_SHUT = 0;
|
||||||
extern const int DBGLVL_COMMAND = 10;
|
extern const int DBGLVL_COMMAND = 10;
|
||||||
|
extern const int DBGLVL_PKT_HANDLING = 15;
|
||||||
extern const int DBGLVL_COMMAND_DATA = 20;
|
extern const int DBGLVL_COMMAND_DATA = 20;
|
||||||
|
|
||||||
extern const int DBGLVL_TRACE_BASIC = 40;
|
extern const int DBGLVL_TRACE_BASIC = 40;
|
||||||
|
@@ -53,6 +53,10 @@ extern const int DBGLVL_START_SHUT;
|
|||||||
/// between processes, including configuration messages.
|
/// between processes, including configuration messages.
|
||||||
extern const int DBGLVL_COMMAND;
|
extern const int DBGLVL_COMMAND;
|
||||||
|
|
||||||
|
/// This debug level is reserved for logging the details of packet handling, such
|
||||||
|
/// as dropping the packet for various reasons.
|
||||||
|
extern const int DBGLVL_PKT_HANDLING;
|
||||||
|
|
||||||
/// If the commands have associated data, this level is when they are printed.
|
/// If the commands have associated data, this level is when they are printed.
|
||||||
/// This includes configuration messages.
|
/// This includes configuration messages.
|
||||||
extern const int DBGLVL_COMMAND_DATA;
|
extern const int DBGLVL_COMMAND_DATA;
|
||||||
|
Reference in New Issue
Block a user