From: Razvan Becheriu Date: Thu, 14 May 2026 08:02:19 +0000 (+0300) Subject: [#3144] addressed review comments X-Git-Tag: Kea-3.1.9~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb5b0559d693438250b22b2d3c9ed5962ccdeebb;p=thirdparty%2Fkea.git [#3144] addressed review comments --- diff --git a/doc/sphinx/api-files.txt b/doc/sphinx/api-files.txt index 50d0ff2fef..4841b80059 100644 --- a/doc/sphinx/api-files.txt +++ b/doc/sphinx/api-files.txt @@ -45,7 +45,7 @@ src/share/api/ha-sync.json src/share/api/ha-sync-complete-notify.json src/share/api/interface-list.json src/share/api/interface-redetect.json -src/share/api/interface-use.json +src/share/api/interface-add.json src/share/api/kea-lfc-start.json src/share/api/lease4-add.json src/share/api/lease4-del.json diff --git a/doc/sphinx/arm/ctrl-channel.rst b/doc/sphinx/arm/ctrl-channel.rst index d1f3bdd174..00a3caeb95 100644 --- a/doc/sphinx/arm/ctrl-channel.rst +++ b/doc/sphinx/arm/ctrl-channel.rst @@ -503,13 +503,13 @@ The :isccmd:`interface-redetect` command retrieves the list of detected interfac after performing a re-detect procedure. This command does not take any parameters." -.. isccmd:: interface-use -.. _command-interface-use: +.. isccmd:: interface-add +.. _command-interface-add: -The ``interface-use`` Command +The ``interface-add`` Command ----------------------------- -The :isccmd:`interface-use` command updates the list of interfaces used +The :isccmd:`interface-add` command updates the list of interfaces used to process DHCP traffic. The command takes as parameter the list of interfaces with respective addresses (if specified) on which the server should start listening for diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index ba5dc6b222..6c9895563d 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -8007,7 +8007,7 @@ The DHCPv4 server supports the following operational commands: - :isccmd:`dhcp-enable` - :isccmd:`interface-list` - :isccmd:`interface-redetect` -- :isccmd:`interface-use` +- :isccmd:`interface-add` - :isccmd:`leases-reclaim` - :isccmd:`list-commands` - :isccmd:`shutdown` diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index aab3bc7951..0db8298001 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -7986,7 +7986,7 @@ The DHCPv6 server supports the following operational commands: - :isccmd:`dhcp-enable` - :isccmd:`interface-list` - :isccmd:`interface-redetect` -- :isccmd:`interface-use` +- :isccmd:`interface-add` - :isccmd:`leases-reclaim` - :isccmd:`list-commands` - :isccmd:`shutdown` diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 59131d78e2..4509c97898 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -679,9 +679,11 @@ ControlledDhcpv4Srv::commandDhcpEnableHandler(const std::string&, ConstElementPtr ControlledDhcpv4Srv::commandInterfaceListHandler(const std::string&, ConstElementPtr) { + // stop thread pool (if running) + MultiThreadingCriticalSection cs; ElementPtr ifaces = Element::createMap(); - bool error = false; std::string message; + bool error = false; try { ifaces->set("interfaces", IfaceMgr::instance().ifacesToElement()); } catch (const std::exception& ex) { @@ -706,8 +708,10 @@ ControlledDhcpv4Srv::commandInterfaceListHandler(const std::string&, ConstElementPtr ControlledDhcpv4Srv::commandInterfaceRedetectHandler(const std::string&, ConstElementPtr args) { - bool error = false; + // stop thread pool (if running) + MultiThreadingCriticalSection cs; std::string message; + bool error = false; try { IfaceMgr::instance().detectIfaces(true); } catch (const std::exception& ex) { @@ -728,16 +732,18 @@ ControlledDhcpv4Srv::commandInterfaceRedetectHandler(const std::string&, } ConstElementPtr -ControlledDhcpv4Srv::commandInterfaceUseHandler(const std::string&, +ControlledDhcpv4Srv::commandInterfaceAddHandler(const std::string&, ConstElementPtr args) { - bool error = false; + // stop thread pool (if running) + MultiThreadingCriticalSection cs; string message; + bool error = false; ConstElementPtr ifaces_config; if (!args) { message = "Missing mandatory 'arguments' parameter."; } else { if (args->getType() != Element::map) { - message = "arguments for the 'interface-use' command must be a map"; + message = "arguments for the 'interface-add' command must be a map"; } else { ifaces_config = args->get("interfaces"); if (!ifaces_config) { @@ -756,10 +762,30 @@ ControlledDhcpv4Srv::commandInterfaceUseHandler(const std::string&, if (!message.empty()) { return (isc::config::createAnswer(CONTROL_RESULT_ERROR, message)); } + if (!ifaces_config->size()) { + return (isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration successful.")); + } try { + ElementPtr mutable_cfg = boost::const_pointer_cast(args); CfgIfacePtr running_cfg_iface = CfgMgr::instance().getCurrentCfg()->getCfgIface(); ElementPtr mutable_running_cfg = running_cfg_iface->toElement(); - merge(mutable_running_cfg, args); + auto const& element_empty = [](ElementPtr&) { + return (true); + }; + auto const& element_match_any = [](ElementPtr&, ElementPtr&) -> bool { + return (true); + }; + auto const& element_match = [](ElementPtr& left, ElementPtr& right) -> bool { + return (left->stringValue() == right->stringValue()); + }; + auto const& element_is_key = [](const std::string& key) -> bool { + return (key == "interfaces"); + }; + isc::data::HierarchyDescriptor hierarchy = { + { { "interfaces-config", { element_match_any, element_empty, element_is_key } } }, + { { "interfaces", { element_match, element_empty, element_is_key } } } + }; + mergeDiffAdd(mutable_running_cfg, mutable_cfg, hierarchy, "interfaces"); IfacesConfigParser parser(AF_INET, true); CfgIfacePtr cfg_iface(new CfgIface()); parser.parseInterfacesList(cfg_iface, mutable_running_cfg->get("interfaces")); @@ -1640,8 +1666,8 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P CommandMgr::instance().registerCommand("interface-redetect", std::bind(&ControlledDhcpv4Srv::commandInterfaceRedetectHandler, this, ph::_1, ph::_2)); - CommandMgr::instance().registerCommand("interface-use", - std::bind(&ControlledDhcpv4Srv::commandInterfaceUseHandler, this, ph::_1, ph::_2)); + CommandMgr::instance().registerCommand("interface-add", + std::bind(&ControlledDhcpv4Srv::commandInterfaceAddHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("kea-lfc-start", std::bind(&ControlledDhcpv4Srv::commandLfcStartHandler, this, ph::_1, ph::_2)); @@ -1741,7 +1767,7 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() { CommandMgr::instance().deregisterCommand("dhcp-enable"); CommandMgr::instance().deregisterCommand("interface-list"); CommandMgr::instance().deregisterCommand("interface-redetect"); - CommandMgr::instance().deregisterCommand("interface-use"); + CommandMgr::instance().deregisterCommand("interface-add"); CommandMgr::instance().deregisterCommand("kea-lfc-start"); CommandMgr::instance().deregisterCommand("leases-reclaim"); CommandMgr::instance().deregisterCommand("subnet4-select-test"); diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.h b/src/bin/dhcp4/ctrl_dhcp4_srv.h index f3c5b856f2..2fd9d2cbaf 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.h +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.h @@ -262,16 +262,16 @@ private: commandInterfaceRedetectHandler(const std::string& command, isc::data::ConstElementPtr args); - /// @brief Handler for processing 'interface-use' command + /// @brief Handler for processing 'interface-add' command /// - /// This handler processes interface-use command. + /// This handler processes interface-add command. /// /// @param command (parameter ignored) /// @param args arguments for the command. /// /// @return status of the command with the result isc::data::ConstElementPtr - commandInterfaceUseHandler(const std::string& command, + commandInterfaceAddHandler(const std::string& command, isc::data::ConstElementPtr args); /// @Brief handler for processing 'version-get' command diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 7d2abbfbed..577f9dfb1d 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -553,7 +553,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) { EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos); EXPECT_TRUE(command_list.find("\"interface-list\"") != string::npos); EXPECT_TRUE(command_list.find("\"interface-redetect\"") != string::npos); - EXPECT_TRUE(command_list.find("\"interface-use\"") != string::npos); + EXPECT_TRUE(command_list.find("\"interface-add\"") != string::npos); EXPECT_TRUE(command_list.find("\"kea-lfc-start\"") != string::npos); EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos); EXPECT_TRUE(command_list.find("\"subnet4-select-test\"") != string::npos); @@ -1877,7 +1877,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) { checkListCommands(rsp, "config-write"); checkListCommands(rsp, "interface-list"); checkListCommands(rsp, "interface-redetect"); - checkListCommands(rsp, "interface-use"); + checkListCommands(rsp, "interface-add"); checkListCommands(rsp, "kea-lfc-start"); checkListCommands(rsp, "list-commands"); checkListCommands(rsp, "leases-reclaim"); @@ -2555,8 +2555,8 @@ TEST_F(CtrlChannelDhcpv4SrvTest, interfaceRedetect) { EXPECT_EQ(response, expected); } -// Tests if interface-use works properly. -TEST_F(CtrlChannelDhcpv4SrvTest, interfaceUse) { +// Tests if interface-add works properly. +TEST_F(CtrlChannelDhcpv4SrvTest, interfaceAdd) { interfaces_ = ""; IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX, "11:22:33:44:55:66"); @@ -2579,7 +2579,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, interfaceUse) { SKIP_IF(skipped_); std::string response; - std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; + std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; sendUnixCommand(command, response); EXPECT_EQ(response, "{ \"result\": 0, \"text\": \"Configuration successful.\" }"); diff --git a/src/bin/dhcp4/tests/http_control_socket_unittest.cc b/src/bin/dhcp4/tests/http_control_socket_unittest.cc index c01a478e83..880f2ccc64 100644 --- a/src/bin/dhcp4/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp4/tests/http_control_socket_unittest.cc @@ -581,8 +581,8 @@ public: // Tests if interface-redetect works properly. void testInterfaceRedetect(); - // Tests if interface-use works properly. - void testInterfaceUse(); + // Tests if interface-add works properly. + void testInterfaceAdd(); // This test verifies that disable DHCP service command performs // sanity check on parameters. @@ -2982,7 +2982,7 @@ BaseCtrlChannelDhcpv4Test::testListCommands() { checkListCommands(rsp, "config-write"); checkListCommands(rsp, "interface-list"); checkListCommands(rsp, "interface-redetect"); - checkListCommands(rsp, "interface-use"); + checkListCommands(rsp, "interface-add"); checkListCommands(rsp, "kea-lfc-start"); checkListCommands(rsp, "list-commands"); checkListCommands(rsp, "leases-reclaim"); @@ -3780,9 +3780,9 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, interfaceRedetect) { testInterfaceRedetect(); } -// Tests if interface-use works properly. +// Tests if interface-add works properly. void -BaseCtrlChannelDhcpv4Test::testInterfaceUse() { +BaseCtrlChannelDhcpv4Test::testInterfaceAdd() { interfaces_ = ""; IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX, "11:22:33:44:55:66"); @@ -3804,7 +3804,7 @@ BaseCtrlChannelDhcpv4Test::testInterfaceUse() { IfaceMgr::instance().setPacketFilter(filter); std::string response; - std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; + std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; sendHttpCommand(command, response); EXPECT_EQ(response, "[ { \"result\": 0, \"text\": \"Configuration successful.\" } ]"); @@ -3827,12 +3827,12 @@ BaseCtrlChannelDhcpv4Test::testInterfaceUse() { EXPECT_EQ(response, expected); } -TEST_F(HttpCtrlChannelDhcpv4Test, interfaceUse) { - testInterfaceUse(); +TEST_F(HttpCtrlChannelDhcpv4Test, interfaceAdd) { + testInterfaceAdd(); } -TEST_F(HttpsCtrlChannelDhcpv4Test, interfaceUse) { - testInterfaceUse(); +TEST_F(HttpsCtrlChannelDhcpv4Test, interfaceAdd) { + testInterfaceAdd(); } // This test verifies that disable DHCP service command performs diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 830f0c9144..73a12ba146 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -682,9 +682,11 @@ ControlledDhcpv6Srv::commandDhcpEnableHandler(const std::string&, ConstElementPtr ControlledDhcpv6Srv::commandInterfaceListHandler(const std::string&, ConstElementPtr) { + // stop thread pool (if running) + MultiThreadingCriticalSection cs; ElementPtr ifaces = Element::createMap(); - bool error = false; std::string message; + bool error = false; try { ifaces->set("interfaces", IfaceMgr::instance().ifacesToElement()); } catch (const std::exception& ex) { @@ -709,8 +711,10 @@ ControlledDhcpv6Srv::commandInterfaceListHandler(const std::string&, ConstElementPtr ControlledDhcpv6Srv::commandInterfaceRedetectHandler(const std::string&, ConstElementPtr args) { - bool error = false; + // stop thread pool (if running) + MultiThreadingCriticalSection cs; std::string message; + bool error = false; try { IfaceMgr::instance().detectIfaces(true); } catch (const std::exception& ex) { @@ -731,16 +735,18 @@ ControlledDhcpv6Srv::commandInterfaceRedetectHandler(const std::string&, } ConstElementPtr -ControlledDhcpv6Srv::commandInterfaceUseHandler(const std::string&, +ControlledDhcpv6Srv::commandInterfaceAddHandler(const std::string&, ConstElementPtr args) { - bool error = false; + // stop thread pool (if running) + MultiThreadingCriticalSection cs; string message; + bool error = false; ConstElementPtr ifaces_config; if (!args) { message = "Missing mandatory 'arguments' parameter."; } else { if (args->getType() != Element::map) { - message = "arguments for the 'interface-use' command must be a map"; + message = "arguments for the 'interface-add' command must be a map"; } else { ifaces_config = args->get("interfaces"); if (!ifaces_config) { @@ -759,10 +765,30 @@ ControlledDhcpv6Srv::commandInterfaceUseHandler(const std::string&, if (!message.empty()) { return (isc::config::createAnswer(CONTROL_RESULT_ERROR, message)); } + if (!ifaces_config->size()) { + return (isc::config::createAnswer(CONTROL_RESULT_SUCCESS, "Configuration successful.")); + } try { + ElementPtr mutable_cfg = boost::const_pointer_cast(args); CfgIfacePtr running_cfg_iface = CfgMgr::instance().getCurrentCfg()->getCfgIface(); ElementPtr mutable_running_cfg = running_cfg_iface->toElement(); - merge(mutable_running_cfg, args); + auto const& element_empty = [](ElementPtr&) { + return (true); + }; + auto const& element_match_any = [](ElementPtr&, ElementPtr&) -> bool { + return (true); + }; + auto const& element_match = [](ElementPtr& left, ElementPtr& right) -> bool { + return (left->stringValue() == right->stringValue()); + }; + auto const& element_is_key = [](const std::string& key) -> bool { + return (key == "interfaces"); + }; + isc::data::HierarchyDescriptor hierarchy = { + { { "interfaces-config", { element_match_any, element_empty, element_is_key } } }, + { { "interfaces", { element_match, element_empty, element_is_key } } } + }; + mergeDiffAdd(mutable_running_cfg, mutable_cfg, hierarchy, "interfaces"); IfacesConfigParser parser(AF_INET6, true); CfgIfacePtr cfg_iface(new CfgIface()); parser.parseInterfacesList(cfg_iface, mutable_running_cfg->get("interfaces")); @@ -1430,8 +1456,8 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port /*= DHCP6_SERVER_P CommandMgr::instance().registerCommand("interface-redetect", std::bind(&ControlledDhcpv6Srv::commandInterfaceRedetectHandler, this, ph::_1, ph::_2)); - CommandMgr::instance().registerCommand("interface-use", - std::bind(&ControlledDhcpv6Srv::commandInterfaceUseHandler, this, ph::_1, ph::_2)); + CommandMgr::instance().registerCommand("interface-add", + std::bind(&ControlledDhcpv6Srv::commandInterfaceAddHandler, this, ph::_1, ph::_2)); CommandMgr::instance().registerCommand("kea-lfc-start", std::bind(&ControlledDhcpv6Srv::commandLfcStartHandler, this, ph::_1, ph::_2)); @@ -1528,7 +1554,7 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() { CommandMgr::instance().deregisterCommand("dhcp-enable"); CommandMgr::instance().deregisterCommand("interface-list"); CommandMgr::instance().deregisterCommand("interface-redetect"); - CommandMgr::instance().deregisterCommand("interface-use"); + CommandMgr::instance().deregisterCommand("interface-add"); CommandMgr::instance().deregisterCommand("kea-lfc-start"); CommandMgr::instance().deregisterCommand("leases-reclaim"); CommandMgr::instance().deregisterCommand("subnet6-select-test"); diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.h b/src/bin/dhcp6/ctrl_dhcp6_srv.h index ccdcde3ea6..e8e70d85cd 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.h +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.h @@ -262,16 +262,16 @@ private: commandInterfaceRedetectHandler(const std::string& command, isc::data::ConstElementPtr args); - /// @brief Handler for processing 'interface-use' command + /// @brief Handler for processing 'interface-add' command /// - /// This handler processes interface-use command. + /// This handler processes interface-add command. /// /// @param command (parameter ignored) /// @param args arguments for the command. /// /// @return status of the command with the result isc::data::ConstElementPtr - commandInterfaceUseHandler(const std::string& command, + commandInterfaceAddHandler(const std::string& command, isc::data::ConstElementPtr args); /// @Brief handler for processing 'version-get' command diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 2a6995c713..fb19537bbb 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -556,7 +556,7 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) { EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos); EXPECT_TRUE(command_list.find("\"interface-list\"") != string::npos); EXPECT_TRUE(command_list.find("\"interface-redetect\"") != string::npos); - EXPECT_TRUE(command_list.find("\"interface-use\"") != string::npos); + EXPECT_TRUE(command_list.find("\"interface-add\"") != string::npos); EXPECT_TRUE(command_list.find("\"kea-lfc-start\"") != string::npos); EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos); EXPECT_TRUE(command_list.find("\"subnet6-select-test\"") != string::npos); @@ -1877,7 +1877,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) { checkListCommands(rsp, "config-write"); checkListCommands(rsp, "interface-list"); checkListCommands(rsp, "interface-redetect"); - checkListCommands(rsp, "interface-use"); + checkListCommands(rsp, "interface-add"); checkListCommands(rsp, "kea-lfc-start"); checkListCommands(rsp, "list-commands"); checkListCommands(rsp, "leases-reclaim"); @@ -2549,8 +2549,8 @@ TEST_F(CtrlChannelDhcpv6SrvTest, interfaceRedetect) { EXPECT_EQ(response, expected); } -// Tests if interface-use works properly. -TEST_F(CtrlChannelDhcpv6SrvTest, interfaceUse) { +// Tests if interface-add works properly. +TEST_F(CtrlChannelDhcpv6SrvTest, interfaceAdd) { interfaces_ = ""; IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX, "11:22:33:44:55:66"); @@ -2573,7 +2573,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, interfaceUse) { SKIP_IF(skipped_); std::string response; - std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; + std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; sendUnixCommand(command, response); EXPECT_EQ(response, "{ \"result\": 0, \"text\": \"Configuration successful.\" }"); diff --git a/src/bin/dhcp6/tests/http_control_socket_unittest.cc b/src/bin/dhcp6/tests/http_control_socket_unittest.cc index 5d66fa0f2d..f532cae51c 100644 --- a/src/bin/dhcp6/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp6/tests/http_control_socket_unittest.cc @@ -590,8 +590,8 @@ public: // Tests if interface-redetect works properly. void testInterfaceRedetect(); - // Tests if interface-use works properly. - void testInterfaceUse(); + // Tests if interface-add works properly. + void testInterfaceAdd(); // This test verifies that disable DHCP service command performs // sanity check on parameters. @@ -2980,7 +2980,7 @@ BaseCtrlChannelDhcpv6Test::testListCommands() { checkListCommands(rsp, "config-write"); checkListCommands(rsp, "interface-list"); checkListCommands(rsp, "interface-redetect"); - checkListCommands(rsp, "interface-use"); + checkListCommands(rsp, "interface-add"); checkListCommands(rsp, "kea-lfc-start"); checkListCommands(rsp, "list-commands"); checkListCommands(rsp, "leases-reclaim"); @@ -3772,9 +3772,9 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, interfaceRedetect) { testInterfaceRedetect(); } -// Tests if interface-use works properly. +// Tests if interface-add works properly. void -BaseCtrlChannelDhcpv6Test::testInterfaceUse() { +BaseCtrlChannelDhcpv6Test::testInterfaceAdd() { interfaces_ = ""; IfacePtr eth0 = IfaceMgrTestConfig::createIface("eth0", ETH0_INDEX, "11:22:33:44:55:66"); @@ -3796,7 +3796,7 @@ BaseCtrlChannelDhcpv6Test::testInterfaceUse() { IfaceMgr::instance().setPacketFilter(filter); std::string response; - std::string command = "{ \"command\": \"interface-use\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; + std::string command = "{ \"command\": \"interface-add\", \"arguments\": { \"interfaces\": [ \"eth0\" ] } }"; sendHttpCommand(command, response); EXPECT_EQ(response, "[ { \"result\": 0, \"text\": \"Configuration successful.\" } ]"); @@ -3819,12 +3819,12 @@ BaseCtrlChannelDhcpv6Test::testInterfaceUse() { EXPECT_EQ(response, expected); } -TEST_F(HttpCtrlChannelDhcpv6Test, interfaceUse) { - testInterfaceUse(); +TEST_F(HttpCtrlChannelDhcpv6Test, interfaceAdd) { + testInterfaceAdd(); } -TEST_F(HttpsCtrlChannelDhcpv6Test, interfaceUse) { - testInterfaceUse(); +TEST_F(HttpsCtrlChannelDhcpv6Test, interfaceAdd) { + testInterfaceAdd(); } // This test verifies that disable DHCP service command performs diff --git a/src/bin/shell/tests/dhcp4_basic_auth_tests.sh.in b/src/bin/shell/tests/dhcp4_basic_auth_tests.sh.in index b2cd1a8915..6b56adab54 100755 --- a/src/bin/shell/tests/dhcp4_basic_auth_tests.sh.in +++ b/src/bin/shell/tests/dhcp4_basic_auth_tests.sh.in @@ -229,7 +229,7 @@ shell_command_test "shell.bad-auth" \ "Failed to run: HTTP Error 401: Unauthorized" shell_command_test "shell.authorized" \ "--auth-user pet --auth-password meow" "list-commands" "" \ - "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" + "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" shell_command_test "shell.bad-auth-password-file" \ "--auth-user foo --auth-password-file foobar" "list-commands" "fail" \ "Failed to run: [Errno 2] No such file or directory: 'foobar'" @@ -238,7 +238,7 @@ shell_command_test "shell.bad-auth-password-file-content" \ "Failed to run: HTTP Error 401: Unauthorized" shell_command_test "shell.good-auth-password-file-content" \ "--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \ - "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" + "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" shell_command_test "shell.flag-precedence" \ "--auth-user pet --auth-password meow --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \ "Failed to run: HTTP Error 401: Unauthorized" diff --git a/src/bin/shell/tests/dhcp6_basic_auth_tests.sh.in b/src/bin/shell/tests/dhcp6_basic_auth_tests.sh.in index df7a816977..7cee3fab14 100755 --- a/src/bin/shell/tests/dhcp6_basic_auth_tests.sh.in +++ b/src/bin/shell/tests/dhcp6_basic_auth_tests.sh.in @@ -234,7 +234,7 @@ shell_command_test "shell.bad-auth" \ "Failed to run: HTTP Error 401: Unauthorized" shell_command_test "shell.authorized" \ "--auth-user pet --auth-password meow" "list-commands" "" \ - "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" + "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" shell_command_test "shell.bad-auth-password-file" \ "--auth-user foo --auth-password-file foobar" "list-commands" "fail" \ "Failed to run: [Errno 2] No such file or directory: 'foobar'" @@ -243,7 +243,7 @@ shell_command_test "shell.bad-auth-password-file-content" \ "Failed to run: HTTP Error 401: Unauthorized" shell_command_test "shell.good-auth-password-file-content" \ "--auth-user pet --auth-password-file ${tmpfile_path}/auth_password_file" "list-commands" "" \ - "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" + "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" shell_command_test "shell.flag-precedence" \ "--auth-user pet --auth-password meow --auth-password-file ${tmpfile_path}/auth_bad_password_file" "list-commands" "fail" \ "Failed to run: HTTP Error 401: Unauthorized" diff --git a/src/bin/shell/tests/shell_dhcp4_process_tests.sh.in b/src/bin/shell/tests/shell_dhcp4_process_tests.sh.in index 3bc1968968..4b40deeb64 100755 --- a/src/bin/shell/tests/shell_dhcp4_process_tests.sh.in +++ b/src/bin/shell/tests/shell_dhcp4_process_tests.sh.in @@ -195,7 +195,7 @@ shell_command_test() { } shell_command_test "shell.list-commands" "list-commands" \ - "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" "" + "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" "" shell_command_test "shell.bogus" "give-me-a-beer" \ "[ { \"result\": 2, \"text\": \"'give-me-a-beer' command not supported.\" } ]" "" shell_command_test "shell.empty-config-test" "config-test" \ diff --git a/src/bin/shell/tests/shell_dhcp6_process_tests.sh.in b/src/bin/shell/tests/shell_dhcp6_process_tests.sh.in index 12d672e127..70b9760bdb 100755 --- a/src/bin/shell/tests/shell_dhcp6_process_tests.sh.in +++ b/src/bin/shell/tests/shell_dhcp6_process_tests.sh.in @@ -200,7 +200,7 @@ shell_command_test() { } shell_command_test "shell.list-commands" "list-commands" \ - "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" "" + "[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" "" shell_command_test "shell.bogus" "give-me-a-beer" \ "[ { \"result\": 2, \"text\": \"'give-me-a-beer' command not supported.\" } ]" "" shell_command_test "shell.empty-config-test" "config-test" \ diff --git a/src/bin/shell/tests/tls_dhcp4_process_tests.sh.in b/src/bin/shell/tests/tls_dhcp4_process_tests.sh.in index 882020e751..f51ae35104 100755 --- a/src/bin/shell/tests/tls_dhcp4_process_tests.sh.in +++ b/src/bin/shell/tests/tls_dhcp4_process_tests.sh.in @@ -306,10 +306,10 @@ list_commands_test() { } list_commands_test "NoTLS" "${CONFIG_NONE}" "" \ -"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" +"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" list_commands_test "Encrypted" "${CONFIG_NOCR}" \ "--ca ${TEST_CA_DIR}/kea-ca.crt" \ -"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" +"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" list_commands_test "Authenticated" "${CONFIG}" \ "--ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt --key ${TEST_CA_DIR}/kea-client.key" \ -"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" +"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet4-select-test\", \"subnet4o6-select-test\", \"version-get\" ], \"result\": 0 } ]" diff --git a/src/bin/shell/tests/tls_dhcp6_process_tests.sh.in b/src/bin/shell/tests/tls_dhcp6_process_tests.sh.in index 0c194c279a..0196bad6c3 100755 --- a/src/bin/shell/tests/tls_dhcp6_process_tests.sh.in +++ b/src/bin/shell/tests/tls_dhcp6_process_tests.sh.in @@ -321,10 +321,10 @@ list_commands_test() { } list_commands_test "NoTLS" "${CONFIG_NONE}" "" \ -"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" +"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" list_commands_test "Encrypted" "${CONFIG_NOCR}" \ "--ca ${TEST_CA_DIR}/kea-ca.crt" \ -"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" +"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" list_commands_test "Authenticated" "${CONFIG}" \ "--ca ${TEST_CA_DIR}/kea-ca.crt --cert ${TEST_CA_DIR}/kea-client.crt --key ${TEST_CA_DIR}/kea-client.key" \ -"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-use\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" +"[ { \"arguments\": [ \"build-report\", \"config-backend-pull\", \"config-get\", \"config-hash-get\", \"config-reload\", \"config-set\", \"config-test\", \"config-write\", \"dhcp-disable\", \"dhcp-enable\", \"interface-list\", \"interface-redetect\", \"interface-add\", \"kea-lfc-start\", \"leases-reclaim\", \"list-commands\", \"server-tag-get\", \"shutdown\", \"statistic-get\", \"statistic-get-all\", \"statistic-global-get-all\", \"statistic-remove\", \"statistic-remove-all\", \"statistic-reset\", \"statistic-reset-all\", \"statistic-sample-age-set\", \"statistic-sample-age-set-all\", \"statistic-sample-count-set\", \"statistic-sample-count-set-all\", \"status-get\", \"subnet6-select-test\", \"version-get\" ], \"result\": 0 } ]" diff --git a/src/lib/dhcpsrv/cfg_iface.cc b/src/lib/dhcpsrv/cfg_iface.cc index c07ef0c4ff..b7ff6277b2 100644 --- a/src/lib/dhcpsrv/cfg_iface.cc +++ b/src/lib/dhcpsrv/cfg_iface.cc @@ -102,6 +102,8 @@ CfgIface::triggerOpenSocketsWithRetry(const uint16_t family, const uint16_t port // we only handle the relayed (unicast) traffic. const bool can_use_bcast = use_bcast && (socket_type_ == SOCKET_RAW); + reconnect_ctl_->resetRetries(); + openSocketsWithRetry(reconnect_ctl_, family, port, can_use_bcast); } diff --git a/src/share/api/interface-use.json b/src/share/api/interface-add.json similarity index 84% rename from src/share/api/interface-use.json rename to src/share/api/interface-add.json index 126f5932ee..df9311c894 100644 --- a/src/share/api/interface-use.json +++ b/src/share/api/interface-add.json @@ -9,14 +9,14 @@ ], "cmd-syntax": [ "{", - " \"command\": \"interface-use\",", + " \"command\": \"interface-add\",", " \"arguments\": {", " \"interfaces\": [ \"eth0/10.10.1.1\", \"eth0/192.168.1.1\", \"eth1\"]", " }", "}" ], - "description": "See ", - "name": "interface-use", + "description": "See ", + "name": "interface-add", "resp-syntax": [ "{", " \"result\": 0,",