docs: sync TCP header debug format

This commit is contained in:
LinuxDev9002
2026-07-14 04:27:30 -07:00
parent 4cc8bdf472
commit f1974b8f14
2 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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);
```
## 用户空间代码分析