tcpdrop.bt(8)
π¦ tcpdrop.bt β the manual, but make it make sense
okay bestie, welcome to tcpdrop.bt(8) from the System Manager's Manual π
this is the page for the tool that traces kernel-based TCP packet drops with details, powered by Linux bpftrace/eBPF. yes, eBPF. we're doing kernel magic today, periodt. β¨
π NAME
tcpdrop.bt β trace kernel-based TCP packet drops with details. it runs on Linux bpftrace/eBPF, and honestly? iconic. π
πΈ SYNOPSIS
tcpdrop.bt
that's it. that's the whole synopsis. no flags, no arguments, just vibes and root privileges. π«Ά
β¨ DESCRIPTION
so here's the tea: this tool traces TCP packets or segments that got dropped by the kernel, and it shows you the details from the IP and TCP headers, the socket state, and the kernel stack trace. π΅οΈββοΈ
why do you care? because this is literally the move for debugging cases of high kernel drops, which can cause timer-based retransmits and performance issues. like, your network is struggling and you don't know why? this. this is why. π
this tool works by dynamically tracing the tcp_drop() kernel function, which β heads up β requires a recent kernel version. no old kernels allowed, sorry babe. π
it's also limited to ipv4, and it cannot parse tcpflags because bpftrace currently cannot parse socket buffers the way that bcc can. not us being limited, it's just the way it is. π
and since this uses BPF, only the root user can use this tool. no cap. π
π REQUIREMENTS
CONFIG_BPFbpftrace
that's the whole shopping list. β¨
π EXAMPLES
trace all tcp drops:
# tcpdrop.bt
π FIELDS
okay so when the output comes at you, here's what each column is giving:
TIMEβ time of the call, inHH:MM:SSformat. β°PIDβ the process ID that was on-CPU during the drop. β οΈ careful though, this may be unrelated, as drops can occur on the receive interrupt and be unrelated to the PID that was interrupted.COMMβ process name. π¬SADDRβ source IP address.SPORTβ source TCP port.DADDRβ destination IP address.DPORTβ destination TCP port.STATEβ TCP session state (like"ESTABLISHED", etc).
π₯ OVERHEAD
this traces the kernel tcp_drop() function, which should be low frequency, and therefore the overhead of this tool should be negligible. lowkey free. π§
but as always β and I mean always β test and understand this tool's overhead for your types of workloads before production use. don't be out here yolo-ing production, bestie. π
π SOURCE
this is from bpftrace:
https://github.com/iovisor/bpftrace
also, look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's giving extra credit. π
this is a bpftrace version of the bcc tool of the same name. and ngl, the bcc tool may provide more options and customizations. so if you want the deluxe edition:
https://github.com/iovisor/bcc
π OS
Linux
β STABILITY
Unstable β in development. it's in its experimental era, we respect it. π«Ά
πΈ AUTHOR
Brendan Gregg, adapted for bpftrace by Dale Hamel. legends only. π
π¦ SEE ALSO
and that's the whole page, babe. π this one's from USER COMMANDS, dated 2018-11-24, and yeah the footer says tcpdrop.bt(8) again because manpages love a little repetition. slay, go drop some packets (or rather, go watch them get dropped). β¨π
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms