fix(userspace/falco): inizialize options variables

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2024-05-08 13:13:21 +00:00 committed by poiana
parent c6e3cfd115
commit b2e4cddcdf
2 changed files with 20 additions and 39 deletions

View File

@ -26,25 +26,6 @@ limitations under the License.
namespace falco { namespace falco {
namespace app { namespace app {
// Most bool member variables do not need to be set explicitly, as
// they are bound to command line options that have default
// values. However, a few options can be ifdef'd out so explicitly
// initialize their linked variables.
options::options()
: event_buffer_format(sinsp_evt::PF_NORMAL),
list_fields(false),
list_plugins(false),
list_syscall_events(false),
markdown(false),
unbuffered_outputs(false),
dry_run(false)
{
}
options::~options()
{
}
bool options::parse(int argc, char **argv, std::string &errstr) bool options::parse(int argc, char **argv, std::string &errstr)
{ {
cxxopts::Options opts("falco", "Falco - Cloud Native Runtime Security"); cxxopts::Options opts("falco", "Falco - Cloud Native Runtime Security");

View File

@ -31,50 +31,50 @@ namespace app {
class options { class options {
public: public:
options(); options() = default;
virtual ~options(); ~options() = default;
options(options&&) = default; options(options&&) = default;
options& operator = (options&&) = default; options& operator = (options&&) = default;
options(const options&) = default; options(const options&) = default;
options& operator = (const options&) = default; options& operator = (const options&) = default;
// Each of these maps directly to a command line option. // Each of these maps directly to a command line option.
bool help; bool help = false;
std::string conf_filename; std::string conf_filename;
bool all_events; bool all_events = false;
sinsp_evt::param_fmt event_buffer_format; sinsp_evt::param_fmt event_buffer_format = sinsp_evt::PF_NORMAL;
std::vector<std::string> cri_socket_paths; std::vector<std::string> cri_socket_paths;
bool disable_cri_async; bool disable_cri_async = false;
std::vector<std::string> disable_sources; std::vector<std::string> disable_sources;
std::vector<std::string> disabled_rule_substrings; std::vector<std::string> disabled_rule_substrings;
std::vector<std::string> enable_sources; std::vector<std::string> enable_sources;
std::string gvisor_generate_config_with_socket; std::string gvisor_generate_config_with_socket;
bool describe_all_rules; bool describe_all_rules = false;
std::string describe_rule; std::string describe_rule;
bool print_ignored_events; bool print_ignored_events;
bool list_fields; bool list_fields = false;
std::string list_source_fields; std::string list_source_fields;
bool list_plugins; bool list_plugins = false;
std::string print_plugin_info; std::string print_plugin_info;
bool list_syscall_events; bool list_syscall_events = false;
bool markdown; bool markdown = false;
int duration_to_tot; int duration_to_tot = 0;
bool names_only; bool names_only = false;
std::vector<std::string> cmdline_config_options; std::vector<std::string> cmdline_config_options;
std::string print_additional; std::string print_additional;
std::string pidfilename; std::string pidfilename;
// Rules list as passed by the user, via cmdline option '-r' // Rules list as passed by the user, via cmdline option '-r'
std::list<std::string> rules_filenames; std::list<std::string> rules_filenames;
uint64_t snaplen; uint64_t snaplen = 0;
bool print_support; bool print_support = false;
std::set<std::string> disabled_rule_tags; std::set<std::string> disabled_rule_tags;
std::set<std::string> enabled_rule_tags; std::set<std::string> enabled_rule_tags;
bool unbuffered_outputs; bool unbuffered_outputs = false;
std::vector<std::string> validate_rules_filenames; std::vector<std::string> validate_rules_filenames;
bool verbose; bool verbose = false;
bool print_version_info; bool print_version_info = false;
bool print_page_size; bool print_page_size = false;
bool dry_run; bool dry_run = false;
bool parse(int argc, char **argv, std::string &errstr); bool parse(int argc, char **argv, std::string &errstr);