]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
file: remove unused flag
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 9 Jul 2025 10:00:20 +0000 (12:00 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 5 Aug 2025 09:26:26 +0000 (11:26 +0200)
FLOWFILE_NO_SIZE_* are unused, whose removal shows that
SIG_GROUP_HEAD_HAVEFILESIZE gets unused, whose removal shows that
SignatureIsFilesizeInspecting gets unused

src/detect-engine-build.c
src/detect-engine-build.h
src/detect-engine-siggroup.c
src/detect.c
src/detect.h
src/flow.c
src/flow.h
src/util-file.c

index 4d3aac45385c933892165c9a4d0b5e342a07f7a7..f356e5beff8ab79e54e0defbc6029c8fb6fd1372 100644 (file)
@@ -176,25 +176,6 @@ int SignatureIsFileSha256Inspecting(const Signature *s)
     return 0;
 }
 
-/**
- *  \brief Check if a signature contains the filesize keyword.
- *
- *  \param s signature
- *
- *  \retval 0 no
- *  \retval 1 yes
- */
-int SignatureIsFilesizeInspecting(const Signature *s)
-{
-    if (s == NULL)
-        return 0;
-
-    if (s->file_flags & FILE_SIG_NEED_SIZE)
-        return 1;
-
-    return 0;
-}
-
 static bool SignatureInspectsBuffers(const Signature *s)
 {
     return (s->init_data->buffer_index > 0);
index a61a930f9a05da3b12cbc16dc3c5fe4bea014d7a..bb83682c700b253ce37c94fadb3b7063e850c03f 100644 (file)
@@ -26,7 +26,6 @@ int SignatureIsFilemagicInspecting(const Signature *);
 int SignatureIsFileMd5Inspecting(const Signature *);
 int SignatureIsFileSha1Inspecting(const Signature *s);
 int SignatureIsFileSha256Inspecting(const Signature *s);
-int SignatureIsFilesizeInspecting(const Signature *);
 void SignatureSetType(DetectEngineCtx *de_ctx, Signature *s);
 
 int SigPrepareStage1(DetectEngineCtx *de_ctx);
index 2163010e58c4f7befd8b773160aee1c23f5e49b1..a852e241e07acb82cc02eebcff8c80a1f656c432 100644 (file)
@@ -580,9 +580,6 @@ void SigGroupHeadSetupFiles(const DetectEngineCtx *de_ctx, SigGroupHead *sgh)
         if (s == NULL)
             continue;
 
-        if (SignatureIsFilesizeInspecting(s)) {
-            sgh->flags |= SIG_GROUP_HEAD_HAVEFILESIZE;
-        }
         if (SignatureIsFileMd5Inspecting(s)) {
             sgh->flags |= SIG_GROUP_HEAD_HAVEFILEMD5;
             SCLogDebug("sgh %p has filemd5", sgh);
index e6e297ca7378baf7c5bd272cc738cdfc04156f8a..a86d99973accabf976e8ad0811f66133619e8927 100644 (file)
@@ -386,10 +386,6 @@ DetectPostInspectFileFlagsUpdate(Flow *f, const SigGroupHead *sgh, uint8_t direc
             SCLogDebug("requesting disabling sha256 for flow");
             flow_file_flags |= (FLOWFILE_NO_SHA256_TS|FLOWFILE_NO_SHA256_TC);
         }
-        if (!(sgh->flags & SIG_GROUP_HEAD_HAVEFILESIZE)) {
-            SCLogDebug("requesting disabling filesize for flow");
-            flow_file_flags |= (FLOWFILE_NO_SIZE_TS|FLOWFILE_NO_SIZE_TC);
-        }
     }
     if (flow_file_flags != 0) {
         FileUpdateFlowFileFlags(f, flow_file_flags, direction);
index 5d06bd0937885a8b62f1f7c8a0cfdb66818d3af0..c7c709b4cadd0bd4a810a61d2b016a74fdf6367f 100644 (file)
@@ -1490,7 +1490,7 @@ enum {
 #define SIG_GROUP_HEAD_HAVEFILEMAGIC BIT_U16(1)
 #endif
 #define SIG_GROUP_HEAD_HAVEFILEMD5    BIT_U16(2)
-#define SIG_GROUP_HEAD_HAVEFILESIZE   BIT_U16(3)
+// vacancy
 #define SIG_GROUP_HEAD_HAVEFILESHA1   BIT_U16(4)
 #define SIG_GROUP_HEAD_HAVEFILESHA256 BIT_U16(5)
 
index ef10da305ec26a7ef0069886b16ea83dbeca04e5..70777a1ecdd617d712742072dc3b51e69b1106e0 100644 (file)
@@ -222,7 +222,6 @@ static inline void FlowSwapFileFlags(Flow *f)
     SWAP_FLAGS(f->file_flags, FLOWFILE_NO_MD5_TS, FLOWFILE_NO_MD5_TC);
     SWAP_FLAGS(f->file_flags, FLOWFILE_NO_SHA1_TS, FLOWFILE_NO_SHA1_TC);
     SWAP_FLAGS(f->file_flags, FLOWFILE_NO_SHA256_TS, FLOWFILE_NO_SHA256_TC);
-    SWAP_FLAGS(f->file_flags, FLOWFILE_NO_SIZE_TS, FLOWFILE_NO_SIZE_TC);
 }
 
 static inline void TcpStreamFlowSwap(Flow *f)
index 43e438207cc2dbe839047440ed548ef68b204069..1a72fce49f49fcec70484c6fac6be2e9eba1cefc 100644 (file)
@@ -145,26 +145,18 @@ typedef struct AppLayerParserState_ AppLayerParserState;
 #define FLOWFILE_NO_SHA256_TS           BIT_U16(8)
 #define FLOWFILE_NO_SHA256_TC           BIT_U16(9)
 
-/** no size tracking of files in this flow */
-#define FLOWFILE_NO_SIZE_TS             BIT_U16(10)
-#define FLOWFILE_NO_SIZE_TC             BIT_U16(11)
+// vacancy(2)
 
 /** store files in the flow */
 #define FLOWFILE_STORE_TS BIT_U16(12)
 #define FLOWFILE_STORE_TC BIT_U16(13)
 
-#define FLOWFILE_NONE_TS (FLOWFILE_NO_MAGIC_TS | \
-                          FLOWFILE_NO_STORE_TS | \
-                          FLOWFILE_NO_MD5_TS   | \
-                          FLOWFILE_NO_SHA1_TS  | \
-                          FLOWFILE_NO_SHA256_TS| \
-                          FLOWFILE_NO_SIZE_TS)
-#define FLOWFILE_NONE_TC (FLOWFILE_NO_MAGIC_TC | \
-                          FLOWFILE_NO_STORE_TC | \
-                          FLOWFILE_NO_MD5_TC   | \
-                          FLOWFILE_NO_SHA1_TC  | \
-                          FLOWFILE_NO_SHA256_TC| \
-                          FLOWFILE_NO_SIZE_TC)
+#define FLOWFILE_NONE_TS                                                                           \
+    (FLOWFILE_NO_MAGIC_TS | FLOWFILE_NO_STORE_TS | FLOWFILE_NO_MD5_TS | FLOWFILE_NO_SHA1_TS |      \
+            FLOWFILE_NO_SHA256_TS)
+#define FLOWFILE_NONE_TC                                                                           \
+    (FLOWFILE_NO_MAGIC_TC | FLOWFILE_NO_STORE_TC | FLOWFILE_NO_MD5_TC | FLOWFILE_NO_SHA1_TC |      \
+            FLOWFILE_NO_SHA256_TC)
 #define FLOWFILE_NONE    (FLOWFILE_NONE_TS|FLOWFILE_NONE_TC)
 
 #define FLOW_IS_IPV4(f) \
index e7b71e7070daf620cb8fcb1bbd71a67336167275..d90b566b6e3ccaba9c6a26479225a7ef29c45cd5 100644 (file)
@@ -161,7 +161,6 @@ int FileForceSha256(void)
 void FileForceTrackingEnable(void)
 {
     g_file_force_tracking = 1;
-    g_file_flow_mask |= (FLOWFILE_NO_SIZE_TS|FLOWFILE_NO_SIZE_TC);
 }
 
 /**