tcpdrop(8)

πŸ“¦ version 0.36.1, in centos-stream 10, centos-stream 9, fedora 43, fedora 44

πŸ’– tcpdrop(8) πŸ’–

✨ NAME ✨

okay so the name of this bad boy is tcpdrop πŸ¦‹ It's a tool that traces kernel-based TCP packet drops with details. It runs on Linux eBPF/bcc, so it's giving low-level tea β˜•

πŸŽ€ SYNOPSIS πŸŽ€

tcpdrop [-4 | -6] [-h]

🌸 DESCRIPTION 🌸

bestie, this tool catches TCP packets or segments that the kernel dropped 😭 and shows you everything: details from the IP and TCP headers, the socket state, and the kernel stack trace. It's lowkey essential for debugging high kernel drops, because those can cause timer-based retransmits and performance issues. Not me losing sleep over this πŸ’€

This tool works by dynamically tracing the tcp_drop() kernel function, so you'll need a recent kernel version 🧚

Since it uses BPF, only the root user can run it πŸ‘‘ sorry, no cap, that's the rule.

πŸ“ REQUIREMENTS πŸ“

You need CONFIG_BPF and bcc. No shortcuts πŸ’…

✨ OPTIONS ✨

  • -4 β€” trace the IPv4 family only 🌈
  • -6 β€” trace the IPv6 family only 🌈
  • -h β€” print the usage message 🫢

🧚 EXAMPLES 🧚

Trace kernel-based TCP packet drops with details:

# tcpdrop

Trace IPv4 family only:

# tcpdrop -4

Trace IPv6 family only:

# tcpdrop -6

πŸ’œ FIELDS πŸ’œ

  • TIME β€” when the drop happened, in HH:MM:SS format ⏰
  • PID β€” the process ID that was on-CPU during the drop. Heads up, this may be unrelated πŸ™ˆ drops can happen on the receive interrupt, so the PID that got interrupted isn't always the culprit.
  • IP β€” the IP address family (4 or 6)
  • SADDR β€” the source IP address
  • SPORT β€” the source TCP port
  • DADDR β€” the destination IP address
  • DPORT β€” the destination TCP port
  • STATE β€” the TCP session state, like "ESTABLISHED", etc.
  • FLAGS β€” the TCP flags, like "SYN", etc.

🌈 OVERHEAD 🌈

This traces the kernel tcp_drop() function, which should be low frequency, so the overhead of this tool should be negligible. Lowkey vibes ✨

As always, test and understand this tool's overhead for your type of workload before you use it in production 🫢 future you will thank you.

πŸ”₯ SOURCE πŸ”₯

This is from bcc, check it out:

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion _examples.txt file. It has example usage, output, and commentary for this tool, and it's giving main character energy πŸŽ€

🌷 OS 🌷

Linux 🐧

πŸ™ˆ STABILITY πŸ™ˆ

Unstable, it's still in development 🚧 so don't be shocked if things shift.

πŸ‘‘ AUTHOR πŸ‘‘

Brendan Gregg πŸ’…

πŸ¦‹ SEE ALSO πŸ¦‹

tcplife(8), tcpaccept(8), tcpconnect(8), tcptop(8) β€” iykyk πŸ’œ


Bestie, that's the whole tea β˜• This page is from the USER COMMANDS section, last updated 2018-05-30, and it's all yours to read as tcpdrop(8) 🫢✨

πŸ“¦ where this page comes from