diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 1e197885e5..effb1520ca 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -1541,14 +1541,14 @@ void *AppLayerProtoDetectGetCtxThread(void) for (i = 0; i < FLOW_PROTO_DEFAULT; i++) { for (j = 0; j < 2; j++) { - if (max_pat_id == 0) - { - max_pat_id = alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id; - } else if (alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id && - max_pat_id < alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id) - { - max_pat_id = alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id; - } + if (max_pat_id == 0) { + max_pat_id = alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id; + + } else if (alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id && + max_pat_id < alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id) + { + max_pat_id = alpd_ctx.ctx_ipp[i].ctx_pm[j].max_pat_id; + } } } @@ -1622,9 +1622,9 @@ AppProto AppLayerProtoDetectGetProtoByName(char *alproto_name) if (alpd_ctx.alproto_names[a] != NULL && strlen(alpd_ctx.alproto_names[a]) == strlen(alproto_name) && (SCMemcmp(alpd_ctx.alproto_names[a], alproto_name, strlen(alproto_name)) == 0)) - { - goto end; - } + { + goto end; + } } end: @@ -2666,27 +2666,6 @@ int AppLayerProtoDetectTest14(void) return r; } - - - - - - - - - - - - - - - - - - - - - typedef struct AppLayerProtoDetectPPTestDataElement_ { char *alproto_name; uint16_t alproto; diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index f6a3a78b74..0867e00df9 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -226,8 +226,7 @@ void *AppLayerParserGetCtxThread(void) for (i = 0; i < FLOW_PROTO_DEFAULT; i++) { for (j = 0; j < ALPROTO_MAX; j++) { tctx->alproto_local_storage[i][j] = - AppLayerParserGetProtocolParserLocalStorage(FlowGetReverseProtoMapping(i), - j); + AppLayerParserGetProtocolParserLocalStorage(FlowGetReverseProtoMapping(i), j); } } @@ -680,11 +679,11 @@ uint64_t AppLayerParserGetTransactionActive(uint16_t ipproto, AppProto alproto, { SCEnter(); - AppLayerParserParserState *pstate_1 = (AppLayerParserParserState *)pstate; + AppLayerParserParserState *state = (AppLayerParserParserState *)pstate; uint64_t active_id; - uint64_t log_id = pstate_1->log_id; - uint64_t inspect_id = pstate_1->inspect_id[direction & STREAM_TOSERVER ? 0 : 1]; + uint64_t log_id = state->log_id; + uint64_t inspect_id = state->inspect_id[direction & STREAM_TOSERVER ? 0 : 1]; if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].logger == TRUE) { active_id = (log_id < inspect_id) ? log_id : inspect_id; } else { @@ -756,9 +755,9 @@ int AppLayerParserParse(void *tctx, Flow *f, AppProto alproto, if (p->Parser[(flags & STREAM_TOSERVER) ? 0 : 1](f, alstate, pstate, input, input_len, alp_tctx->alproto_local_storage[FlowGetProtoMapping(f->proto)][alproto]) < 0) - { - goto error; - } + { + goto error; + } } /* set the packets to no inspection and reassembly if required */ diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 84ab9a6a24..5025763a0a 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -22,8 +22,8 @@ * \author Anoop Saldanha */ -#ifndef __APP_LAYER_PARSER__H__ -#define __APP_LAYER_PARSER__H__ +#ifndef __APP_LAYER_PARSER_H__ +#define __APP_LAYER_PARSER_H__ #include "decode-events.h" #include "util-file.h" @@ -189,4 +189,4 @@ void AppLayerParserBackupParserTable(void); void AppLayerParserRestoreParserTable(void); #endif -#endif /* __APP_LAYER_PARSER__H__ */ +#endif /* __APP_LAYER_PARSER_H__ */ diff --git a/src/app-layer-protos.h b/src/app-layer-protos.h index c48ff49c25..39c729c41a 100644 --- a/src/app-layer-protos.h +++ b/src/app-layer-protos.h @@ -22,8 +22,8 @@ * \author Anoop Saldanha */ -#ifndef __APP_LAYER_PROTOS__H__ -#define __APP_LAYER_PROTOS__H__ +#ifndef __APP_LAYER_PROTOS_H__ +#define __APP_LAYER_PROTOS_H__ enum { ALPROTO_UNKNOWN = 0, @@ -63,4 +63,4 @@ typedef uint16_t AppProto; */ const char *AppProtoToString(AppProto alproto); -#endif /* __APP_LAYER_PROTOS__H__ */ +#endif /* __APP_LAYER_PROTOS_H__ */ diff --git a/src/app-layer.c b/src/app-layer.c index a7b5c675b3..86fe6239fa 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -286,12 +286,12 @@ int AppLayerHandleTCPData(ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, */ if ((ssn->data_first_seen_dir != APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER) && (first_data_dir) && !(first_data_dir & flags)) - { - FlowSetSessionNoApplayerInspectionFlag(f); - StreamTcpSetStreamFlagAppProtoDetectionCompleted(&ssn->server); - StreamTcpSetStreamFlagAppProtoDetectionCompleted(&ssn->client); - goto failure; - } + { + FlowSetSessionNoApplayerInspectionFlag(f); + StreamTcpSetStreamFlagAppProtoDetectionCompleted(&ssn->server); + StreamTcpSetStreamFlagAppProtoDetectionCompleted(&ssn->client); + goto failure; + } if (data_len > 0) ssn->data_first_seen_dir = APP_LAYER_DATA_ALREADY_SENT_TO_APP_LAYER; diff --git a/src/app-layer.h b/src/app-layer.h index ed37f76577..f44106d51a 100644 --- a/src/app-layer.h +++ b/src/app-layer.h @@ -20,8 +20,8 @@ * \author Anoop Saldanha */ -#ifndef __APP_LAYER__H__ -#define __APP_LAYER__H__ +#ifndef __APP_LAYER_H__ +#define __APP_LAYER_H__ #include "threadvars.h" #include "decode.h"