From c743f1eb68c69dba25b93948d883e08413417a92 Mon Sep 17 00:00:00 2001 From: Loris Degioanni Date: Sun, 15 Mar 2020 14:34:19 -0700 Subject: [PATCH] feat(cli): adding -u to flip inspector method calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit udig support through the -u command line flag Signed-off-by: Kris Nóva Co-authored-by: Kris Nóva --- userspace/falco/falco.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/userspace/falco/falco.cpp b/userspace/falco/falco.cpp index 9a44da1c..31dac02a 100644 --- a/userspace/falco/falco.cpp +++ b/userspace/falco/falco.cpp @@ -443,6 +443,7 @@ int falco_init(int argc, char **argv) set disable_sources; bool disable_syscall = false; bool disable_k8s_audit = false; + bool udig = false; // Used for writing trace files int duration_seconds = 0; @@ -482,6 +483,7 @@ int falco_init(int argc, char **argv) {"stats-interval", required_argument, 0}, {"support", no_argument, 0}, {"unbuffered", no_argument, 0, 'U'}, + {"udig", no_argument, 0, 'u'}, {"validate", required_argument, 0, 'V'}, {"version", no_argument, 0, 0}, {"writefile", required_argument, 0, 'w'}, @@ -500,7 +502,7 @@ int falco_init(int argc, char **argv) // Parse the args // while((op = getopt_long(argc, argv, - "hc:AbdD:e:F:ik:K:Ll:m:M:No:P:p:r:S:s:T:t:UvV:w:", + "hc:AbdD:e:F:ik:K:Ll:m:M:No:P:p:r:S:s:T:t:UuvV:w:", long_options, &long_index)) != -1) { switch(op) @@ -607,6 +609,9 @@ int falco_init(int argc, char **argv) buffered_outputs = false; buffered_cmdline = true; break; + case 'u': + udig = true; + break; case 'v': verbose = true; break; @@ -1091,8 +1096,16 @@ int falco_init(int argc, char **argv) } else { - open_t open_cb = [](sinsp* inspector) { - inspector->open(); + open_t open_cb = [&udig](sinsp* inspector) + { + if(udig) + { + inspector->open_udig(); + } + else + { + inspector->open(); + } }; open_t open_nodriver_cb = [](sinsp* inspector) { inspector->open_nodriver();