exit(EXIT_FAILURE);
}
+ /* register name here as well so pp only protocols will work */
+ if (al_proto_table[proto].name != NULL) {
+ BUG_ON(strcmp(al_proto_table[proto].name, name) != 0);
+ } else {
+ al_proto_table[proto].name = name;
+ }
+
al_parser_table[al_max_parsers].name = name;
al_parser_table[al_max_parsers].AppLayerParser = AppLayerParser;
char buffer[50] = "";
strlcpy(buffer, arg, p_idx - arg + 1); /* + 1 for trailing \0 */
- //int module_id = DecoderEventModuleGetModuleId(buffer);
- //uint16_t alproto = AppLayerGetProtoByName(buffer);
+ /** XXX HACK to support "dns" we use this trick */
+ if (strcasecmp(buffer, "dns") == 0)
+ strlcpy(buffer, "dnsudp", sizeof(buffer));
+
uint16_t alproto = AppLayerDecoderEventsModuleGetAlproto(buffer);
- if (alproto == ALPROTO_UNKNOWN)
+ if (alproto == ALPROTO_UNKNOWN) {
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword supplied "
+ "with unknown protocol \"%s\"", buffer);
return NULL;
+ }
int event_id = AppLayerDecoderEventsModuleGetEventId(alproto, p_idx + 1);
- if (event_id == -1)
+ if (event_id == -1) {
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "app-layer-event keyword protocol "
+ "\"%s\" don't have event \"%s\" registered", buffer, p_idx + 1);
return NULL;
+ }
DetectAppLayerEventData *aled = SCMalloc(sizeof(DetectAppLayerEventData));
if (unlikely(aled == NULL))
}
als = als->next;
}
+ /** VJ since our dns parser uses only pp, this is required to set
+ * ipprotos */
+ AppLayerProbingParserInfo *ppi =
+ AppLayerGetProbingParserInfo(alp_proto_ctx.probing_parsers_info,
+ protostr);
+ if (ppi != NULL) {
+ /* indicate that the signature is app-layer */
+ s->flags |= SIG_FLAG_APPLAYER;
+ s->alproto = ppi->al_proto;
+ s->proto.proto[ppi->ip_proto / 8] |= 1 << (ppi->ip_proto % 8);
+ }
SCReturnInt(0);
}
AppLayerProbingParserInfo *ppi =
goto error;
/* Parse Proto */
- if (SigParseProto(s, arr[CONFIG_PROTO]) < 0)
- goto error;
+ if (strcasecmp(arr[CONFIG_PROTO], "dns") == 0) {
+ /** XXX HACK */
+ if (SigParseProto(s, "dnstcp") < 0)
+ goto error;
+ if (SigParseProto(s, "dnsudp") < 0)
+ goto error;
+
+ } else {
+ if (SigParseProto(s, arr[CONFIG_PROTO]) < 0)
+ goto error;
+ }
if (strcmp(arr[CONFIG_DIREC], "<-") == 0) {
SCLogError(SC_ERR_INVALID_DIRECTION, "\"<-\" is not a valid direction modifier, \"->\" and \"<>\" are supported.");