From b11cc0fbcd654af53dd66c3e280e6d3c4d7b7f23 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 20 Oct 2020 11:04:17 +0200 Subject: [PATCH] detect/nfs: convert to v2 inspect API --- src/detect-nfs-procedure.c | 27 +++++++++++---------------- src/detect-nfs-version.c | 27 +++++++++++---------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/detect-nfs-procedure.c b/src/detect-nfs-procedure.c index b73c331238..fc51af7208 100644 --- a/src/detect-nfs-procedure.c +++ b/src/detect-nfs-procedure.c @@ -76,11 +76,9 @@ static void DetectNfsProcedureRegisterTests(void); #endif static int g_nfs_request_buffer_id = 0; -static int DetectEngineInspectNfsRequestGeneric(ThreadVars *tv, - DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, - const Signature *s, const SigMatchData *smd, - Flow *f, uint8_t flags, void *alstate, - void *txv, uint64_t tx_id); +static int DetectEngineInspectNfsRequestGeneric(DetectEngineCtx *de_ctx, + DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, + const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id); static int DetectNfsProcedureMatch (DetectEngineThreadCtx *, Flow *, uint8_t, void *, void *, const Signature *, @@ -104,23 +102,20 @@ void DetectNfsProcedureRegister (void) DetectSetupParseRegexes(PARSE_REGEX, &parse_regex); - DetectAppLayerInspectEngineRegister("nfs_request", - ALPROTO_NFS, SIG_FLAG_TOSERVER, 0, - DetectEngineInspectNfsRequestGeneric); + DetectAppLayerInspectEngineRegister2("nfs_request", ALPROTO_NFS, SIG_FLAG_TOSERVER, 0, + DetectEngineInspectNfsRequestGeneric, NULL); g_nfs_request_buffer_id = DetectBufferTypeGetByName("nfs_request"); SCLogDebug("g_nfs_request_buffer_id %d", g_nfs_request_buffer_id); } -static int DetectEngineInspectNfsRequestGeneric(ThreadVars *tv, - DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, - const Signature *s, const SigMatchData *smd, - Flow *f, uint8_t flags, void *alstate, - void *txv, uint64_t tx_id) +static int DetectEngineInspectNfsRequestGeneric(DetectEngineCtx *de_ctx, + DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, + const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd, - f, flags, alstate, txv, tx_id); + return DetectEngineInspectGenericList( + NULL, de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id); } static inline int @@ -632,4 +627,4 @@ void DetectNfsProcedureRegisterTests(void) UtRegisterTest("ValidityTestParse14", ValidityTestParse14); UtRegisterTest("ValidityTestParse15", ValidityTestParse15); } -#endif /* UNITTESTS */ \ No newline at end of file +#endif /* UNITTESTS */ diff --git a/src/detect-nfs-version.c b/src/detect-nfs-version.c index 2f8ef69575..f65753b2ae 100644 --- a/src/detect-nfs-version.c +++ b/src/detect-nfs-version.c @@ -76,11 +76,9 @@ static void DetectNfsVersionRegisterTests(void); #endif static int g_nfs_request_buffer_id = 0; -static int DetectEngineInspectNfsRequestGeneric(ThreadVars *tv, - DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, - const Signature *s, const SigMatchData *smd, - Flow *f, uint8_t flags, void *alstate, - void *txv, uint64_t tx_id); +static int DetectEngineInspectNfsRequestGeneric(DetectEngineCtx *de_ctx, + DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, + const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id); static int DetectNfsVersionMatch (DetectEngineThreadCtx *, Flow *, uint8_t, void *, void *, const Signature *, @@ -103,23 +101,20 @@ void DetectNfsVersionRegister (void) #endif DetectSetupParseRegexes(PARSE_REGEX, &parse_regex); - DetectAppLayerInspectEngineRegister("nfs_request", - ALPROTO_NFS, SIG_FLAG_TOSERVER, 0, - DetectEngineInspectNfsRequestGeneric); + DetectAppLayerInspectEngineRegister2("nfs_request", ALPROTO_NFS, SIG_FLAG_TOSERVER, 0, + DetectEngineInspectNfsRequestGeneric, NULL); g_nfs_request_buffer_id = DetectBufferTypeGetByName("nfs_request"); SCLogDebug("g_nfs_request_buffer_id %d", g_nfs_request_buffer_id); } -static int DetectEngineInspectNfsRequestGeneric(ThreadVars *tv, - DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, - const Signature *s, const SigMatchData *smd, - Flow *f, uint8_t flags, void *alstate, - void *txv, uint64_t tx_id) +static int DetectEngineInspectNfsRequestGeneric(DetectEngineCtx *de_ctx, + DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, + const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd, - f, flags, alstate, txv, tx_id); + return DetectEngineInspectGenericList( + NULL, de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id); } static inline int @@ -619,4 +614,4 @@ void DetectNfsVersionRegisterTests(void) UtRegisterTest("ValidityTestParse14", ValidityTestParse14); UtRegisterTest("ValidityTestParse15", ValidityTestParse15); } -#endif /* UNITTESTS */ \ No newline at end of file +#endif /* UNITTESTS */