[systemd-devel] Monitoring services start event from kdbus with sd-bus API

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jun 30 03:41:34 PDT 2015


On 30/06/15 10:15, Thomas Schmidt wrote:
> r = sd_bus_add_match(bus, NULL, "", do_something_callback,  NULL); /* should not filter anything, I expect it triggers on any message */ 

"Eavesdropping" (adding match rules with AddMatch to receive messages
that are neither a broadcast, nor directed to you) has never worked
reliably on the system bus in traditional D-Bus, cannot be made reliable
on the system bus without introducing security flaws, and does not exist
at all in kdbus.

"Monitoring" is the modern replacement for eavesdropping: it puts your
connection in a special mode where it receives other people's messages,
but cannot send messages or do other normal D-Bus things. kdbus has only
ever had monitoring, not eavesdropping, and I added a vaguely similar
monitoring mode to dbus-daemon in the 1.9.x development branch.

Monitoring and eavesdropping are both unusual things that should only be
used as a diagnostic, and not in production code. Think of them as
equivalent to putting your network interface in "promiscuous mode" for
something like tcpdump - you can do that as a developer or sysadmin to
debug problems or detect bad behaviour, but you shouldn't write ordinary
networking applications that rely on it.

> The interesting thing is that this code only sees „signal“ type  messages - but not any other like „method_call“.

That is consistent with the way in which eavesdropping has never really
worked as intended on the system bus.

Further reading: <https://bugs.freedesktop.org/show_bug.cgi?id=46787>

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>


More information about the systemd-devel mailing list