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
@@ -162,7 +162,8 @@ int link_server_accept(link_server_t *srv, link_connection_t **out)
return 0;
}
link_connection_t *link_server_attach(link_server_t *srv, int fd, uid_t peer_uid)
link_connection_t *link_server_attach(link_server_t *srv, int fd, uid_t peer_uid,
unsigned int attach_flags)
{
link_connection_t *conn;
int flags;
@@ -194,6 +195,7 @@ link_connection_t *link_server_attach(link_server_t *srv, int fd, uid_t peer_uid
conn->auth = LINK_AUTH_DONE; /* caller already handshook */
conn->server = srv;
conn->peer_uid = peer_uid;
conn->broker = !!(attach_flags & LINK_ATTACH_BROKER);
__auth_generate_guid(conn->guid);
return conn;