Skip to content

Commit 5106f3a

Browse files
committed
feat!: prevent event propagation to upper layers for C_ACTION_STORE
`C_ACTION_STORE` now stores the event in the internal scap converter event storage and returns `CONVERSION_DROP`, preventing the event being passed up to the upper layers. BREAKING CHANGE: all scap converter's internally-stored events are not propagated anymore to sinsp Signed-off-by: Leonardo Di Giovanna <[email protected]>
1 parent 0883369 commit 5106f3a

File tree

5 files changed

+278
-236
lines changed

5 files changed

+278
-236
lines changed

test/libscap/test_suites/engines/savefile/convert_event_test.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ class convert_event_test : public testing::Test {
115115
<< "Event is not allowed to pass: " << error;
116116
}
117117

118+
void assert_single_conversion_drop(const safe_scap_evt_t &evt_to_convert) const {
119+
char error[SCAP_LASTERR_SIZE] = {'\0'};
120+
// We assume it's okay to create a new event with the same size as the expected event
121+
auto storage = new_safe_scap_evt((scap_evt *)calloc(1, evt_to_convert->len));
122+
// First we check the conversion result matches the expected result
123+
ASSERT_EQ(scap_convert_event(m_converter_buf, storage.get(), evt_to_convert.get(), error),
124+
CONVERSION_DROP)
125+
<< "Event is not dropped: " << error;
126+
}
127+
118128
static void assert_no_conversion_drop(const safe_scap_evt_t &evt_to_convert) {
119129
char error[SCAP_LASTERR_SIZE] = {'\0'};
120130
// We assume it's okay to create a new event with the same size as the expected event

0 commit comments

Comments
 (0)