diff --git a/unit_tests/falco/app/actions/test_load_config.cpp b/unit_tests/falco/app/actions/test_load_config.cpp index 51181e7f..78b55022 100644 --- a/unit_tests/falco/app/actions/test_load_config.cpp +++ b/unit_tests/falco/app/actions/test_load_config.cpp @@ -46,11 +46,10 @@ TEST(ActionLoadConfig, check_engine_config_is_correctly_parsed) EXPECT_TRUE(s.config->m_gvisor.m_config.empty()); EXPECT_TRUE(s.config->m_gvisor.m_root.empty()); - // Check that deprecated configs are not populated since we are using - // the new config. - EXPECT_EQ(s.config->m_syscall_buf_size_preset, 0); - EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 0); - EXPECT_FALSE(s.config->m_syscall_drop_failed_exit); + // Check that deprecated configs are always set since + EXPECT_EQ(s.config->m_syscall_buf_size_preset, 6); + EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 7); + EXPECT_TRUE(s.config->m_syscall_drop_failed_exit); } // Equal to the one above but checks that the command line options are not parsed @@ -82,11 +81,10 @@ TEST(ActionLoadConfig, check_command_line_options_are_not_used) EXPECT_TRUE(s.config->m_gvisor.m_config.empty()); EXPECT_TRUE(s.config->m_gvisor.m_root.empty()); - // Check that deprecated configs are not populated since we are using - // the new config. - EXPECT_EQ(s.config->m_syscall_buf_size_preset, 0); - EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 0); - EXPECT_FALSE(s.config->m_syscall_drop_failed_exit); + // Check that deprecated configs are always set since + EXPECT_EQ(s.config->m_syscall_buf_size_preset, 6); + EXPECT_EQ(s.config->m_cpus_for_each_syscall_buffer, 7); + EXPECT_TRUE(s.config->m_syscall_drop_failed_exit); } TEST(ActionLoadConfig, check_kmod_with_syscall_configs) diff --git a/userspace/falco/configuration.cpp b/userspace/falco/configuration.cpp index 9f39747f..c89f8c6b 100644 --- a/userspace/falco/configuration.cpp +++ b/userspace/falco/configuration.cpp @@ -124,6 +124,11 @@ void falco_configuration::load_engine_config(const std::string& config_name, con throw std::logic_error("Error reading config file (" + config_name + "): engine.kind '"+ driver_mode_str + "' is not a valid kind."); } + // Catch deprecated values from the config, to use them with the command line if needed + m_syscall_buf_size_preset = config.get_scalar("syscall_buf_size_preset", DEFAULT_BUF_SIZE_PRESET); + m_cpus_for_each_syscall_buffer = config.get_scalar("modern_bpf.cpus_for_each_syscall_buffer", DEFAULT_CPUS_FOR_EACH_SYSCALL_BUFFER); + m_syscall_drop_failed_exit = config.get_scalar("syscall_drop_failed_exit", DEFAULT_DROP_FAILED_EXIT); + switch (m_engine_mode) { case engine_kind_t::KMOD: @@ -178,11 +183,6 @@ void falco_configuration::load_engine_config(const std::string& config_name, con // Please note that `load_config` could be called more than one time during initialization // so the last time wins, the load config phase should be idempotent m_changes_in_engine_config = true; - - // Catch deprecated values from the config, to use them with the command line if needed - m_syscall_buf_size_preset = config.get_scalar("syscall_buf_size_preset", DEFAULT_BUF_SIZE_PRESET); - m_cpus_for_each_syscall_buffer = config.get_scalar("modern_bpf.cpus_for_each_syscall_buffer", DEFAULT_CPUS_FOR_EACH_SYSCALL_BUFFER); - m_syscall_drop_failed_exit = config.get_scalar("syscall_drop_failed_exit", DEFAULT_DROP_FAILED_EXIT); } void falco_configuration::load_yaml(const std::string& config_name, const yaml_helper& config)