]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: tell pp registrar if config was found
authorVictor Julien <victor@inliniac.net>
Thu, 13 Feb 2014 14:48:35 +0000 (15:48 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 13 Feb 2014 14:48:35 +0000 (15:48 +0100)
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
src/app-layer-detect-proto.h

index ce5c8c2528f667c76a4cfdc918f5c1f926863889..ccf3353d12fb56d982935f9920565f16074dab51 100644 (file)
@@ -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 *****/
index 844736dca322faa3e46d0b8abfaed82036d8c260..81b75fe392be69121b4ce2c733a9db0c9f771d08 100644 (file)
@@ -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,