Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support tcp connect #236

Merged
merged 2 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions probe/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ http_archive(

http_archive(
name = "agent-libs",
urls = ["https://github.com/Kindling-project/agent-libs/archive/c6e7b1a7a16956479c56137e3af7eb251f462f41.tar.gz"],
sha256 = "66ae395992ef4768792a36088ecf1a96e1920d1445e7875b9fec351e0b7cb984",
strip_prefix = "agent-libs-c6e7b1a7a16956479c56137e3af7eb251f462f41",
urls = ["https://github.com/Kindling-project/agent-libs/archive/92b86531d3f325ff7153b61a9346f4efb3cb9e01.tar.gz"],
sha256 = "d8415c0730860bfe7940164ba9a88b407be29fb6b7712f7544d3720537f14106",
strip_prefix = "agent-libs-92b86531d3f325ff7153b61a9346f4efb3cb9e01",
build_file_content = BUILD_ALL_CONTENT,
)

Expand Down
43 changes: 40 additions & 3 deletions probe/src/probe/converter/sysdig_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,41 @@ int sysdig_converter::add_user_attributes(kindling::KindlingEvent *kevt, sinsp_e
}
break;
}
case PPME_TCP_CONNECT_X: {
auto pTuple = sevt->get_param_value_raw("tuple");
setTuple(kevt, pTuple);
auto pRetVal = sevt->get_param_value_raw("retval");
if (pRetVal != NULL) {
auto attr = kevt->add_user_attributes();
attr->set_key("retval");
attr->set_value(pRetVal->m_val, pRetVal->m_len);
attr->set_value_type(UINT64);
}
break;
}
case PPME_TCP_DROP_E:
case PPME_TCP_RETRANCESMIT_SKB_E: {
case PPME_TCP_RETRANCESMIT_SKB_E:
case PPME_TCP_SET_STATE_E: {
auto pTuple = sevt->get_param_value_raw("tuple");
setTuple(kevt, pTuple);
auto old_state = sevt->get_param_value_raw("old_state");
if (old_state != NULL) {
auto attr = kevt->add_user_attributes();
attr->set_key("old_state");
attr->set_value(old_state->m_val, old_state->m_len);
attr->set_value_type(INT32);
}
auto new_state = sevt->get_param_value_raw("new_state");
if (new_state != NULL) {
auto attr = kevt->add_user_attributes();
attr->set_key("new_state");
attr->set_value(new_state->m_val, new_state->m_len);
attr->set_value_type(INT32);
}
break;
}
case PPME_TCP_SEND_RESET_E:
case PPME_TCP_RECEIVE_RESET_E: {
auto pTuple = sevt->get_param_value_raw("tuple");
setTuple(kevt, pTuple);
break;
Expand Down Expand Up @@ -170,8 +203,11 @@ Source sysdig_converter::get_kindling_source(uint16_t etype) {
case PPME_TCP_CLOSE_E:
case PPME_TCP_DROP_E:
case PPME_TCP_RETRANCESMIT_SKB_E:
case PPME_TCP_SET_STATE_E:
return KRPOBE;
// TODO add cases of tracepoint, kprobe, uprobe
case PPME_TCP_SEND_RESET_E:
case PPME_TCP_RECEIVE_RESET_E:
return TRACEPOINT;
default:
return SYSCALL_ENTER;
}
Expand All @@ -190,7 +226,8 @@ Source sysdig_converter::get_kindling_source(uint16_t etype) {
case PPME_INFRASTRUCTURE_EVENT_X:
case PPME_PAGE_FAULT_X:
return SOURCE_UNKNOWN;
// TODO add cases of tracepoint, kprobe, uprobe
case PPME_TCP_CONNECT_X:
return KRETPROBE;
default:
return SYSCALL_EXIT;
}
Expand Down
4 changes: 4 additions & 0 deletions probe/src/probe/publisher/defination.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ const static event kindling_to_sysdig[PPM_EVENT_MAX] = {
{"kprobe-tcp_rcv_established", PPME_TCP_RCV_ESTABLISHED_E},
{"kprobe-tcp_drop", PPME_TCP_DROP_E},
{"kprobe-tcp_retransmit_skb", PPME_TCP_RETRANCESMIT_SKB_E},
{"kretprobe-tcp_connect", PPME_TCP_CONNECT_X},
{"kprobe-tcp_set_state", PPME_TCP_SET_STATE_E},
{"tracepoint-tcp_send_reset", PPME_TCP_SEND_RESET_E},
{"tracepoint-tcp_receive_reset", PPME_TCP_RECEIVE_RESET_E},
};

struct event_category {
Expand Down