]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
config: put version in configuration as a proper value
authorJason Ish <jason.ish@oisf.net>
Mon, 30 Jan 2023 23:13:04 +0000 (17:13 -0600)
committerVictor Julien <vjulien@oisf.net>
Tue, 28 Mar 2023 09:31:58 +0000 (11:31 +0200)
Adds a new field, "suricata-version" to the configuration file with
the major and minor version of the Suricata that generated the
configuration file.

This may be useful in the future for presenting warnings about
important changes, or even providing different defaults based on what
the user might expect.

Ticket: 5822

(cherry picked from commit c6c781ef677132d579b82e7860c83f9dbb2c7301)

configure.ac
suricata.yaml.in

index bb333a601c31cfe68dc38ec35fb59ad76e2f46e3..d93493a30ed28a27a50e8e21895d52daa4f81e4b 100644 (file)
@@ -2705,6 +2705,9 @@ return 0;
         fi
     fi
 
+# get MAJOR_MINOR version for embedding in configuration file.
+    MAJOR_MINOR=`expr "${PACKAGE_VERSION}" : "\([[0-9]]\+\.[[0-9]]\+\).*"`
+
 if test "${enable_ebpf}" = "yes" || test "${enable_unittests}" = "yes"; then
   AC_DEFINE([CAPTURE_OFFLOAD_MANAGER], [1],[Building flow bypass manager code])
 fi
@@ -2801,6 +2804,7 @@ AC_SUBST(CONFIGURE_SYSCONDIR)
 AC_SUBST(CONFIGURE_LOCALSTATEDIR)
 AC_SUBST(CONFIGURE_DATAROOTDIR)
 AC_SUBST(PACKAGE_VERSION)
+AC_SUBST(MAJOR_MINOR)
 AC_SUBST(RUST_FEATURES)
 AC_SUBST(RUST_SURICATA_LIBDIR)
 
index fd07cf42f51d8bb3559bef7f255ba8d302ca3ac6..42ba0576d309d140f38e4871b0b62943467d73a5 100644 (file)
@@ -4,9 +4,9 @@
 # Suricata configuration file. In addition to the comments describing all
 # options in this file, full documentation can be found at:
 # https://suricata.readthedocs.io/en/latest/configuration/suricata-yaml.html
-#
-# This configuration file generated by:
-#     Suricata @PACKAGE_VERSION@
+
+# This configuration file generated by Suricata @PACKAGE_VERSION@.
+suricata-version: "@MAJOR_MINOR@"
 
 ##
 ## Step 1: Inform Suricata about your network