]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-varlink: use MSG_PEEK for protocol_upgrade connections 41474/head
authorMichael Vogt <michael@amutable.com>
Tue, 7 Apr 2026 15:54:28 +0000 (17:54 +0200)
committerDaan De Meyer <daan@amutable.com>
Thu, 9 Apr 2026 11:02:11 +0000 (13:02 +0200)
commitcd6b57ff7060c344c7f3a2a779f2618e488bddaa
tree6e09723edd5f30f65771c42645611a8e21745f0f
parent34b9607e4e7621e93a8d3418799eac3e16be5d30
sd-varlink: use MSG_PEEK for protocol_upgrade connections

When there is a potential protocol upgrade we need to be careful that
we do not read beyond our json message as the custom protocol may be
anything. This was archived via a byte-by-byte read. This is of course
very inefficient. So this commit moves to use MSG_PEEK to find the
boundary of the json message instead. This makes the performance hit
a lot smaller.

Thanks to Lennart for suggesting this.
src/libsystemd/sd-varlink/sd-varlink.c