Skip to content

Commit 71c44e5

Browse files
committed
refactor(userspace/libsinsp): remove any ref to old accept{,4} evts
Signed-off-by: Leonardo Di Giovanna <[email protected]>
1 parent 7cd2cf1 commit 71c44e5

File tree

5 files changed

+9
-21
lines changed

5 files changed

+9
-21
lines changed

userspace/libsinsp/event.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,14 +1705,10 @@ bool sinsp_evt::is_file_error() const {
17051705

17061706
bool sinsp_evt::is_network_error() const {
17071707
if(m_fdinfo != nullptr) {
1708-
return (m_fdinfo->m_type == SCAP_FD_IPV4_SOCK) || (m_fdinfo->m_type == SCAP_FD_IPV6_SOCK);
1709-
} else {
1710-
return (m_pevt->type == PPME_SOCKET_ACCEPT_X) || (m_pevt->type == PPME_SOCKET_ACCEPT4_X) ||
1711-
(m_pevt->type == PPME_SOCKET_ACCEPT_5_X) ||
1712-
(m_pevt->type == PPME_SOCKET_ACCEPT4_5_X) ||
1713-
(m_pevt->type == PPME_SOCKET_ACCEPT4_6_X) ||
1714-
(m_pevt->type == PPME_SOCKET_CONNECT_X) || (m_pevt->type == PPME_SOCKET_BIND_X);
1708+
return m_fdinfo->m_type == SCAP_FD_IPV4_SOCK || m_fdinfo->m_type == SCAP_FD_IPV6_SOCK;
17151709
}
1710+
return m_pevt->type == PPME_SOCKET_ACCEPT_5_X || m_pevt->type == PPME_SOCKET_ACCEPT4_6_X ||
1711+
m_pevt->type == PPME_SOCKET_CONNECT_X || m_pevt->type == PPME_SOCKET_BIND_X;
17161712
}
17171713

17181714
uint64_t sinsp_evt::get_lastevent_ts() const {

userspace/libsinsp/parsers.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,7 @@ void sinsp_parser::process_event(sinsp_evt &evt, sinsp_parser_verdict &verdict)
184184
case PPME_SOCKET_CONNECT_X:
185185
parse_connect_exit(evt, verdict);
186186
break;
187-
case PPME_SOCKET_ACCEPT_X:
188187
case PPME_SOCKET_ACCEPT_5_X:
189-
case PPME_SOCKET_ACCEPT4_X:
190-
case PPME_SOCKET_ACCEPT4_5_X:
191188
case PPME_SOCKET_ACCEPT4_6_X:
192189
parse_accept_exit(evt, verdict);
193190
break;

userspace/libsinsp/sinsp_filtercheck_event.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,9 +1430,8 @@ uint8_t* sinsp_filter_check_event::extract_single(sinsp_evt* evt,
14301430
} else {
14311431
uint16_t etype = evt->get_type();
14321432

1433-
if(etype == PPME_SOCKET_ACCEPT_X || etype == PPME_SOCKET_ACCEPT_5_X ||
1434-
etype == PPME_SOCKET_ACCEPT4_X || etype == PPME_SOCKET_ACCEPT4_5_X ||
1435-
etype == PPME_SOCKET_ACCEPT4_6_X || etype == PPME_SOCKET_CONNECT_X) {
1433+
if(etype == PPME_SOCKET_ACCEPT_5_X || etype == PPME_SOCKET_ACCEPT4_6_X ||
1434+
etype == PPME_SOCKET_CONNECT_X) {
14361435
return extract_error_count(evt, len);
14371436
}
14381437
}
@@ -1460,10 +1459,9 @@ uint8_t* sinsp_filter_check_event::extract_single(sinsp_evt* evt,
14601459
if(const auto etype = evt->get_type();
14611460
!(etype == PPME_SYSCALL_OPEN_X || etype == PPME_SYSCALL_CREAT_X ||
14621461
etype == PPME_SYSCALL_OPENAT_2_X || etype == PPME_SYSCALL_OPENAT2_X ||
1463-
etype == PPME_SYSCALL_OPEN_BY_HANDLE_AT_X || etype == PPME_SOCKET_ACCEPT_X ||
1464-
etype == PPME_SOCKET_ACCEPT_5_X || etype == PPME_SOCKET_ACCEPT4_X ||
1465-
etype == PPME_SOCKET_ACCEPT4_5_X || etype == PPME_SOCKET_ACCEPT4_6_X ||
1466-
etype == PPME_SOCKET_CONNECT_X || evt->get_category() == EC_MEMORY)) {
1462+
etype == PPME_SYSCALL_OPEN_BY_HANDLE_AT_X || etype == PPME_SOCKET_ACCEPT_5_X ||
1463+
etype == PPME_SOCKET_ACCEPT4_6_X || etype == PPME_SOCKET_CONNECT_X ||
1464+
evt->get_category() == EC_MEMORY)) {
14671465
return extract_error_count(evt, len);
14681466
}
14691467
}

userspace/libsinsp/sinsp_filtercheck_fd.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,7 @@ bool sinsp_filter_check_fd::extract_fdname_from_event(sinsp_evt *evt,
387387

388388
switch(etype) {
389389
case PPME_SYSCALL_OPEN_X:
390-
case PPME_SOCKET_ACCEPT_X:
391390
case PPME_SOCKET_ACCEPT_5_X:
392-
case PPME_SOCKET_ACCEPT4_X:
393-
case PPME_SOCKET_ACCEPT4_5_X:
394391
case PPME_SOCKET_ACCEPT4_6_X:
395392
case PPME_SYSCALL_CREAT_X: {
396393
const char *argstr =

userspace/libsinsp/test/public_sinsp_API/events_set.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ TEST(events_set, all_non_sc_event_set) {
339339
/* No sc events at all expected. */
340340
ASSERT_FALSE(event_set.contains(PPME_GENERIC_E));
341341
ASSERT_FALSE(event_set.contains(PPME_GENERIC_X));
342-
ASSERT_FALSE(event_set.contains(PPME_SOCKET_ACCEPT_X));
342+
ASSERT_FALSE(event_set.contains(PPME_SOCKET_ACCEPT_5_X));
343343
ASSERT_FALSE(event_set.contains(PPME_SYSCALL_OPENAT2_E));
344344
ASSERT_FALSE(event_set.contains(PPME_SYSCALL_OPENAT2_X));
345345
/* Some critical expected non sc events. */

0 commit comments

Comments
 (0)