From 0b4c817226bbbc0b850ce1f1c5201586def612ea Mon Sep 17 00:00:00 2001 From: jundizhou Date: Thu, 2 Jun 2022 14:24:38 +0800 Subject: [PATCH] update use tcp set state instead tcp finish connect Signed-off-by: jundizhou --- probe/WORKSPACE | 6 ++--- .../src/probe/converter/sysdig_converter.cpp | 22 +++++++++++++++++-- probe/src/probe/publisher/defination.h | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/probe/WORKSPACE b/probe/WORKSPACE index 5e37078fb..57eb5e8fa 100644 --- a/probe/WORKSPACE +++ b/probe/WORKSPACE @@ -21,9 +21,9 @@ http_archive( http_archive( name = "agent-libs", - urls = ["https://github.com/Kindling-project/agent-libs/archive/eed4620f0efbb350fb98c30b85d523da89d2e764.tar.gz"], - sha256 = "d64e8ce32c1642897768f6957e81fe75d34e66c1a2baadc4160f84efedd7e412", - strip_prefix = "agent-libs-eed4620f0efbb350fb98c30b85d523da89d2e764", + urls = ["https://github.com/Kindling-project/agent-libs/archive/e7a35ca27aa076e62856024e13aae2d3859d292b.tar.gz"], + sha256 = "fa03230caf2999c5d8773130a6f9ed19ad8459a16f1b4d07390e5ec84a4b8575", + strip_prefix = "agent-libs-e7a35ca27aa076e62856024e13aae2d3859d292b", build_file_content = BUILD_ALL_CONTENT, ) diff --git a/probe/src/probe/converter/sysdig_converter.cpp b/probe/src/probe/converter/sysdig_converter.cpp index 9116d9e65..df67e4255 100644 --- a/probe/src/probe/converter/sysdig_converter.cpp +++ b/probe/src/probe/converter/sysdig_converter.cpp @@ -82,7 +82,25 @@ int sysdig_converter::add_user_attributes(kindling::KindlingEvent *kevt, sinsp_e } case PPME_TCP_DROP_E: case PPME_TCP_RETRANCESMIT_SKB_E: - case PPME_TCP_FINISH_CONNECT_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"); @@ -185,7 +203,7 @@ 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_FINISH_CONNECT_E: + case PPME_TCP_SET_STATE_E: return KRPOBE; case PPME_TCP_SEND_RESET_E: case PPME_TCP_RECEIVE_RESET_E: diff --git a/probe/src/probe/publisher/defination.h b/probe/src/probe/publisher/defination.h index 267074231..ddfd8664c 100644 --- a/probe/src/probe/publisher/defination.h +++ b/probe/src/probe/publisher/defination.h @@ -288,7 +288,7 @@ const static event kindling_to_sysdig[PPM_EVENT_MAX] = { {"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_finish_connect", PPME_TCP_FINISH_CONNECT_E}, + {"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}, };