From 071e7dff17302ef228b3bd1ac0ec23e414a87290 Mon Sep 17 00:00:00 2001 From: Grzegorz Nosek Date: Mon, 13 Aug 2018 18:24:45 +0200 Subject: [PATCH] Allow Lua sample_dir to be passed to falco_engine constructor FALCO_ENGINE_SOURCE_LUA_DIR is still the default but can be overridden now. --- userspace/engine/falco_engine.cpp | 4 ++-- userspace/engine/falco_engine.h | 3 ++- userspace/falco/CMakeLists.txt | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index 511407cb..f9c86c78 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -39,7 +39,7 @@ string lua_print_stats = "print_stats"; using namespace std; -falco_engine::falco_engine(bool seed_rng) +falco_engine::falco_engine(bool seed_rng, const std::string& source_dir) : m_rules(NULL), m_next_ruleset_id(0), m_min_priority(falco_common::PRIORITY_DEBUG), m_sampling_ratio(1), m_sampling_multiplier(0), @@ -48,7 +48,7 @@ falco_engine::falco_engine(bool seed_rng) luaopen_lpeg(m_ls); luaopen_yaml(m_ls); - falco_common::init(m_lua_main_filename.c_str(), FALCO_ENGINE_SOURCE_LUA_DIR); + falco_common::init(m_lua_main_filename.c_str(), source_dir.c_str()); falco_rules::init(m_ls); m_evttype_filter.reset(new sinsp_evttype_filter()); diff --git a/userspace/engine/falco_engine.h b/userspace/engine/falco_engine.h index e19fb6e5..abf0ac84 100644 --- a/userspace/engine/falco_engine.h +++ b/userspace/engine/falco_engine.h @@ -27,6 +27,7 @@ along with falco. If not, see . #include "rules.h" +#include "config_falco_engine.h" #include "falco_common.h" // @@ -38,7 +39,7 @@ along with falco. If not, see . class falco_engine : public falco_common { public: - falco_engine(bool seed_rng=true); + falco_engine(bool seed_rng=true, const std::string& rules_dir=FALCO_ENGINE_SOURCE_LUA_DIR); virtual ~falco_engine(); // diff --git a/userspace/falco/CMakeLists.txt b/userspace/falco/CMakeLists.txt index 3ef7d868..736f6043 100644 --- a/userspace/falco/CMakeLists.txt +++ b/userspace/falco/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories("${PROJECT_SOURCE_DIR}/../sysdig/userspace/libscap") include_directories("${PROJECT_SOURCE_DIR}/../sysdig/userspace/libsinsp") include_directories("${PROJECT_SOURCE_DIR}/userspace/engine") include_directories("${PROJECT_BINARY_DIR}/userspace/falco") +include_directories("${PROJECT_BINARY_DIR}/userspace/engine") include_directories("${CURL_INCLUDE_DIR}") include_directories("${YAMLCPP_INCLUDE_DIR}") include_directories("${DRAIOS_DEPENDENCIES_DIR}/yaml-${DRAIOS_YAML_VERSION}/target/include")