diff --git a/userspace/libsinsp/sinsp.cpp b/userspace/libsinsp/sinsp.cpp index 048db5a3f6..d5636cc97d 100644 --- a/userspace/libsinsp/sinsp.cpp +++ b/userspace/libsinsp/sinsp.cpp @@ -370,7 +370,9 @@ void sinsp::open_common(scap_open_args* oargs, // notify registered plugins of capture open for(auto& p : m_plugin_manager->plugins()) { - p->capture_open(); + if(p->caps() & CAP_CAPTURE_LISTENING) { + p->capture_open(); + } } } @@ -736,8 +738,12 @@ void sinsp::close() { } // notify registered plugins of capture close - for(auto& p : m_plugin_manager->plugins()) { - p->capture_close(); + if(m_mode != SINSP_MODE_NONE) { + for(auto& p : m_plugin_manager->plugins()) { + if(p->caps() & CAP_CAPTURE_LISTENING) { + p->capture_close(); + } + } } // purge pending routines and wait for the running ones