@@ -117,13 +117,10 @@ int BPF_KRETPROBE(obi_kretprobe_sys_accept4, s32 fd) {
117
117
(void )ctx ;
118
118
119
119
u64 id = bpf_get_current_pid_tgid ();
120
-
121
120
if (!valid_pid (id )) {
122
121
return 0 ;
123
122
}
124
123
125
- //bpf_dbg_printk("=== accept 4 ret id=%d ===", id);
126
-
127
124
bpf_dbg_printk ("=== accept 4 ret id=%d, fd=%d ===" , id , fd );
128
125
129
126
// The file descriptor is the value returned from the accept4 syscall.
@@ -138,6 +135,11 @@ int BPF_KRETPROBE(obi_kretprobe_sys_accept4, s32 fd) {
138
135
goto cleanup ;
139
136
}
140
137
138
+ struct socket * sock = (struct socket * )args -> addr ;
139
+ struct sock * sk = BPF_CORE_READ (sock , sk );
140
+ struct sock_port_ns np = sock_port_ns_from_sk (sk );
141
+ bpf_map_update_elem (& listening_ports , & np , & (bool ){true}, BPF_ANY );
142
+
141
143
ssl_pid_connection_info_t info = {};
142
144
143
145
if (parse_accept_socket_info (args , & info .p_conn .conn )) {
@@ -1053,20 +1055,6 @@ int obi_handle_buf_with_args(void *ctx) {
1053
1055
return 0 ;
1054
1056
}
1055
1057
1056
- SEC ("kprobe/inet_csk_accept" )
1057
- int BPF_KPROBE (obi_kprobe_inet_csk_accept , struct sock * sk ) {
1058
- (void )ctx ;
1059
-
1060
- u64 id = bpf_get_current_pid_tgid ();
1061
- (void )id ;
1062
-
1063
- bpf_dbg_printk ("=== inet_csk_accept id=%d ===" , id );
1064
-
1065
- struct sock_port_ns np = sock_port_ns_from_sk (sk );
1066
- bpf_map_update_elem (& listening_ports , & np , & (bool ){true}, BPF_ANY );
1067
- return 0 ;
1068
- }
1069
-
1070
1058
SEC ("kprobe/inet_csk_listen_stop" )
1071
1059
int BPF_KPROBE (obi_kprobe_inet_csk_listen_stop , struct sock * sk ) {
1072
1060
(void )ctx ;
0 commit comments