tcpdrop.bt(8)

πŸ“¦ version 0.17.0, in debian bookworm

πŸ¦‹ 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_BPF
  • bpftrace

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, in HH:MM:SS format. ⏰
  • 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