Skip to content

Commit d7c470e

Browse files
mauriciovasquezbernalchenhengqi
authored andcommitted
tcpconnlat: Remove entries from map in all cases
If there is not any reply to the connection, the sock entry in the start map is never removed, this commit adds a new tracepoint on tcp_sock_destroy to remove the socket from the map in all cases. Signed-off-by: Mauricio Vásquez <[email protected]>
1 parent 0dcc57b commit d7c470e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libbpf-tools/tcpconnlat.bpf.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ int BPF_KPROBE(tcp_rcv_state_process, struct sock *sk)
110110
return handle_tcp_rcv_state_process(ctx, sk);
111111
}
112112

113+
SEC("tracepoint/tcp/tcp_destroy_sock")
114+
int tcp_destroy_sock(struct trace_event_raw_tcp_event_sk *ctx)
115+
{
116+
const struct sock *sk = ctx->skaddr;
117+
118+
bpf_map_delete_elem(&start, &sk);
119+
return 0;
120+
}
121+
113122
SEC("fentry/tcp_v4_connect")
114123
int BPF_PROG(fentry_tcp_v4_connect, struct sock *sk)
115124
{

0 commit comments

Comments
 (0)