From 77440750e6c367a5e3c54f5cd286a60226e855cb Mon Sep 17 00:00:00 2001 From: Henri DF Date: Mon, 4 Apr 2016 18:39:42 -0700 Subject: [PATCH] Load probe --- userspace/digwatch/config_digwatch.h.in | 1 + userspace/digwatch/digwatch.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/userspace/digwatch/config_digwatch.h.in b/userspace/digwatch/config_digwatch.h.in index 9f75ffb1..c29ede36 100644 --- a/userspace/digwatch/config_digwatch.h.in +++ b/userspace/digwatch/config_digwatch.h.in @@ -6,3 +6,4 @@ #define DIGWATCH_LUA_MAIN "${DIGWATCH_LUA_MAIN}" +#define PROBE_NAME "${PROBE_NAME}" diff --git a/userspace/digwatch/digwatch.cpp b/userspace/digwatch/digwatch.cpp index a84ee7d2..a995a28d 100644 --- a/userspace/digwatch/digwatch.cpp +++ b/userspace/digwatch/digwatch.cpp @@ -292,7 +292,19 @@ int digwatch_init(int argc, char **argv) rules->load_rules(rules_file); inspector->set_filter(rules->get_filter()); - inspector->open(""); + + try + { + inspector->open(""); + } + catch(sinsp_exception e) + { + if(system("modprobe " PROBE_NAME " > /dev/null 2> /dev/null")) + { + fprintf(stderr, "Unable to load the driver\n"); + } + inspector->open(""); + } do_inspect(inspector, rules,