|
|
@@ -112,8 +112,11 @@ int inet_sock_set_state(void *ctx)
|
|
|
}
|
|
|
__u64 id = bpf_get_current_pid_tgid();
|
|
|
__u32 pid = id >> 32;
|
|
|
+ cw_bpf_debug("fucksocket pid=%lld inet_sock_set_state -- args.oldstate=%lld, args.newstate=%lld\n", pid, args.oldstate, args.newstate);
|
|
|
+ cw_bpf_debug("fucksocket pid=%lld inet_sock_set_state -- id=%lld\n", pid, id);
|
|
|
|
|
|
if (args.oldstate == BPF_TCP_CLOSE && args.newstate == BPF_TCP_SYN_SENT) {
|
|
|
+
|
|
|
__u64 *fdp = bpf_map_lookup_elem(&fd_by_pid_tgid, &id);
|
|
|
|
|
|
if (!fdp) {
|
|
|
@@ -209,6 +212,8 @@ int sys_enter_connect(void *ctx) {
|
|
|
return 0;
|
|
|
}
|
|
|
__u64 id = bpf_get_current_pid_tgid();
|
|
|
+ __u64 pid = id >> 32;
|
|
|
+ cw_bpf_debug("fucksocket pid=%lld sys_enter_connect -- id=%lld, fd=%lld\n", pid, id, args.fd);
|
|
|
bpf_map_update_elem(&fd_by_pid_tgid, &id, &args.fd, BPF_ANY);
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -229,6 +234,7 @@ int sys_exit_connect(struct trace_event_raw_sys_exit__stub* ctx) {
|
|
|
conn.timestamp = bpf_ktime_get_ns();
|
|
|
conn.first_read_time = 0;
|
|
|
conn.first_write_time = 0;
|
|
|
+ cw_bpf_debug("fucksocket pid=%lld sys_exit_connect -- id=%lld, fd=%lld\n", cid.pid, id, cid.fd);
|
|
|
bpf_map_update_elem(&active_connections, &cid, &conn, BPF_ANY);
|
|
|
}
|
|
|
bpf_map_delete_elem(&fd_by_pid_tgid, &id);
|
|
|
@@ -246,8 +252,14 @@ int sys_enter_close(void *ctx) {
|
|
|
cid.pid = id >> 32;
|
|
|
cid.fd = args.fd;
|
|
|
struct connection *conn = bpf_map_lookup_elem(&active_connections, &cid);
|
|
|
+ if (cid.pid == 3269744) {
|
|
|
+ cw_bpf_debug("fucksocket pid=%lld sys_enter_close -- id=%lld, fd=%lld\n", cid.pid, id, cid.fd);
|
|
|
+ }
|
|
|
cw_bpf_debug("socket accept socket sys_enter_close connection before -- cid.pid=%lld, cid.fd=%lld\n", cid.pid, cid.fd);
|
|
|
if (conn) {
|
|
|
+ if (cid.pid == 3269744) {
|
|
|
+ cw_bpf_debug("fucksocket pid=%lld sys_enter_close2 -- id=%lld, fd=%lld\n", cid.pid, id, cid.fd);
|
|
|
+ }
|
|
|
cw_bpf_debug("socket accept socket sys_enter_close connection before cid.pid=%lld, cid.fd=%lld\n", conn->bytes_sent, conn->bytes_received);
|
|
|
struct tcp_event e = {};
|
|
|
e.type = EVENT_TYPE_CONNECTION_CLOSE;
|