]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve: improve error handling for Rust loggers
authorVictor Julien <victor@inliniac.net>
Fri, 19 Oct 2018 14:54:38 +0000 (16:54 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 19 Oct 2018 14:55:37 +0000 (16:55 +0200)
Give useful warning message if Rust is not compiled in.

src/runmodes.c
src/util-error.c
src/util-error.h

index ca72e53e1f2d1a722f6443d84bd31f058d4a27b0..acb1b6c7d6876c47b9ad2e0904247e5905607e57 100644 (file)
@@ -662,6 +662,22 @@ static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx)
         /* Error is no registered loggers with this name
          * were found .*/
         if (!sub_count) {
+#ifndef HAVE_RUST
+            const char *rust_types[] = { "eve-log.smb", "eve-log.nfs",
+                "eve-log.dhcp", "eve-log.krb5", "eve-log.ikev2",
+                "eve-log.tftp", NULL, };
+            const char **iter = rust_types;
+            bool is_rust = false;
+            while (*iter) {
+                is_rust |= (strcmp(*iter, subname) == 0);
+                iter++;
+            }
+            if (is_rust) {
+                SCLogWarning(SC_WARN_RUST_NOT_AVAILABLE, "output "
+                    "module '%s' depends on Rust support", subname);
+                continue;
+            }
+#endif
             FatalErrorOnInit(SC_ERR_INVALID_ARGUMENT,
                     "No output module named %s", subname);
             continue;
index 7fc7dd6f178ffb9dbc69e0c5024de5742e64cbcc..ecdfe57d3f6b4bc58c3410e1c3265c2b37dc60ed 100644 (file)
@@ -356,6 +356,7 @@ const char * SCErrorToString(SCError err)
         CASE_CODE (SC_ERR_WINDIVERT_NOSUPPORT);
         CASE_CODE (SC_ERR_WINDIVERT_INVALID_FILTER);
         CASE_CODE (SC_ERR_WINDIVERT_TOOLONG_FILTER);
+        CASE_CODE (SC_WARN_RUST_NOT_AVAILABLE);
 
         CASE_CODE (SC_ERR_MAX);
     }
index 8e9015753f680f370cdb01bae451f308c3316e20..cfa74b0212f0d7a0f2ef7f29eeae5d2e347b7d89 100644 (file)
@@ -346,6 +346,7 @@ typedef enum {
     SC_ERR_WINDIVERT_NOSUPPORT,
     SC_ERR_WINDIVERT_INVALID_FILTER,
     SC_ERR_WINDIVERT_TOOLONG_FILTER,
+    SC_WARN_RUST_NOT_AVAILABLE,
 
     SC_ERR_MAX,
 } SCError;