4 ms·
drop_mon (or whatever it's called) is one of the weirder things in the Linux kernel. It has only one implementation I've found, "dropwatch", which is, to put it
by tptacek 5y ago
drop_mon (or whatever it's called) is one of the weirder things in the Linux kernel. It has only one implementation I've found, "dropwatch", which is, to put it gently, not a great example of a modern C CLI program --- for instance, the kernel subsystem gives you snapshots of packet contents themselves, and there is already a very flexible and easy-to-use library for filtering packets based on their contents with an enormous ecosystem, but all dropwatch will do is print dumps.
I threw together a half-assed POC alternative implementation in Go a couple months ago, using Matt Layher's fantastic netlink libraries:
https://github.com/superfly/dropspy https://github.com/superfly/dropspy
I have the impression that the drop_mon stuff isn't taken super seriously by anyone, but it's incredibly useful when you're debugging complicated networking stuff.
- suprjami 5y agoThere's a dropwatch in SystemTap which produces similar output to the dropwatch program but has been significantly more useful for our purposes. Adding a backtrace to that can be useful. Beyond that we usually instrument the kernel to either printk when decisions are made, or add fields in the skb and set the fields to values as they pass through different parts of the stack, then finally things which react to those fields. That's a lot quicker and more efficient than looking at every packet.