From 0b252d31e12741dc46221c9e66d4d3924be574e9 Mon Sep 17 00:00:00 2001 From: thiagoftsm Date: Wed, 3 Apr 2024 03:20:13 +0000 Subject: [PATCH] Network Vierwer (tgid) (#72) --- kernel-collector | 2 +- src/networkviewer.bpf.c | 2 ++ src/networkviewer.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel-collector b/kernel-collector index 1cd2e6b..0d1ad64 160000 --- a/kernel-collector +++ b/kernel-collector @@ -1 +1 @@ -Subproject commit 1cd2e6bd224fa3078fd1a4c2e3944789d046aafa +Subproject commit 0d1ad645dc665dcce5a50f90a9ba12db5837f7dd diff --git a/src/networkviewer.bpf.c b/src/networkviewer.bpf.c index 3ccc83d..dbb944d 100644 --- a/src/networkviewer.bpf.c +++ b/src/networkviewer.bpf.c @@ -144,6 +144,7 @@ static __always_inline void set_common_tcp_nv_data(netdata_nv_idx_t *idx, __u32 tgid = 0; data->pid = netdata_get_pid(&nv_ctrl, &tgid); + data->tgid = tgid; data->uid = bpf_get_current_uid_gid(); // Only update this data when it is a new value if (!data->ts) @@ -171,6 +172,7 @@ static __always_inline void set_common_udp_nv_data(netdata_nv_idx_t *idx, NETDATA_SOCKET_DIRECTION direction) { __u32 tgid = 0; data->pid = netdata_get_pid(&nv_ctrl, &tgid); + data->tgid = tgid; data->uid = bpf_get_current_uid_gid(); // Only update this data when it is a new value if (!data->ts) diff --git a/src/networkviewer.c b/src/networkviewer.c index 50b0202..0dc84bf 100644 --- a/src/networkviewer.c +++ b/src/networkviewer.c @@ -47,11 +47,13 @@ static int ebpf_attach_probes(struct networkviewer_bpf *obj) if (ret) return -1; + /* obj->links.netdata_nv_tcp_v6_connect_kprobe = bpf_program__attach_kprobe(obj->progs.netdata_nv_tcp_v6_connect_kprobe, false, function_list[NETDATA_FCNT_TCP_V6_CONNECT]); ret = libbpf_get_error(obj->links.netdata_nv_tcp_v6_connect_kprobe); if (ret) return -1; + */ obj->links.netdata_nv_tcp_retransmit_skb_kprobe = bpf_program__attach_kprobe(obj->progs.netdata_nv_tcp_retransmit_skb_kprobe, false, function_list[NETDATA_FCNT_TCP_RETRANSMIT]); @@ -170,6 +172,8 @@ static inline int ebpf_load_and_attach(struct networkviewer_bpf *obj, int select } else if (selector == NETDATA_MODE_PROBE) { // kprobe ebpf_disable_trampoline(obj); } + bpf_program__set_autoload(obj->progs.netdata_nv_tcp_v6_connect_kprobe, false); + bpf_program__set_autoload(obj->progs.netdata_nv_tcp_v6_connect_fentry, false); ret = networkviewer_bpf__load(obj); if (ret) {