Skip to content

Commit 6cc1a12

Browse files
fix(sinsp): plugin capture listen capability exception
Signed-off-by: Gianmatteo Palmieri <[email protected]> Co-authored-by: Jason Dellaluce <[email protected]>
1 parent dd16507 commit 6cc1a12

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

userspace/libsinsp/sinsp.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,10 @@ void sinsp::open_common(scap_open_args* oargs, const scap_vtable* vtable, scap_p
403403
// notify registered plugins of capture open
404404
for (auto& p : m_plugin_manager->plugins())
405405
{
406-
p->capture_open();
406+
if (p->caps() & CAP_CAPTURE_LISTENING)
407+
{
408+
p->capture_open();
409+
}
407410
}
408411
}
409412

@@ -805,9 +808,15 @@ void sinsp::close()
805808
}
806809

807810
// notify registered plugins of capture close
808-
for (auto& p : m_plugin_manager->plugins())
811+
if (m_mode != SINSP_MODE_NONE)
809812
{
810-
p->capture_close();
813+
for (auto& p : m_plugin_manager->plugins())
814+
{
815+
if (p->caps() & CAP_CAPTURE_LISTENING)
816+
{
817+
p->capture_close();
818+
}
819+
}
811820
}
812821

813822
// purge pending routines and wait for the running ones

0 commit comments

Comments
 (0)