Commit 9fbb30d6 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[3210] CfgMgr now can store a flag for echoing v4 client-id

parent 748d5e58
......@@ -350,7 +350,7 @@ CfgMgr::getUnicast(const std::string& iface) const {
CfgMgr::CfgMgr()
: datadir_(DHCP_DATA_DIR),
all_ifaces_active_(false) {
all_ifaces_active_(false), echo_v4_client_id_(true) {
// DHCP_DATA_DIR must be set set with -DDHCP_DATA_DIR="..." in Makefile.am
// Note: the definition of DHCP_DATA_DIR needs to include quotation marks
// See AM_CPPFLAGS definition in Makefile.am
......
......@@ -316,6 +316,22 @@ public:
const isc::asiolink::IOAddress*
getUnicast(const std::string& iface) const;
/// @brief sets whether server should send back client-id in DHCPv4
///
/// This is a compatibility flag. The default (true) is compliant with
/// RFC6842. False is for backward compatibility.
///
/// @param echo should the client-id be sent or not
void echoClientId(bool echo) {
echo_v4_client_id_ = echo;
}
/// @brief returns whether server should send back client-id in DHCPv4
/// @param returns whether v4 client-id should be returned or not
bool echoClientId() const {
return (echo_v4_client_id_);
}
protected:
/// @brief Protected constructor.
......@@ -392,6 +408,9 @@ private:
/// A flag which indicates that server should listen on all available
/// interfaces.
bool all_ifaces_active_;
/// Indicates whether v4 server should send back client-id
bool echo_v4_client_id_;
};
} // namespace isc::dhcp
......
......@@ -653,6 +653,18 @@ TEST_F(CfgMgrTest, activateAllIfaces) {
EXPECT_FALSE(cfg_mgr.isActiveIface("eth2"));
}
// This test verifies that RFC6842 (echo client-id) compatibility may be
// configured.
TEST_F(CfgMgrTest, echoClientId) {
CfgMgr& cfg_mgr = CfgMgr::instance();
EXPECT_TRUE(cfg_mgr.echoClientId());
cfg_mgr.echoClientId(false);
EXPECT_FALSE(cfg_mgr.echoClientId());
}
/// @todo Add unit-tests for testing:
/// - addActiveIface() with invalid interface name
/// - addActiveIface() with the same interface twice
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment