Skip to content

Commit

Permalink
fix(sinsp): plugin capture listen capability exception
Browse files Browse the repository at this point in the history
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Co-authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
  • Loading branch information
mrgian and jasondellaluce committed Sep 10, 2024
1 parent dd16507 commit 6cc1a12
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,10 @@ void sinsp::open_common(scap_open_args* oargs, const scap_vtable* vtable, scap_p
// 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();

Check warning on line 408 in userspace/libsinsp/sinsp.cpp

View check run for this annotation

Codecov / codecov/patch

userspace/libsinsp/sinsp.cpp#L408

Added line #L408 was not covered by tests
}
}
}

Expand Down Expand Up @@ -805,9 +808,15 @@ void sinsp::close()
}

// notify registered plugins of capture close
for (auto& p : m_plugin_manager->plugins())
if (m_mode != SINSP_MODE_NONE)
{
p->capture_close();
for (auto& p : m_plugin_manager->plugins())
{
if (p->caps() & CAP_CAPTURE_LISTENING)
{
p->capture_close();

Check warning on line 817 in userspace/libsinsp/sinsp.cpp

View check run for this annotation

Codecov / codecov/patch

userspace/libsinsp/sinsp.cpp#L817

Added line #L817 was not covered by tests
}
}
}

// purge pending routines and wait for the running ones
Expand Down

0 comments on commit 6cc1a12

Please sign in to comment.