mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-05 00:15:17 +00:00
[5551] kea-dhcp4 now attempts to process packets with truncated VIVSO
src/lib/dhcp/option.h SkipRemainingOptionsError - new error to signal that unpacking skipped options src/lib/dhcp/option_vendor.cc OptionVendor::unpack() - modified to throw SkipRemainingOptions on truncated length src/lib/dhcp/option_definition.cc OptionDefinition::optionFactory() Added catch-rethrow of SkipRemainginOptionsError src/bin/dhcp4/dhcp4_messages.mes Added DHCP4_PACKET_OPTIONS_SKIPPED log message src/bin/dhcp4/dhcp4_srv.cc Dhcpv4Srv::processPacket() - added explicit catch of SkipRemainingOptionsError which logs the error but allows the processing to continue. src/bin/dhcp4/tests/dhcp4_srv_unittest.cc TEST_F(Dhcpv4SrvTest, truncatedVIVSOOption) - new test to verify skip-options logic for truncated vendor option src/lib/dhcp/tests/pkt4_unittest.cc TEST_F(Pkt4Test, truncatedVendorLength) - new test that verifies Pkt4 unpacking of truncated VIVSO src/lib/dhcp/tests/pkt_captures4.cc Pkt4Ptr PktCaptures::discoverWithValidVIVSO() Pkt4Ptr PktCaptures::discoverWithTruncatedVIVSO() - new captured discovers
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
|
||||
@@ -964,6 +964,12 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp) {
|
||||
.arg(query->getLocalAddr().toText())
|
||||
.arg(query->getIface());
|
||||
query->unpack();
|
||||
} catch (const SkipRemainingOptionsError& e) {
|
||||
// An option failed to unpack but we are to attempt to process it
|
||||
// anyway. Log it and let's hope for the best.
|
||||
LOG_DEBUG(options4_logger, DBG_DHCP4_DETAIL,
|
||||
DHCP4_PACKET_OPTIONS_SKIPPED)
|
||||
.arg(e.what());
|
||||
} catch (const std::exception& e) {
|
||||
// Failed to parse the packet.
|
||||
LOG_DEBUG(bad_packet4_logger, DBG_DHCP4_DETAIL,
|
||||
@@ -3107,7 +3113,7 @@ Dhcpv4Srv::deferredUnpack(Pkt4Ptr& query)
|
||||
opt = def->optionFactory(Option::V4, code, buf.cbegin(), buf.cend());
|
||||
query->addOption(opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Dhcpv4Srv::startD2() {
|
||||
|
Reference in New Issue
Block a user