static int g_mqtt_subscribe_topic_buffer_id = 0;
+static uint32_t subscribe_topic_match_limit = 100;
+
struct MQTTSubscribeTopicGetDataArgs {
uint32_t local_id;
void *txv;
transforms = engine->v2.transforms;
}
- while(1) {
+ while ((subscribe_topic_match_limit == 0) || local_id < subscribe_topic_match_limit) {
struct MQTTSubscribeTopicGetDataArgs cbdata = { local_id, txv, };
InspectionBuffer *buffer = MQTTSubscribeTopicGetData(det_ctx,
transforms, f, &cbdata, engine->sm_list, false);
const int list_id = ctx->list_id;
uint32_t local_id = 0;
- while(1) {
+ while ((subscribe_topic_match_limit == 0) || local_id < subscribe_topic_match_limit) {
struct MQTTSubscribeTopicGetDataArgs cbdata = { local_id, txv };
InspectionBuffer *buffer = MQTTSubscribeTopicGetData(det_ctx, ctx->transforms,
f, &cbdata, list_id, true);
sigmatch_table[DETECT_AL_MQTT_SUBSCRIBE_TOPIC].flags |= SIGMATCH_NOOPT;
sigmatch_table[DETECT_AL_MQTT_SUBSCRIBE_TOPIC].flags |= SIGMATCH_INFO_STICKY_BUFFER;
+ intmax_t val = 0;
+ if (ConfGetInt("mqtt.subscribe-topic-match-limit", &val)) {
+ subscribe_topic_match_limit = val;
+ }
+ if (subscribe_topic_match_limit <= 0) {
+ SCLogDebug("Using unrestricted MQTT SUBSCRIBE topic matching");
+ } else {
+ SCLogDebug("Using MQTT SUBSCRIBE topic match-limit setting of: %u",
+ subscribe_topic_match_limit);
+ }
DetectAppLayerMpmRegister2("mqtt.subscribe.topic", SIG_FLAG_TOSERVER, 1,
PrefilterMpmMQTTSubscribeTopicRegister, NULL,
static int g_mqtt_unsubscribe_topic_buffer_id = 0;
+static uint32_t unsubscribe_topic_match_limit = 100;
+
struct MQTTUnsubscribeTopicGetDataArgs {
uint32_t local_id;
void *txv;
transforms = engine->v2.transforms;
}
- while(1) {
+ while ((unsubscribe_topic_match_limit == 0) || local_id < unsubscribe_topic_match_limit) {
struct MQTTUnsubscribeTopicGetDataArgs cbdata = { local_id, txv, };
InspectionBuffer *buffer = MQTTUnsubscribeTopicGetData(det_ctx,
transforms, f, &cbdata, engine->sm_list, false);
const int list_id = ctx->list_id;
uint32_t local_id = 0;
- while(1) {
+ while ((unsubscribe_topic_match_limit == 0) || local_id < unsubscribe_topic_match_limit) {
struct MQTTUnsubscribeTopicGetDataArgs cbdata = { local_id, txv };
InspectionBuffer *buffer = MQTTUnsubscribeTopicGetData(det_ctx, ctx->transforms,
f, &cbdata, list_id, true);
sigmatch_table[DETECT_AL_MQTT_UNSUBSCRIBE_TOPIC].flags |= SIGMATCH_NOOPT;
sigmatch_table[DETECT_AL_MQTT_UNSUBSCRIBE_TOPIC].flags |= SIGMATCH_INFO_STICKY_BUFFER;
+ intmax_t val = 0;
+ if (ConfGetInt("mqtt.unsubscribe-topic-match-limit", &val)) {
+ unsubscribe_topic_match_limit = val;
+ }
+ if (unsubscribe_topic_match_limit <= 0) {
+ SCLogDebug("Using unrestricted MQTT UNSUBSCRIBE topic matching");
+ } else {
+ SCLogDebug("Using MQTT UNSUBSCRIBE topic match-limit setting of: %i",
+ unsubscribe_topic_match_limit);
+ }
DetectAppLayerMpmRegister2("mqtt.unsubscribe.topic", SIG_FLAG_TOSERVER, 1,
PrefilterMpmMQTTUnsubscribeTopicRegister, NULL,
match-limit: 3500
match-limit-recursion: 1500
+# MQTT topic detection depth
+#mqtt:
+# subscribe-topic-match-limit: 100
+# unsubscribe-topic-match-limit: 100
+
##
## Advanced Traffic Tracking and Reconstruction Settings
##