diff --git a/doc/sphinx/arm/agent.rst b/doc/sphinx/arm/agent.rst index 3dc0118d24..86c6df681e 100644 --- a/doc/sphinx/arm/agent.rst +++ b/doc/sphinx/arm/agent.rst @@ -179,7 +179,7 @@ password these values can be read from files. The syntax was extended by: - The ``directory`` authentication parameter which handles the common part of file paths. By default the value is the empty string. -- The``password-file`` client parameter which with the ``directory`` +- The ``password-file`` client parameter which with the ``directory`` parameter specifies the path of a file where the password or when no user ID is given the whole basic HTTP authentication secret before encoding can be read. @@ -388,25 +388,22 @@ Starting and Stopping the Control Agent is a copy of the ``config.report`` file produced by ``./configure``; it is embedded in the executable binary. -The ``config.report`` file may also be accessed directly, via the -following command. The binary ``path`` may be found in the install -directory or in the ``.libs`` subdirectory in the source tree. For -example: ``kea/src/lib/process/.libs/``. + The contents of the ``config.report`` file may also be accessed by examining + certain libraries in the installation tree or in the source tree. -:: + .. code-block:: shell - strings path/libkea-process.so | sed -n 's/;;;; //p' + # from installation using libkea-process.so + $ strings ${prefix}/lib/libkea-process.so | sed -n 's/;;;; //p' -:: + # from sources using libkea-process.so + $ strings src/lib/process/.libs/libkea-process.so | sed -n 's/;;;; //p' - strings path/libkea-process.a | sed -n 's/;;;; //p' + # from sources using libkea-process.a + $ strings src/lib/process/.libs/libkea-process.a | sed -n 's/;;;; //p' -The libcfgrpt.a library can also be used from the source tree with path: -``src/lib/process/cfgrpt/.libs/``. - -:: - - strings path/libcfgrpt.a | sed -n 's/;;;; //p' + # from sources using libcfgrpt.a + $ strings src/lib/process/cfgrpt/.libs/libcfgrpt.a | sed -n 's/;;;; //p' The CA is started by running its binary and specifying the configuration file it should use. For example: diff --git a/doc/sphinx/arm/ddns.rst b/doc/sphinx/arm/ddns.rst index 8e2bd844ae..85373edefe 100644 --- a/doc/sphinx/arm/ddns.rst +++ b/doc/sphinx/arm/ddns.rst @@ -138,25 +138,22 @@ directly. It accepts the following command-line switches: messages to standard output and errors to standard error when testing the configuration. -The ``config.report`` file may also be accessed directly, via the -following command. The binary ``path`` may be found in the install -directory or in the ``.libs`` subdirectory in the source tree. For -example: ``kea/src/lib/process/.libs/``. + The contents of the ``config.report`` file may also be accessed by examining + certain libraries in the installation tree or in the source tree. -:: + .. code-block:: shell - strings path/libkea-process.so | sed -n 's/;;;; //p' + # from installation using libkea-process.so + $ strings ${prefix}/lib/libkea-process.so | sed -n 's/;;;; //p' -:: + # from sources using libkea-process.so + $ strings src/lib/process/.libs/libkea-process.so | sed -n 's/;;;; //p' - strings path/libkea-process.a | sed -n 's/;;;; //p' + # from sources using libkea-process.a + $ strings src/lib/process/.libs/libkea-process.a | sed -n 's/;;;; //p' -The libcfgrpt.a library can also be used from the source tree with path: -``src/lib/process/cfgrpt/.libs/``. - -:: - - strings path/libcfgrpt.a | sed -n 's/;;;; //p' + # from sources using libcfgrpt.a + $ strings src/lib/process/cfgrpt/.libs/libcfgrpt.a | sed -n 's/;;;; //p' Upon startup, the module loads its configuration and begins listening for NCRs based on that configuration. diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index ee74e38b39..8ddf548f9e 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -43,9 +43,10 @@ the following command-line switches: server. - ``-T file`` - specifies a configuration file to be tested. ``kea-dhcp4`` - loads it, checks it, and exits. It performs extra checks beside ``-t`` is - doing, like establising database connections (lease db, host db, CB db, - forensic logging db), hook libraries loading and configuration parsing, etc. + loads it, checks it, and exits. It performs extra checks beside what ``-t`` + is doing, like establising database connections (lease backend, + host reservations backend, configuration backend and forensic logging + backend), hook libraries loading and configuration parsing, etc. It does not open unix or TCP/UDP sockets, neither does it open or rotate files, as all these actions could interfere with a running process on the same machine. @@ -60,25 +61,22 @@ the following command-line switches: is a copy of the ``config.report`` file produced by ``./configure``; it is embedded in the executable binary. -The ``config.report`` file may also be accessed directly, via the -following command. The binary ``path`` may be found in the install -directory or in the ``.libs`` subdirectory in the source tree. For -example: ``kea/src/lib/process/.libs/``. + The contents of the ``config.report`` file may also be accessed by examining + certain libraries in the installation tree or in the source tree. -:: + .. code-block:: shell - strings path/libkea-process.so | sed -n 's/;;;; //p' + # from installation using libkea-process.so + $ strings ${prefix}/lib/libkea-process.so | sed -n 's/;;;; //p' -:: + # from sources using libkea-process.so + $ strings src/lib/process/.libs/libkea-process.so | sed -n 's/;;;; //p' - strings path/libkea-process.a | sed -n 's/;;;; //p' + # from sources using libkea-process.a + $ strings src/lib/process/.libs/libkea-process.a | sed -n 's/;;;; //p' -The libcfgrpt.a library can also be used from the source tree with path: -``src/lib/process/cfgrpt/.libs/``. - -:: - - strings path/libcfgrpt.a | sed -n 's/;;;; //p' + # from sources using libcfgrpt.a + $ strings src/lib/process/cfgrpt/.libs/libcfgrpt.a | sed -n 's/;;;; //p' On startup, the server detects available network interfaces and attempts to open UDP sockets on all interfaces listed in the diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index d8ca1203a8..3c8762f358 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -42,10 +42,11 @@ the following command-line switches: comprehensive; certain checks are possible only when running the server. -- ``-T file`` - specifies a configuration file to be tested. ``kea-dhcp4`` - loads it, checks it, and exits. It performs extra checks beside ``-t`` is - doing, like establising database connections (lease db, host db, CB db, - forensic logging db), hook libraries loading and configuration parsing, etc. +- ``-T file`` - specifies a configuration file to be tested. ``kea-dhcp6`` + loads it, checks it, and exits. It performs extra checks beside what ``-t`` + is doing, like establising database connections (lease backend, + host reservations backend, configuration backend and forensic logging + backend), hook libraries loading and configuration parsing, etc. It does not open unix or TCP/UDP sockets, neither does it open or rotate files, as all these actions could interfere with a running process on the same machine. @@ -60,25 +61,22 @@ the following command-line switches: is a copy of the ``config.report`` file produced by ``./configure``; it is embedded in the executable binary. -The ``config.report`` file may also be accessed directly, via the -following command. The binary ``path`` may be found in the install -directory or in the ``.libs`` subdirectory in the source tree. For -example: ``kea/src/lib/process/.libs/``. + The contents of the ``config.report`` file may also be accessed by examining + certain libraries in the installation tree or in the source tree. -:: + .. code-block:: shell - strings path/libkea-process.so | sed -n 's/;;;; //p' + # from installation using libkea-process.so + $ strings ${prefix}/lib/libkea-process.so | sed -n 's/;;;; //p' -:: + # from sources using libkea-process.so + $ strings src/lib/process/.libs/libkea-process.so | sed -n 's/;;;; //p' - strings path/libkea-process.a | sed -n 's/;;;; //p' + # from sources using libkea-process.a + $ strings src/lib/process/.libs/libkea-process.a | sed -n 's/;;;; //p' -The libcfgrpt.a library can also be used from the source tree with path: -``src/lib/process/cfgrpt/.libs/``. - -:: - - strings path/libcfgrpt.a | sed -n 's/;;;; //p' + # from sources using libcfgrpt.a + $ strings src/lib/process/cfgrpt/.libs/libcfgrpt.a | sed -n 's/;;;; //p' On startup, the server detects available network interfaces and attempts to open UDP sockets on all interfaces listed in the @@ -1100,8 +1098,8 @@ gives the range of addresses in the pool. It is possible to define more than one pool in a subnet; continuing the previous example, further assume that 2001:db8:1:0:5::/80 should also be managed by the server. It could be written as 2001:db8:1:0:5:: to -2001:db8:1::5:ffff:ffff:ffff, but typing so many ``f``s is cumbersome. It -can be expressed more simply as 2001:db8:1:0:5::/80. Both formats are +2001:db8:1::5:ffff:ffff:ffff, but typing so many ``f`` characters is cumbersome. +It can be expressed more simply as 2001:db8:1:0:5::/80. Both formats are supported by ``Dhcp6`` and can be mixed in the pool list. For example, the following pools could be defined: diff --git a/doc/sphinx/arm/ext-netconf.rst b/doc/sphinx/arm/ext-netconf.rst index f4bc9922cf..1118dbe2fe 100644 --- a/doc/sphinx/arm/ext-netconf.rst +++ b/doc/sphinx/arm/ext-netconf.rst @@ -686,25 +686,22 @@ Starting and Stopping the NETCONF Agent is a copy of the ``config.report`` file produced by ``./configure``; it is embedded in the executable binary. -The ``config.report`` file may also be accessed directly, via the -following command. The binary ``path`` may be found in the install -directory or in the ``.libs`` subdirectory in the source tree. For -example: ``kea/src/lib/process/.libs/``. + The contents of the ``config.report`` file may also be accessed by examining + certain libraries in the installation tree or in the source tree. -:: + .. code-block:: shell - strings path/libkea-process.so | sed -n 's/;;;; //p' + # from installation using libkea-process.so + $ strings ${prefix}/lib/libkea-process.so | sed -n 's/;;;; //p' -:: + # from sources using libkea-process.so + $ strings src/lib/process/.libs/libkea-process.so | sed -n 's/;;;; //p' - strings path/libkea-process.a | sed -n 's/;;;; //p' + # from sources using libkea-process.a + $ strings src/lib/process/.libs/libkea-process.a | sed -n 's/;;;; //p' -The libcfgrpt.a library can also be used from the source tree with path: -``src/lib/process/cfgrpt/.libs/``. - -:: - - strings path/libcfgrpt.a | sed -n 's/;;;; //p' + # from sources using libcfgrpt.a + $ strings src/lib/process/cfgrpt/.libs/libcfgrpt.a | sed -n 's/;;;; //p' .. _operation-example: diff --git a/doc/sphinx/arm/hooks-lease-cmds.rst b/doc/sphinx/arm/hooks-lease-cmds.rst index a818230965..9a5f90712a 100644 --- a/doc/sphinx/arm/hooks-lease-cmds.rst +++ b/doc/sphinx/arm/hooks-lease-cmds.rst @@ -783,7 +783,7 @@ The ``lease4-del``, ``lease6-del`` Commands ``lease4-del`` and ``lease6-del`` can be used to delete a lease from the lease database. There are two types of parameters these commands support, similar to the -``lease4-get``and ``lease6-get`` commands: (``address``) for both v4 and v6, (``subnet-id``, +``lease4-get`` and ``lease6-get`` commands: (``address``) for both v4 and v6, (``subnet-id``, ``identifier-type``, ``identifier``) for v4, and (``subnet-id``, ``identifier-type``, ``identifier``, ``type``, ``IAID``) for v6. The first type of query is used when the address (either IPv4 or IPv6) is known, but the details of the lease are diff --git a/doc/sphinx/man/kea-dhcp4.8.rst b/doc/sphinx/man/kea-dhcp4.8.rst index 1061720dd0..ee01e622fe 100644 --- a/doc/sphinx/man/kea-dhcp4.8.rst +++ b/doc/sphinx/man/kea-dhcp4.8.rst @@ -51,8 +51,9 @@ The arguments are as follows: ``-T config-file`` Checks the configuration file and reports the first error, if any. - It performs extra checks beside ``-t`` is doing, like establising database - connections (lease db, host db, CB db, forensic logging db), hook libraries + It performs extra checks beside what ``-t`` is doing, like establising + database connections (lease backend, host reservations backend, configuration + backend and forensic logging backend), hook libraries loading and configuration parsing, etc. It does not open unix or TCP/UDP sockets, neither does it open or rotate files, as all these actions could interfere with a running process on the same machine. diff --git a/doc/sphinx/man/kea-dhcp6.8.rst b/doc/sphinx/man/kea-dhcp6.8.rst index 86e2dc1d4f..696f67114b 100644 --- a/doc/sphinx/man/kea-dhcp6.8.rst +++ b/doc/sphinx/man/kea-dhcp6.8.rst @@ -51,8 +51,9 @@ The arguments are as follows: ``-T config-file`` Checks the configuration file and reports the first error, if any. - It performs extra checks beside ``-t`` is doing, like establising database - connections (lease db, host db, CB db, forensic logging db), hook libraries + It performs extra checks beside what ``-t`` is doing, like establising + database connections (lease backend, host reservations backend, configuration + backend and forensic logging backend), hook libraries loading and configuration parsing, etc. It does not open unix or TCP/UDP sockets, neither does it open or rotate files, as all these actions could interfere with a running process on the same machine. diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index b60f0d033c..5891e157d1 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -757,7 +757,45 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set, SrvConfigPtr srv_config; if (status_code == CONTROL_RESULT_SUCCESS) { - if (!check_only) { + if (check_only) { + if (extra_checks) { + // Re-open lease and host database with new parameters. + try { + // Get the staging configuration. + srv_config = CfgMgr::instance().getStagingCfg(); + + CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); + string params = "universe=4 persist=false"; + if (cfg_db->getExtendedInfoTablesEnabled()) { + params += " extended-info-tables=true"; + } + cfg_db->setAppendedParameters(params); + cfg_db->createManagers(); + } catch (const std::exception& ex) { + answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what()); + status_code = CONTROL_RESULT_ERROR; + } + + if (status_code == CONTROL_RESULT_SUCCESS) { + std::ostringstream err; + // Configure DHCP packet queueing + try { + data::ConstElementPtr qc; + qc = CfgMgr::instance().getStagingCfg()->getDHCPQueueControl(); + if (IfaceMgr::instance().configureDHCPPacketQueue(AF_INET, qc)) { + LOG_INFO(dhcp4_logger, DHCP4_CONFIG_PACKET_QUEUE) + .arg(IfaceMgr::instance().getPacketQueue4()->getInfoStr()); + } + + } catch (const std::exception& ex) { + err << "Error setting packet queue controls after server reconfiguration: " + << ex.what(); + answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str()); + status_code = CONTROL_RESULT_ERROR; + } + } + } + } else { string parameter_name; ElementPtr mutable_cfg; @@ -805,25 +843,6 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set, " processing error"); status_code = CONTROL_RESULT_ERROR; } - } else { - if (extra_checks) { - // Re-open lease and host database with new parameters. - try { - // Get the staging configuration. - srv_config = CfgMgr::instance().getStagingCfg(); - - CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); - string params = "universe=4 persist=false"; - if (cfg_db->getExtendedInfoTablesEnabled()) { - params += " extended-info-tables=true"; - } - cfg_db->setAppendedParameters(params); - cfg_db->createManagers(); - } catch (const std::exception& ex) { - answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what()); - status_code = CONTROL_RESULT_ERROR; - } - } } } @@ -897,13 +916,9 @@ configureDhcp4Server(Dhcpv4Srv& server, isc::data::ConstElementPtr config_set, // Moved from the commit block to add the config backend indication. if (status_code == CONTROL_RESULT_SUCCESS && (!check_only || extra_checks)) { try { - if (extra_checks) { - server.getCBControl()->databaseConfigConnect(srv_config); - } else { - // If there are config backends, fetch and merge into staging config - server.getCBControl()->databaseConfigFetch(srv_config, - CBControlDHCPv4::FetchMode::FETCH_ALL); - } + // If there are config backends, fetch and merge into staging config + server.getCBControl()->databaseConfigFetch(srv_config, + CBControlDHCPv4::FetchMode::FETCH_ALL); } catch (const isc::Exception& ex) { std::ostringstream err; err << "during update from config backend database: " << ex.what(); diff --git a/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in b/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in index 82f250299f..e7aa68790b 100644 --- a/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in +++ b/src/bin/dhcp4/tests/dhcp4_process_tests.sh.in @@ -289,22 +289,16 @@ syntax_check_test() { local test_name="${1}" local config="${2}" local expected_code="${3}" - local extra_check="${4}" + local check_type="${4}" # Log the start of the test and print test name. test_start "${test_name}" # Create correct configuration file. create_config "${config}" # Check it - if [ "${extra_check}" -eq 1 ]; then - printf "Running command %s.\n" "\"${bin_path}/${bin} -T ${CFG_FILE}\"" - run_command \ - "${bin_path}/${bin}" -T "${CFG_FILE}" - else - printf "Running command %s.\n" "\"${bin_path}/${bin} -t ${CFG_FILE}\"" - run_command \ - "${bin_path}/${bin}" -t "${CFG_FILE}" - fi + printf "Running command %s.\n" "\"${bin_path}/${bin} ${check_type} ${CFG_FILE}\"" + run_command \ + "${bin_path}/${bin}" "${check_type}" "${CFG_FILE}" if [ "${EXIT_CODE}" -ne "${expected_code}" ]; then printf 'ERROR: expected exit code %s, got %s\n' "${expected_code}" "${EXIT_CODE}" clean_exit 1 @@ -583,9 +577,9 @@ shutdown_test "dhcpv4.sigint_test" 2 version_test "dhcpv4.version" logger_vars_test "dhcpv4.variables" lfc_timer_test -syntax_check_test "dhcpv4.syntax_check_success" "${CONFIG}" 0 0 -syntax_check_test "dhcpv4.syntax_check_bad_syntax" "${CONFIG_BAD_SYNTAX}" 1 0 -syntax_check_test "dhcpv4.syntax_check_bad_values" "${CONFIG_BAD_VALUES}" 1 0 -syntax_check_test "dhcpv4.syntax_check_hooks_load_fail" "${INVALID_CONFIG_HOOKS_LOAD}" 1 1 -syntax_check_test "dhcpv4.syntax_check_hooks_callout_fail" "${INVALID_CONFIG_HOOKS_CALLOUT_FAIL}" 1 1 +syntax_check_test "dhcpv4.syntax_check_success" "${CONFIG}" 0 -t +syntax_check_test "dhcpv4.syntax_check_bad_syntax" "${CONFIG_BAD_SYNTAX}" 1 -t +syntax_check_test "dhcpv4.syntax_check_bad_values" "${CONFIG_BAD_VALUES}" 1 -t +syntax_check_test "dhcpv4.syntax_check_hooks_load_fail" "${INVALID_CONFIG_HOOKS_LOAD}" 1 -T +syntax_check_test "dhcpv4.syntax_check_hooks_callout_fail" "${INVALID_CONFIG_HOOKS_CALLOUT_FAIL}" 1 -T password_redact_test "dhcpv4.password_redact_test" "$(kea_dhcp_config 4)" 0 diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 96cb4630d8..f7151afda1 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -886,7 +886,45 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, SrvConfigPtr srv_config; if (status_code == CONTROL_RESULT_SUCCESS) { - if (!check_only) { + if (check_only) { + if (extra_checks) { + // Re-open lease and host database with new parameters. + try { + // Get the staging configuration. + srv_config = CfgMgr::instance().getStagingCfg(); + + CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); + string params = "universe=6 persist=false"; + if (cfg_db->getExtendedInfoTablesEnabled()) { + params += " extended-info-tables=true"; + } + cfg_db->setAppendedParameters(params); + cfg_db->createManagers(); + } catch (const std::exception& ex) { + answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what()); + status_code = CONTROL_RESULT_ERROR; + } + + if (status_code == CONTROL_RESULT_SUCCESS) { + std::ostringstream err; + // Configure DHCP packet queueing + try { + data::ConstElementPtr qc; + qc = CfgMgr::instance().getStagingCfg()->getDHCPQueueControl(); + if (IfaceMgr::instance().configureDHCPPacketQueue(AF_INET6, qc)) { + LOG_INFO(dhcp6_logger, DHCP6_CONFIG_PACKET_QUEUE) + .arg(IfaceMgr::instance().getPacketQueue6()->getInfoStr()); + } + + } catch (const std::exception& ex) { + err << "Error setting packet queue controls after server reconfiguration: " + << ex.what(); + answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, err.str()); + status_code = CONTROL_RESULT_ERROR; + } + } + } + } else { string parameter_name; ElementPtr mutable_cfg; @@ -934,25 +972,6 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, " processing error"); status_code = CONTROL_RESULT_ERROR; } - } else { - if (extra_checks) { - // Re-open lease and host database with new parameters. - try { - // Get the staging configuration. - srv_config = CfgMgr::instance().getStagingCfg(); - - CfgDbAccessPtr cfg_db = CfgMgr::instance().getStagingCfg()->getCfgDbAccess(); - string params = "universe=6 persist=false"; - if (cfg_db->getExtendedInfoTablesEnabled()) { - params += " extended-info-tables=true"; - } - cfg_db->setAppendedParameters(params); - cfg_db->createManagers(); - } catch (const std::exception& ex) { - answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what()); - status_code = CONTROL_RESULT_ERROR; - } - } } } @@ -1026,13 +1045,9 @@ configureDhcp6Server(Dhcpv6Srv& server, isc::data::ConstElementPtr config_set, // Moved from the commit block to add the config backend indication. if (status_code == CONTROL_RESULT_SUCCESS && (!check_only || extra_checks)) { try { - if (extra_checks) { - server.getCBControl()->databaseConfigConnect(srv_config); - } else { - // If there are config backends, fetch and merge into staging config - server.getCBControl()->databaseConfigFetch(srv_config, - CBControlDHCPv6::FetchMode::FETCH_ALL); - } + // If there are config backends, fetch and merge into staging config + server.getCBControl()->databaseConfigFetch(srv_config, + CBControlDHCPv6::FetchMode::FETCH_ALL); } catch (const isc::Exception& ex) { std::ostringstream err; err << "during update from config backend database: " << ex.what(); diff --git a/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in b/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in index 9cd2bc6bc8..cf8252c136 100644 --- a/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in +++ b/src/bin/dhcp6/tests/dhcp6_process_tests.sh.in @@ -306,22 +306,16 @@ syntax_check_test() { local test_name="${1}" local config="${2}" local expected_code="${3}" - local extra_check="${4}" + local check_type="${4}" # Log the start of the test and print test name. test_start "${test_name}" # Create correct configuration file. create_config "${config}" # Check it - if [ "${extra_check}" -eq 1 ]; then - printf "Running command %s.\n" "\"${bin_path}/${bin} -T ${CFG_FILE}\"" - run_command \ - "${bin_path}/${bin}" -T "${CFG_FILE}" - else - printf "Running command %s.\n" "\"${bin_path}/${bin} -t ${CFG_FILE}\"" - run_command \ - "${bin_path}/${bin}" -t "${CFG_FILE}" - fi + printf "Running command %s.\n" "\"${bin_path}/${bin} ${check_type} ${CFG_FILE}\"" + run_command \ + "${bin_path}/${bin}" "${check_type}" "${CFG_FILE}" if [ "${EXIT_CODE}" -ne "${expected_code}" ]; then printf 'ERROR: expected exit code %s, got %s\n' "${expected_code}" "${EXIT_CODE}" clean_exit 1 @@ -603,9 +597,9 @@ shutdown_test "dhcpv6.sigint_test" 2 version_test "dhcpv6.version" logger_vars_test "dhcpv6.variables" lfc_timer_test -syntax_check_test "dhcpv6.syntax_check_success" "${CONFIG}" 0 0 -syntax_check_test "dhcpv6.syntax_check_bad_syntax" "${CONFIG_BAD_SYNTAX}" 1 0 -syntax_check_test "dhcpv6.syntax_check_bad_values" "${CONFIG_BAD_VALUES}" 1 0 -syntax_check_test "dhcpv6.syntax_check_hooks_load_fail" "${INVALID_CONFIG_HOOKS_LOAD}" 1 1 -syntax_check_test "dhcpv6.syntax_check_hooks_callout_fail" "${INVALID_CONFIG_HOOKS_CALLOUT_FAIL}" 1 1 +syntax_check_test "dhcpv6.syntax_check_success" "${CONFIG}" 0 -t +syntax_check_test "dhcpv6.syntax_check_bad_syntax" "${CONFIG_BAD_SYNTAX}" 1 -t +syntax_check_test "dhcpv6.syntax_check_bad_values" "${CONFIG_BAD_VALUES}" 1 -t +syntax_check_test "dhcpv6.syntax_check_hooks_load_fail" "${INVALID_CONFIG_HOOKS_LOAD}" 1 -T +syntax_check_test "dhcpv6.syntax_check_hooks_callout_fail" "${INVALID_CONFIG_HOOKS_CALLOUT_FAIL}" 1 -T password_redact_test "dhcpv6.password_redact_test" "$(kea_dhcp_config 6)" 0