Fix eBPD PID detection for UDP on linux and recompile eBPF programs
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -102,8 +102,8 @@ int BPF_PROG(udp_v4_connect, struct sock *sk) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read PID
|
||||
udp_info->pid = __builtin_bswap32((u32)bpf_get_current_pid_tgid());
|
||||
// Read PID (Careful: This is the Thread Group ID in kernel speak!)
|
||||
udp_info->pid = __builtin_bswap32((u32)(bpf_get_current_pid_tgid() >> 32));
|
||||
|
||||
// Set src and dist ports
|
||||
udp_info->sport = __builtin_bswap16(sk->__sk_common.skc_num);
|
||||
@@ -151,8 +151,8 @@ int BPF_PROG(udp_v6_connect, struct sock *sk) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read PID
|
||||
udp_info->pid = __builtin_bswap32((u32)bpf_get_current_pid_tgid());
|
||||
// Read PID (Careful: This is the Thread Group ID in kernel speak!)
|
||||
udp_info->pid = __builtin_bswap32((u32)(bpf_get_current_pid_tgid() >> 32));
|
||||
|
||||
// Set src and dist ports
|
||||
udp_info->sport = __builtin_bswap16(sk->__sk_common.skc_num);
|
||||
|
||||
Reference in New Issue
Block a user