From ab10c0a099599ae40e9060c063c8b33c7d189bc5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 13 Feb 2014 15:48:35 +0100 Subject: [PATCH] app-layer: tell pp registrar if config was found The probing parser registration function AppLayerProtoDetectPPParseConfPorts was a void, meaning it would give no feedback to the registering protocol implementation. If a config was missing, it would just give up. This patch changes it to return a bool. 0 if no config was found, 1 if a config was found. This allows the caller to setup a default case. --- src/app-layer-detect-proto.c | 6 ++++-- src/app-layer-detect-proto.h | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index ce5c8c2528..ccf3353d12 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -1325,7 +1325,7 @@ void AppLayerProtoDetectPPRegister(uint8_t ipproto, SCReturn; } -void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, +int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, uint8_t ipproto, const char *alproto_name, AppProto alproto, @@ -1338,6 +1338,7 @@ void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, int r; ConfNode *node; ConfNode *port_node = NULL; + int config = 0; r = snprintf(param, sizeof(param), "%s%s%s", "app-layer.protocols.", alproto_name, ".detection-ports"); @@ -1386,8 +1387,9 @@ void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, } + config = 1; end: - SCReturn; + SCReturnInt(config); } /***** PM registration *****/ diff --git a/src/app-layer-detect-proto.h b/src/app-layer-detect-proto.h index 844736dca3..81b75fe392 100644 --- a/src/app-layer-detect-proto.h +++ b/src/app-layer-detect-proto.h @@ -66,7 +66,10 @@ void AppLayerProtoDetectPPRegister(uint8_t ipproto, uint16_t min_depth, uint16_t max_depth, uint8_t direction, ProbingParserFPtr ProbingParser); -void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, +/** + * \retval bool 0 if no config was found, 1 if config was found + */ +int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, uint8_t ipproto, const char *alproto_name, AppProto alproto,