Skip to content

Commit

Permalink
fix(bpf): ensure ring buffer wakeup on TCP, UDP, and syscall events
Browse files Browse the repository at this point in the history
  • Loading branch information
nullswan committed Sep 18, 2024
1 parent 62a5b8b commit b976efd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bpf/kprobe/trace_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int trace_tcp_recvmsg(struct tcp_recvmsg_args *ctx) {
e.direction = 0;
e.protocol = 6;

bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_NO_WAKEUP);
bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_FORCE_WAKEUP);
return 0;
}

Expand Down Expand Up @@ -102,6 +102,6 @@ int trace_tcp_sendmsg(struct tcp_sendmsg_args *ctx) {
e.direction = 1;
e.protocol = 6;

bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_NO_WAKEUP);
bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_FORCE_WAKEUP);
return 0;
}
4 changes: 2 additions & 2 deletions bpf/kprobe/trace_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int trace_udp_recvmsg(struct udp_recvmsg_args *ctx) {
e.direction = 0;
e.protocol = 17;

bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_NO_WAKEUP);
bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_FORCE_WAKEUP);
return 0;
}

Expand Down Expand Up @@ -101,6 +101,6 @@ int trace_udp_sendmsg(struct udp_sendmsg_args *ctx) {
e.sport = sport;
e.dport = dport;

bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_NO_WAKEUP);
bpf_ringbuf_output(&network_events_rb, &e, sizeof(e), BPF_RB_FORCE_WAKEUP);
return 0;
}
2 changes: 1 addition & 1 deletion bpf/tracepoint/trace_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ int tracepoint_sys_enter(struct syscall_trace_enter_args *ctx) {
.pid = pid
};

bpf_ringbuf_output(&network_events_rb, &syscall_event, sizeof(syscall_event), BPF_RB_NO_WAKEUP);
bpf_ringbuf_output(&syscall_events_rb, &syscall_event, sizeof(syscall_event), BPF_RB_FORCE_WAKEUP);
return 0;
}

0 comments on commit b976efd

Please sign in to comment.