]> git.ipfire.org Git - thirdparty/suricata.git/commit
unix-manager: prioritize the shutdown check
authorLukas Sismis <lsismis@oisf.net>
Mon, 25 Sep 2023 13:37:07 +0000 (15:37 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 30 Oct 2023 18:33:24 +0000 (19:33 +0100)
commit292fda88b4a7dd9f099cf50e044c601cd5f00f9d
tree0f4a91b4e48a8da0a8b093cf1d5afd3a039ba0dc
parenta9851430e2d7dd6c919f7332b71f222b889b835f
unix-manager: prioritize the shutdown check

Make sure Suricata is in the running state before
you attempt to execute commands on the Unix sockets.
UnixMain is being called in an infinite loop where
TmThreadsCheckFlag(th_v, THV_KILL) is checked for the
deinit phase. However, it may take some time between
the start of Suricata's deinitialization and
the receipt of THV_KILL flag in the Unix thread.

In between this time period, the Unix manager can still
perform select() operation on the Unix socket while
the socket being already deinitialized.

Likely with a longer time span between the initial shutdown
command and actual closing of Unix sockets resulted in
an error of invalid file descriptors.

Ticket: #6272
src/unix-manager.c