diff --git a/src/41-xdp-tcpdump/README.md b/src/41-xdp-tcpdump/README.md index 0deffc5..3e234b2 100644 --- a/src/41-xdp-tcpdump/README.md +++ b/src/41-xdp-tcpdump/README.md @@ -140,7 +140,7 @@ int xdp_pass(struct xdp_md *ctx) bpf_ringbuf_submit(event, 0); // Optional: Print a debug message - bpf_printk("Captured TCP header (%d bytes)", tcp_header_bytes); + bpf_printk("Captured TCP header (%u bytes)", tcp_header_bytes); return XDP_PASS; } @@ -215,7 +215,7 @@ bpf_ringbuf_submit(event, 0); The `bpf_printk` function logs messages to the kernel's trace pipe, which can be invaluable for debugging. ```c -bpf_printk("Captured TCP header (%d bytes)", tcp_header_bytes); +bpf_printk("Captured TCP header (%u bytes)", tcp_header_bytes); ``` ## User-Space Code Analysis diff --git a/src/41-xdp-tcpdump/README.zh.md b/src/41-xdp-tcpdump/README.zh.md index 59e2f89..3554049 100644 --- a/src/41-xdp-tcpdump/README.zh.md +++ b/src/41-xdp-tcpdump/README.zh.md @@ -138,7 +138,7 @@ int xdp_pass(struct xdp_md *ctx) bpf_ringbuf_submit(event, 0); // 可选:打印调试信息 - bpf_printk("Captured TCP header (%d bytes)", tcp_header_bytes); + bpf_printk("Captured TCP header (%u bytes)", tcp_header_bytes); return XDP_PASS; } @@ -213,7 +213,7 @@ bpf_ringbuf_submit(event, 0); `bpf_printk` 函数将消息记录到内核的跟踪管道,对于调试非常有用。 ```c -bpf_printk("Captured TCP header (%d bytes)", tcp_header_bytes); +bpf_printk("Captured TCP header (%u bytes)", tcp_header_bytes); ``` ## 用户空间代码分析