mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[#1915] DROP reasons are now debuglevel 15
This commit is contained in:
parent
4448a4ef75
commit
af3fa21939
@ -258,7 +258,7 @@ Dhcpv4Exchange::Dhcpv4Exchange(const AllocEnginePtr& alloc_engine,
|
||||
|
||||
// Check the DROP special class.
|
||||
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());
|
||||
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
||||
static_cast<int64_t>(1));
|
||||
@ -1023,8 +1023,7 @@ Dhcpv4Srv::run_one() {
|
||||
|
||||
// If the DHCP service has been globally disabled, drop the packet.
|
||||
if (!network_state_->isServiceEnabled()) {
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_BASIC,
|
||||
DHCP4_PACKET_DROP_0008)
|
||||
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0008)
|
||||
.arg(query->getLabel());
|
||||
return;
|
||||
} else {
|
||||
@ -1143,8 +1142,7 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp, bool allow_packet_park) {
|
||||
.arg(e.what());
|
||||
} catch (const std::exception& e) {
|
||||
// Failed to parse the packet.
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL,
|
||||
DHCP4_PACKET_DROP_0001)
|
||||
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0001)
|
||||
.arg(query->getRemoteAddr().toText())
|
||||
.arg(query->getLocalAddr().toText())
|
||||
.arg(query->getIface())
|
||||
@ -1229,7 +1227,7 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp, bool allow_packet_park) {
|
||||
|
||||
// Check the DROP special class.
|
||||
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());
|
||||
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
|
||||
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
|
||||
// disabled by default - it prevents a DDOS attack based on the
|
||||
// sending of problem packets.)
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_BASIC,
|
||||
DHCP4_PACKET_DROP_0007)
|
||||
LOG_DEBUG(bad_packet4_logger, DBGLVL_PKT_HANDLING, DHCP4_PACKET_DROP_0007)
|
||||
.arg(query->getLabel())
|
||||
.arg(e.what());
|
||||
|
||||
@ -3487,7 +3484,7 @@ Dhcpv4Srv::accept(const Pkt4Ptr& query) const {
|
||||
// Check if the message from directly connected client (if directly
|
||||
// connected) should be dropped or processed.
|
||||
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->getIface());
|
||||
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.
|
||||
// If it hasn't been sent to us, drop it!
|
||||
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->getIface());
|
||||
return (false);
|
||||
@ -3552,7 +3549,7 @@ Dhcpv4Srv::acceptMessageType(const Pkt4Ptr& query) const {
|
||||
type = query->getType();
|
||||
|
||||
} 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->getIface());
|
||||
return (false);
|
||||
@ -3577,19 +3574,19 @@ Dhcpv4Srv::acceptMessageType(const Pkt4Ptr& query) const {
|
||||
break;
|
||||
|
||||
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());
|
||||
break;
|
||||
|
||||
default:
|
||||
// If we receive a message with a non-existing type, we are logging it.
|
||||
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(type);
|
||||
} else {
|
||||
// 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(type);
|
||||
}
|
||||
|
@ -321,8 +321,7 @@ Dhcpv6Srv::testServerID(const Pkt6Ptr& pkt) {
|
||||
// Let us test received ServerID if it is same as ServerID
|
||||
// which is being used by server
|
||||
if (getServerID()->getData() != server_id->getData()){
|
||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL_DATA,
|
||||
DHCP6_PACKET_DROP_SERVERID_MISMATCH)
|
||||
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_SERVERID_MISMATCH)
|
||||
.arg(pkt->getLabel())
|
||||
.arg(duidToString(server_id))
|
||||
.arg(duidToString(getServerID()));
|
||||
@ -341,7 +340,7 @@ Dhcpv6Srv::testUnicast(const Pkt6Ptr& pkt) const {
|
||||
case DHCPV6_REBIND:
|
||||
case DHCPV6_INFORMATION_REQUEST:
|
||||
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->getName());
|
||||
return (false);
|
||||
@ -500,8 +499,7 @@ Dhcpv6Srv::initContext(const Pkt6Ptr& pkt,
|
||||
|
||||
// Check the DROP special class.
|
||||
if (pkt->inClass("DROP")) {
|
||||
LOG_DEBUG(packet6_logger, DBG_DHCP6_BASIC,
|
||||
DHCP6_PACKET_DROP_DROP_CLASS2)
|
||||
LOG_DEBUG(packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_DROP_CLASS2)
|
||||
.arg(pkt->toText());
|
||||
StatsMgr::instance().addValue("pkt6-receive-drop",
|
||||
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 (!network_state_->isServiceEnabled()) {
|
||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL_DATA,
|
||||
DHCP6_PACKET_DROP_DHCP_DISABLED)
|
||||
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_DHCP_DISABLED)
|
||||
.arg(query->getLabel());
|
||||
return;
|
||||
} else {
|
||||
@ -719,8 +716,7 @@ Dhcpv6Srv::processPacket(Pkt6Ptr& query, Pkt6Ptr& rsp) {
|
||||
.arg(e.what());
|
||||
} catch (const std::exception &e) {
|
||||
// Failed to parse the packet.
|
||||
LOG_DEBUG(bad_packet6_logger, DBG_DHCP6_DETAIL,
|
||||
DHCP6_PACKET_DROP_PARSE_FAIL)
|
||||
LOG_DEBUG(bad_packet6_logger, DBGLVL_PKT_HANDLING, DHCP6_PACKET_DROP_PARSE_FAIL)
|
||||
.arg(query->getRemoteAddr().toText())
|
||||
.arg(query->getLocalAddr().toText())
|
||||
.arg(query->getIface())
|
||||
|
@ -13,6 +13,7 @@ namespace log {
|
||||
/// enabled without giving a level.
|
||||
extern const int DBGLVL_START_SHUT = 0;
|
||||
extern const int DBGLVL_COMMAND = 10;
|
||||
extern const int DBGLVL_PKT_HANDLING = 15;
|
||||
extern const int DBGLVL_COMMAND_DATA = 20;
|
||||
|
||||
extern const int DBGLVL_TRACE_BASIC = 40;
|
||||
|
@ -53,6 +53,10 @@ extern const int DBGLVL_START_SHUT;
|
||||
/// between processes, including configuration messages.
|
||||
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.
|
||||
/// This includes configuration messages.
|
||||
extern const int DBGLVL_COMMAND_DATA;
|
||||
|
Loading…
x
Reference in New Issue
Block a user