mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-05 00:15:17 +00:00
[5553] Added specific log for possible BOOTP packets
src/bin/dhcp4/dhcp4_messages.mes Added DHCP4_PACKET_DROP_0009 for possible bootp packets src/bin/dhcp4/dhcp4_srv.cc Dhcpv4Srv::acceptMessageType() rearranged a bit to test explicitly for DHCP_NOTYPE src/bin/dhcp4/tests/dhcp4_srv_unittest.cc TEST_F(Dhcpv4SrvTest, acceptMessageType) Added tests for packets with no option 53 and for type > DHCPLEASEQUERYDONE
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2011-2018 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@@ -2828,14 +2828,6 @@ Dhcpv4Srv::acceptMessageType(const Pkt4Ptr& query) const {
|
||||
return (false);
|
||||
}
|
||||
|
||||
// If we receive a message with a non-existing type, we are logging it.
|
||||
if (type > DHCPLEASEQUERYDONE) {
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0005)
|
||||
.arg(query->getLabel())
|
||||
.arg(type);
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Once we know that the message type is within a range of defined DHCPv4
|
||||
// messages, we do a detailed check to make sure that the received message
|
||||
// is targeted at server. Note that we could have received some Offer
|
||||
@@ -2844,16 +2836,36 @@ Dhcpv4Srv::acceptMessageType(const Pkt4Ptr& query) const {
|
||||
// safe side. Also, we want to drop other messages which we don't support.
|
||||
// All these valid messages that we are not going to process are dropped
|
||||
// silently.
|
||||
if ((type != DHCPDISCOVER) && (type != DHCPREQUEST) &&
|
||||
(type != DHCPRELEASE) && (type != DHCPDECLINE) &&
|
||||
(type != DHCPINFORM)) {
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, DHCP4_PACKET_DROP_0006)
|
||||
.arg(query->getLabel())
|
||||
.arg(type);
|
||||
return (false);
|
||||
|
||||
switch(type) {
|
||||
case DHCPDISCOVER:
|
||||
case DHCPREQUEST:
|
||||
case DHCPRELEASE:
|
||||
case DHCPDECLINE:
|
||||
case DHCPINFORM:
|
||||
return (true);
|
||||
break;
|
||||
|
||||
case DHCP_NOTYPE:
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, 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 > DHCPLEASEQUERYDONE) {
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL, 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)
|
||||
.arg(query->getLabel())
|
||||
.arg(type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Reference in New Issue
Block a user