]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Bugfix for detect-engine.luajit-states
authorTorgeir Natvig <torgeir.natvig@gmail.com>
Fri, 16 Oct 2015 22:44:49 +0000 (00:44 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 20 Oct 2015 17:10:33 +0000 (19:10 +0200)
detect-engine is a list, and luajit-states was looked up as a map.

src/detect-lua.c

index d5da19d81eecb333bdb7ea995eb3e21a7e1045b9..a3eead4a9e12dc1e73a18ff23de2403bc30d9593 100644 (file)
@@ -192,12 +192,18 @@ int DetectLuajitSetupStatesPool(int num, int reloads)
     pthread_mutex_lock(&luajit_states_lock);
 
     if (luajit_states == NULL) {
-        int cnt = 0;
-        char *conf_val = NULL;
+        intmax_t cnt = 0;
+        ConfNode *denode = NULL;
+        ConfNode *decnf = ConfGetNode("detect-engine");
+        if (decnf != NULL) {
+            TAILQ_FOREACH(denode, &decnf->head, next) {
+                if (strcmp(denode->val, "luajit-states") == 0) {
+                    ConfGetChildValueInt(denode, "luajit-states", &cnt);
+                }
+            }
+        }
 
-        if ((ConfGet("detect-engine.luajit-states", &conf_val)) == 1) {
-            cnt = (int)atoi(conf_val);
-        } else {
+        if (cnt == 0) {
             int cpus = UtilCpuGetNumProcessorsOnline();
             if (cpus == 0) {
                 cpus = 10;