dbus-daemon: optionally capture all packets in pcap format
Submitted by Simon McVittie
Assigned to Simon McVittie
When profiling a boot or login process, it's useful to capture the entire message stream. Connecting dbus-monitor or bustle-pcap after the dbus-daemon starts is not enough: this would race with any other services that are connecting to the socket at the same time, whose messages might be dispatched before the dbus-monitor or bustle-pcap is ready to eavesdrop on them.
One possible solution is for development builds of dbus-daemon to support a way to write out the message stream. I think this should be in pcap format, because that's what Bustle already uses, it would be trivial to adapt dbus-monitor to read pcap format, and it supports packet truncation if we ever need it.
I know Colin ideally wants to have a "management socket" which speaks the full D-Bus protocol and can eavesdrop, receive control messages and other nice things, but that's pretty complicated. This implementation is much simpler: an optional <pcap_recipient/> in the configuration file contains a shell command, usually of the form "cat > $LOCATION". It receives pcap on its stdin, and... er... that's it.