From: Joshua Lumb Date: Wed, 3 Jun 2020 12:24:40 +0000 (-0400) Subject: cmdline: --list-app-layer-protos respects -c arg X-Git-Tag: suricata-6.0.0-beta1~352 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82fb72678fbac41628c4bbe7fbf950941f672bda;p=thirdparty%2Fsuricata.git cmdline: --list-app-layer-protos respects -c arg --- diff --git a/src/suricata.c b/src/suricata.c index 567fcd4cfe..675747dca7 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -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(); diff --git a/src/util-running-modes.c b/src/util-running-modes.c index 9ff1cade0d..42c9102764 100644 --- a/src/util-running-modes.c +++ b/src/util-running-modes.c @@ -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(); diff --git a/src/util-running-modes.h b/src/util-running-modes.h index f047e02dde..ca3bc8c28d 100644 --- a/src/util-running-modes.h +++ b/src/util-running-modes.h @@ -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__ */