|
|
|
@ -192,7 +192,8 @@ int UnixNew(UnixCommand * this)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UnixCommandSetMaxFD(UnixCommand *this) {
|
|
|
|
|
void UnixCommandSetMaxFD(UnixCommand *this)
|
|
|
|
|
{
|
|
|
|
|
UnixClient *item;
|
|
|
|
|
|
|
|
|
|
if (this == NULL) {
|
|
|
|
@ -508,7 +509,7 @@ int UnixMain(UnixCommand * this)
|
|
|
|
|
|
|
|
|
|
/* catch select() error */
|
|
|
|
|
if (ret == -1) {
|
|
|
|
|
/* Signal was catched: just ignore it */
|
|
|
|
|
/* Signal was caught: just ignore it */
|
|
|
|
|
if (errno == EINTR) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
@ -706,7 +707,8 @@ TmEcode UnixManagerReloadRules(json_t *cmd,
|
|
|
|
|
SCEnter();
|
|
|
|
|
if (suricata_ctl_flags != 0) {
|
|
|
|
|
json_object_set_new(server_msg, "message",
|
|
|
|
|
json_string("Live rule swap no longer possible. Engine in shutdown mode."));
|
|
|
|
|
json_string("Live rule swap no longer possible."
|
|
|
|
|
" Engine in shutdown mode."));
|
|
|
|
|
SCReturn(TM_ECODE_FAILED);
|
|
|
|
|
} else {
|
|
|
|
|
/* FIXME : need to check option value */
|
|
|
|
@ -732,7 +734,7 @@ static UnixCommand command;
|
|
|
|
|
*
|
|
|
|
|
* \param keyword name of the command
|
|
|
|
|
* \param Func function to run when command is received
|
|
|
|
|
* \param data a pointer to data that are pass to Func when runned
|
|
|
|
|
* \param data a pointer to data that are passed to Func when it is run
|
|
|
|
|
* \param flags a flag now used to tune the command type
|
|
|
|
|
* \retval TM_ECODE_OK in case of success, TM_ECODE_FAILED in case of failure
|
|
|
|
|
*/
|
|
|
|
@ -784,15 +786,14 @@ TmEcode UnixManagerRegisterCommand(const char * keyword,
|
|
|
|
|
/**
|
|
|
|
|
* \brief Add a task to the list of tasks
|
|
|
|
|
*
|
|
|
|
|
* This function adds a task to run in background. The task is runned
|
|
|
|
|
* each time the UnixMain() function exit from select.
|
|
|
|
|
* This function adds a task to run in the background. The task is run
|
|
|
|
|
* each time the UnixMain() function exits from select.
|
|
|
|
|
*
|
|
|
|
|
* \param Func function to run when command is received
|
|
|
|
|
* \param data a pointer to data that are pass to Func when runned
|
|
|
|
|
* \param Func function to run when a command is received
|
|
|
|
|
* \param data a pointer to data that are passed to Func when it is run
|
|
|
|
|
* \retval TM_ECODE_OK in case of success, TM_ECODE_FAILED in case of failure
|
|
|
|
|
*/
|
|
|
|
|
TmEcode UnixManagerRegisterBackgroundTask(
|
|
|
|
|
TmEcode (*Func)(void *),
|
|
|
|
|
TmEcode UnixManagerRegisterBackgroundTask(TmEcode (*Func)(void *),
|
|
|
|
|
void *data)
|
|
|
|
|
{
|
|
|
|
|
SCEnter();
|
|
|
|
@ -816,8 +817,6 @@ TmEcode UnixManagerRegisterBackgroundTask(
|
|
|
|
|
SCReturnInt(TM_ECODE_OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void *UnixManagerThread(void *td)
|
|
|
|
|
{
|
|
|
|
|
ThreadVars *th_v = (ThreadVars *)td;
|
|
|
|
@ -890,7 +889,7 @@ void *UnixManagerThread(void *td)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** \brief spawn the unix socket manager thread
|
|
|
|
|
/** \brief Spawn the unix socket manager thread
|
|
|
|
|
*
|
|
|
|
|
* \param de_ctx context for detection engine
|
|
|
|
|
* \param mode if set to 1, init failure cause suricata exit
|
|
|
|
@ -939,8 +938,9 @@ void UnixSocketKillSocketThread(void)
|
|
|
|
|
|
|
|
|
|
while (tv != NULL) {
|
|
|
|
|
if (strcasecmp(tv->name, "UnixManagerThread") == 0) {
|
|
|
|
|
/* If thread die during init it will have THV_RUNNING_DONE
|
|
|
|
|
* set. So we can set the correct flag and exit.
|
|
|
|
|
/* If the thread dies during init it will have
|
|
|
|
|
* THV_RUNNING_DONE set, so we can set the correct flag
|
|
|
|
|
* and exit.
|
|
|
|
|
*/
|
|
|
|
|
if (TmThreadsCheckFlag(tv, THV_RUNNING_DONE)) {
|
|
|
|
|
TmThreadsSetFlag(tv, THV_KILL);
|
|
|
|
@ -950,7 +950,7 @@ void UnixSocketKillSocketThread(void)
|
|
|
|
|
}
|
|
|
|
|
TmThreadsSetFlag(tv, THV_KILL);
|
|
|
|
|
TmThreadsSetFlag(tv, THV_DEINIT);
|
|
|
|
|
/* be sure it has shut down */
|
|
|
|
|
/* Be sure it has shut down */
|
|
|
|
|
while (!TmThreadsCheckFlag(tv, THV_CLOSED)) {
|
|
|
|
|
usleep(100);
|
|
|
|
|
}
|
|
|
|
|