Skip to content

Commit

Permalink
Adds accept4 to NetworkSignalHandler (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stringy authored Dec 2, 2024
1 parent 07c38b5 commit 69fc54b
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions collector/lib/NetworkSignalHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ EventMap<Modifier> modifiers = {
{"shutdown<", Modifier::REMOVE},
{"connect<", Modifier::ADD},
{"accept<", Modifier::ADD},
{"accept4<", Modifier::ADD},
{"getsockopt<", Modifier::ADD},
{"sendto<", Modifier::ADD},
{"sendto>", Modifier::ADD},
Expand Down Expand Up @@ -152,13 +153,20 @@ SignalHandler::Result NetworkSignalHandler::HandleSignal(sinsp_evt* evt) {
}

std::vector<std::string> NetworkSignalHandler::GetRelevantEvents() {
std::vector<std::string> base_events = {
"close<",
"shutdown<",
"connect<",
"accept<",
"accept4<",
"getsockopt<"};

if (track_send_recv_) {
return {
"close<",
"shutdown<",
"connect<",
"accept<",
"getsockopt<",
// disable clang-format here because it will massively
// indent the initializer list.
//
// clang-format off
base_events.insert(base_events.end(), {
"sendto<",
"sendto>",
"sendmsg<",
Expand All @@ -171,10 +179,11 @@ std::vector<std::string> NetworkSignalHandler::GetRelevantEvents() {
"recvmmsg<",
"recvmmsg>",
"recvmsg<",
"recvmsg>",
};
"recvmsg>"
});
// clang-format on
}
return {"close<", "shutdown<", "connect<", "accept<", "getsockopt<"};
return base_events;
}

bool NetworkSignalHandler::Stop() {
Expand Down

0 comments on commit 69fc54b

Please sign in to comment.