]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
cmdline: --list-app-layer-protos respects -c arg
authorJoshua Lumb <joshua.lumb@gmail.com>
Wed, 3 Jun 2020 12:24:40 +0000 (08:24 -0400)
committerVictor Julien <victor@inliniac.net>
Sat, 6 Jun 2020 12:26:02 +0000 (14:26 +0200)
src/suricata.c
src/util-running-modes.c
src/util-running-modes.h

index 567fcd4cfee3e6e959d59e8fd46ef51df4756648..675747dca7525c1bf16d757d36be51f58dac0967 100644 (file)
@@ -2064,7 +2064,11 @@ static int StartInternalRunMode(SCInstance *suri, int argc, char **argv)
             ListKeywords(suri->keyword_info);
             return TM_ECODE_DONE;
         case RUNMODE_LIST_APP_LAYERS:
-            ListAppLayerProtocols();
+            if (suri->conf_filename != NULL) {
+                ListAppLayerProtocols(suri->conf_filename);
+            } else {
+                ListAppLayerProtocols(DEFAULT_CONF_FILE);
+            }
             return TM_ECODE_DONE;
         case RUNMODE_PRINT_VERSION:
             PrintVersion();
index 9ff1cade0d80723be0c803acf17f3c56cb1f1c8f..42c91027643ea48d7a30c595245ed94e4939b453 100644 (file)
@@ -41,9 +41,9 @@ int ListKeywords(const char *keyword_info)
     exit(EXIT_SUCCESS);
 }
 
-int ListAppLayerProtocols()
+int ListAppLayerProtocols(const char *conf_filename)
 {
-    if (ConfYamlLoadFile(DEFAULT_CONF_FILE) != -1)
+    if (ConfYamlLoadFile(conf_filename) != -1)
         SCLogLoadConfig(0, 0);
     MpmTableSetup();
     SpmTableSetup();
index f047e02dde368dff05d67ab2eb7e79db634cd98c..ca3bc8c28dd3851a185b678421dbe835ca8edc17 100644 (file)
@@ -24,6 +24,6 @@
 #define __UTIL_RUNNING_MODES_H__
 
 int ListKeywords(const char *keyword_info);
-int ListAppLayerProtocols(void);
+int ListAppLayerProtocols(const char *conf_filename);
 
 #endif /* __UTIL_RUNNING_MODES_H__ */