+2217. [func] fdupont
+ Extended the lenient-option-parsing compatibility
+ flag to ignore DHCPv4 fqdn (81) option with some
+ invalid domain names (e.g. beginning with an empty label).
+ (Gitlab 3289)
+
2216. [func] tmark
PerfMon hook library is now functional. It accumulates
and reports performance data, and supports alarms. Still
}
}
+Starting with Kea version 2.5.8 this is extended to silently ignore
+fqdn (81) options with some invalid domain names.
+
Ignore DHCP Server Identifier
-----------------------------
}
} catch (const Exception& ex) {
- isc_throw(InvalidOption4FqdnDomainName,
- "failed to parse the domain-name in DHCPv4 Client FQDN"
- << " Option: " << ex.what());
+ std::ostringstream errmsg;
+ errmsg << "failed to parse the domain-name in DHCPv4 Client FQDN "
+ << " Option: " << ex.what();
+ if (Option::lenient_parsing_) {
+ isc_throw(SkipThisOptionError, errmsg.str());
+ } else {
+ isc_throw(InvalidOption4FqdnDomainName, errmsg.str());
+ }
}
}
-// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2024 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
using namespace isc;
using namespace isc::dhcp;
+// RAII device to make sure that lenient parsing flag is reset to false on exit.
+class LenientOptionParsing {
+public:
+ LenientOptionParsing(bool value) {
+ Option::lenient_parsing_ = value;
+ }
+
+ ~LenientOptionParsing() {
+ Option::lenient_parsing_ = false;
+ }
+};
+
// This test verifies that constructor accepts empty partial domain-name but
// does not accept empty fully qualified domain name.
TEST(Option4ClientFqdnTest, constructEmptyName) {
size_t in_data_size = sizeof(in_data) / sizeof(in_data[0]);
OptionBuffer in_buf(in_data, in_data + in_data_size);
+ LenientOptionParsing lop(false);
EXPECT_THROW(Option4ClientFqdn(in_buf.begin(), in_buf.end()),
InvalidOption4FqdnDomainName);
+ Option::lenient_parsing_ = true;
+ EXPECT_THROW(Option4ClientFqdn(in_buf.begin(), in_buf.end()),
+ SkipThisOptionError);
}
// This test verifies that exception is thrown when invalid domain-name
size_t in_data_size = sizeof(in_data) / sizeof(in_data[0]);
OptionBuffer in_buf(in_data, in_data + in_data_size);
+ LenientOptionParsing lop(false);
EXPECT_THROW(Option4ClientFqdn(in_buf.begin(), in_buf.end()),
InvalidOption4FqdnDomainName);
+ Option::lenient_parsing_ = true;
+ EXPECT_THROW(Option4ClientFqdn(in_buf.begin(), in_buf.end()),
+ SkipThisOptionError);
}
// This test verifies that the option in the on-wire format with partial
/// Structure that holds registered hook indexes
struct AllocEngineHooks {
- int hook_index_lease4_select_; ///< index for "lease4_receive" hook point
+ int hook_index_lease4_select_; ///< index for "lease4_select" hook point
int hook_index_lease4_renew_; ///< index for "lease4_renew" hook point
int hook_index_lease4_expire_; ///< index for "lease4_expire" hook point
int hook_index_lease4_recover_;///< index for "lease4_recover" hook point
- int hook_index_lease6_select_; ///< index for "lease6_receive" hook point
+ int hook_index_lease6_select_; ///< index for "lease6_select" hook point
int hook_index_lease6_renew_; ///< index for "lease6_renew" hook point
int hook_index_lease6_rebind_; ///< index for "lease6_rebind" hook point
int hook_index_lease6_expire_; ///< index for "lease6_expire" hook point
/// sendto(s, buffer.getDataAsVoidPtr(), buffer.getLength(), 0, &to, sizeof(to));
/// @endcode
///
-/// where the @c getData() (in fact @getDataAsVoidPtr()) method gives
+/// where the @c getData() (in fact @c getDataAsVoidPtr()) method gives
/// a reference to the internal memory region stored in the @c buffer
/// object. This is a suboptimal design in that it exposes an
/// encapsulated "handle" of an object to its user. Unfortunately,