]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/dns: default to eve log version 2 for rust 3288/head
authorVictor Julien <victor@inliniac.net>
Wed, 14 Mar 2018 15:58:45 +0000 (16:58 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 15 Mar 2018 09:00:23 +0000 (10:00 +0100)
src/output-json-dns.c

index 021efdc937b72b43fab3f733b5732b59c2900b1b..e21f7d59fd8d9acdcdaae8a2b2735022901f970d 100644 (file)
@@ -196,6 +196,12 @@ typedef enum {
     DNS_VERSION_2
 } DnsVersion;
 
+#ifdef HAVE_RUST
+#define DNS_VERSION_DEFAULT DNS_VERSION_2
+#else
+#define DNS_VERSION_DEFAULT DNS_VERSION_1
+#endif
+
 static struct {
     const char *config_rrtype;
     uint64_t flags;
@@ -1216,10 +1222,10 @@ static void JsonDnsLogParseConfig(LogDnsFileCtx *dnslog_ctx, ConfNode *conf,
 static DnsVersion JsonDnsParseVersion(ConfNode *conf)
 {
     if (conf == NULL) {
-        return DNS_VERSION_1;
+        return DNS_VERSION_DEFAULT;
     }
 
-    DnsVersion version = DNS_VERSION_1;
+    DnsVersion version = DNS_VERSION_DEFAULT;
     intmax_t config_version;
     if (ConfGetChildValueInt(conf, "version", &config_version)) {
         switch(config_version) {
@@ -1231,17 +1237,24 @@ static DnsVersion JsonDnsParseVersion(ConfNode *conf)
                 break;
             default:
                 SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                        "Invalid version option: %ji, "
-                        "forcing it to version 1", config_version);
-                version = DNS_VERSION_1;
+                        "invalid eve-log dns version option: %"PRIuMAX", "
+                        "forcing it to version %u",
+                        config_version, DNS_VERSION_DEFAULT);
+                version = DNS_VERSION_DEFAULT;
                 break;
         }
     } else {
         SCLogWarning(SC_ERR_INVALID_ARGUMENT,
-                "Version not found, forcing it to version 1");
-        version = DNS_VERSION_1;
+                "version not found, forcing it to version %u",
+                DNS_VERSION_DEFAULT);
+        version = DNS_VERSION_DEFAULT;
     }
-
+#ifdef HAVE_RUST
+    if (version != DNS_VERSION_2) {
+        FatalError(SC_ERR_NOT_SUPPORTED, "EVE/DNS version %d not support with "
+                "by Rust builds.", version);
+    }
+#endif
     return version;
 }
 
@@ -1285,13 +1298,6 @@ static OutputInitResult JsonDnsLogInitCtxSub(ConfNode *conf, OutputCtx *parent_c
     }
 
     DnsVersion version = JsonDnsParseVersion(conf);
-#ifdef HAVE_RUST
-    if (version != 2) {
-        SCLogError(SC_ERR_NOT_SUPPORTED, "EVE/DNS version %d not support with "
-                "by Rust builds.", version);
-        exit(1);
-    }
-#endif
 
     OutputJsonCtx *ojc = parent_ctx->data;