]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
setup-app-layer-logger.sh: update for logging changes
authorJason Ish <ish@unx.ca>
Mon, 12 Sep 2016 16:39:14 +0000 (10:39 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 19 Sep 2016 11:48:03 +0000 (13:48 +0200)
scripts/setup-app-layer-logger.sh

index 13342412ed949f257c1ac77113c8747129e8e6f5..51f8e6d105f1b55c101e7a81cc50685d0d0e19c4 100755 (executable)
@@ -69,40 +69,35 @@ w
 EOF
 }
 
-function patch_suricata_c() {
-    filename="src/suricata.c"
+patch_suricata_common_h() {
+    filename="src/suricata-common.h"
     echo "Patching ${filename}."
     ed -s ${filename} > /dev/null <<EOF
-/#include "output-json-template.h"
-t-
-s/template/${protoname_lower}/
-/TmModuleJsonTemplateLogRegister
--
-.,+t-
--
-.,+s/Template/${protoname}/
-w
-EOF
-}
-
-patch_tm_modules_c() {
-    filename="src/tm-modules.c"
-    echo "Patching ${filename}."
-    ed -s ${filename} > /dev/null <<EOF
-/TMM_JSONTEMPLATELOG
+/LOGGER_JSON_TEMPLATE
 t-
 s/TEMPLATE/${protoname_upper}
 w
 EOF
 }
 
-patch_tm_threads_common_h() {
-    filename="src/tm-threads-common.h"
+function patch_output_c() {
+    filename="src/output.c"
     echo "Patching ${filename}."
     ed -s ${filename} > /dev/null <<EOF
-/TMM_JSONTEMPLATELOG
+# Find #include output-json-template.h and duplicate it for new protocol.
+/#include "output-json-template.h"
 t-
-s/TEMPLATE/${protoname_upper}
+s/template/${protoname_lower}/
+# Find JsonTemplateLogRegister() then backup one line to its comment.
+/JsonTemplateLogRegister
+-
+# Copy the current line and the next line up a line.
+.,+t-
+# Go back a line so we're at the first copied line.
+-
+# Now rename to the new protocol name.
+.,+s/Template/${protoname}/
+# Write.
 w
 EOF
 }
@@ -138,9 +133,8 @@ fi
 
 copy_templates
 patch_makefile_am
-patch_suricata_c
-patch_tm_modules_c
-patch_tm_threads_common_h
+patch_suricata_common_h
+patch_output_c
 patch_suricata_yaml_in
 
 cat <<EOF