tcpdrop.bt(8)
π tcpdrop.bt(8) β like, the manual page bestie
okay so this is tcpdrop.bt from the System Manager's Manual, and it's genuinely one of my faves, no cap. it traces kernel-based TCP packet drops, with details, using Linux bpftrace/eBPF. π¦
β¨ NAME β¨
tcpdrop.bt β trace kernel-based TCP packet drops with details. Uses Linux bpftrace/eBPF. periodt. π
πΈ SYNOPSIS πΈ
tcpdrop.bt
that's it. that's the whole vibe. she takes no args and she takes no nonsense. π
π DESCRIPTION π
so basically, this tool traces TCP packets or segments that the kernel dropped β and then it shows you the receipts: details from the IP and TCP headers, the socket state, and the kernel stack trace. it's giving detective energy fr fr. π
why do you care? because when you're debugging cases of high kernel drops, this is the tool. high drops can cause timer-based retransmits and performance issues, and nobody wants that. π
the way this works is dynamic tracing of the tcp_drop() kernel function, which means it requires a recent kernel version. no old-kernel shenanigans here bestie. π
β οΈ this tool is limited to ipv4, and it cannot parse tcpflags β because bpftrace currently cannot parse socket buffers in the way that bcc can. not her fault, she's just built different (and that difference has limits). π
π since this uses BPF, only the root user can use this tool. like, root only. don't even try it as a regular user, she will simply not let you. π
π§ REQUIREMENTS π§
CONFIG_BPFbpftrace
both of them. together. a duo. an iconic pair. β¨
π EXAMPLES π
trace all tcp drops:
# tcpdrop.bt
literally that's the whole command. main character energy with zero effort. π
π FIELDS π
here's what all those columns mean, bestie, so you're not squinting at your terminal like ποΈπποΈ
- TIME β time of the call, in
HH:MM:SSformat. cute, precise, clocked in. - PID β process ID that was on-CPU during the drop. lowkey important caveat: this may be unrelated, because drops can occur on the receive interrupt and be unrelated to the PID that was interrupted. so don't go blaming that process, she said what she said. π
- COMM β process name.
- SADDR:SPORT β source IP address and source TCP port.
- DADDR:DPORT β destination IP address and destination TCP port.
- STATE β TCP session state (
"ESTABLISHED", etc). yes like that. the whole vibe of the connection, summarized. π
π₯ OVERHEAD π₯
this traces the kernel tcp_drop() function, which should be low frequency β so therefore the overhead of this tool should be negligible. she's light on her feet. π¦
but as always, bestie: test and understand this tool's overhead for your types of workloads before production use. don't just yolo it into prod, I'm begging. π
π SOURCE π
this is from bpftrace:
https://github.com/bpftrace/bpftrace
also, look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's like the director's commentary track but for syscalls. π
and fun fact: this is a bpftrace version of the bcc tool of the same name. the bcc tool may provide more options and customizations, so if you need more, go say hi to her cousin:
https://github.com/iovisor/bcc
π§ OS π§
Linux. that's the one. πΈ
β STABILITY β
Unstable β in development. she's a work in progress and she's thriving. treat her accordingly. π
π AUTHOR π
Brendan Gregg, adapted for bpftrace by Dale Hamel. legends, both of them. π«Ά
π SEE ALSO π
tcplife.bt(8), tcpaccept.bt(8), tcpconnect.bt(8), tcptop(8)
the whole friend group honestly. go read them too. π
and that's the whole page bestie!! β¨ this one lives under USER COMMANDS and it's dated 2018-11-24 β a classic, an icon, a moment. mwah. π ππ
π¦ where this page comes from
- alpine 3.24: bpftrace-tools-doc 0.26.1-r0 Β· Apache-2.0
- arch rolling: bpftrace 0.27.0-2 Β· Apache-2.0
- centos-stream 10: bpftrace 0.26.1-1.el10 Β· Apache-2.0
- centos-stream 9: bpftrace 0.26.1-1.el9 Β· ASL 2.0
- nixos 26.05: bpftrace 0.25.1
- nixpkgs unstable: bpftrace 0.27.1
- ubuntu resolute: bpftrace 0.25.0-1ubuntu1 Β· Apache-2.0
- ubuntu stonking: bpftrace 0.25.0-1ubuntu2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms