]> git.ipfire.org Git - thirdparty/strongswan.git/commit
whitelist: Use a watcher for control socket reading rather than blocking
authorRob Shearman <rob@graphiant.com>
Wed, 1 Jun 2022 18:41:08 +0000 (19:41 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 15 Jul 2025 12:50:56 +0000 (14:50 +0200)
commit412231eecd0af2d66937968ba9ef4d233725d859
tree9ac8f7336633d34c2e9dab75e7163283c2440828
parente98ea89d99fd6b2c31dae4673d8c44c8059498ce
whitelist: Use a watcher for control socket reading rather than blocking

Performing a stream read_all call (which is a blocking read) from
within the accept callback has the issue that if a whitelist client is
still connected whilst a shutdown of the charon deamon is triggered
then that shutdown won't complete gracefully due to the accept task
never exiting.

So fix shutting down gracefully by using the socket watcher rather than
a blocking read upon connection accept. Fall back to a blocking read
for partial messages to avoid the complexity associated (i.e. storing
state) for incomplete reads, which shouldn't block and cause the
original problem if the client only sends whole messages.
src/libcharon/plugins/whitelist/whitelist_control.c