libink: a broker peer is not an ordinary client

libink was written peer to peer, where one connection is one client
and one principal.  Attaching to a message bus breaks both halves of
that, and two things followed from it.

Signals never reached the system bus.  Fan-out is gated on the peer
having sent AddMatch, but a broker subscribes for its own clients and
never sends us one, so every ServiceStateChanged was dropped on the
floor.  A connection attached with LINK_ATTACH_BROKER gets them all.

Hello, AddMatch and RemoveMatch write per-connection state.  Shared by
every caller behind a broker, that lets one sender exhaust the match
cap or drop another's rule, so we leave all three to the bus, whose
job they are.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-08-13 10:14:48 +02:00
1 parent abab0e0fd4
commit c71ccce742
6 files changed
+38 -9

No files matched your search

+3 -1
View File
@@ -91,9 +91,11 @@ struct link_connection {
/* Match rules registered via org.freedesktop.DBus.AddMatch.
* Bounded for PID 1 hygiene; a peer that exceeds the cap gets
* a LimitsExceeded error reply. */
* a LimitsExceeded error reply. A broker never registers any,
* it matches for its own clients, so `broker` bypasses them. */
struct link_match *matches[LINK_MATCH_PEER_CAP];
size_t matches_count;
int broker;
uint8_t rxbuf[LINK_RX_BUF_SIZE];
size_t rxlen;