]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ci: fix and test with Wunused-macros
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 11 Apr 2024 12:49:10 +0000 (14:49 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 24 May 2024 04:51:03 +0000 (06:51 +0200)
Ticket: 6937

46 files changed:
.github/workflows/build-centos-7.yml
.github/workflows/builds.yml
.github/workflows/codeql.yml
.github/workflows/commits.yml
.github/workflows/formatting.yml
.github/workflows/rust-checks.yml
.github/workflows/rust.yml
.github/workflows/scan-build.yml
configure.ac
src/app-layer-dnp3.c
src/app-layer-parser.c
src/app-layer-smtp.c
src/app-layer-ssl.c
src/detect-bytemath.c
src/detect-dce-stub-data.c
src/detect-engine-state.c
src/detect-parse.c
src/detect-quic-sni.c
src/detect-quic-ua.c
src/detect-quic-version.c
src/detect-smb-version.c
src/flow-manager.c
src/log-httplog.c
src/log-tlslog.c
src/output-eve-stream.c
src/output-json-alert.c
src/output-json-anomaly.c
src/output-json-dnp3.c
src/output-json-dns.c
src/output-json-frame.c
src/output-json-tls.c
src/runmode-af-xdp.c
src/runmode-napatech.c
src/runmode-pfring.c
src/source-af-packet.c
src/source-af-xdp.c
src/source-ipfw.c
src/tests/fuzz/fuzz_applayerparserparse.c
src/tests/fuzz/oss-fuzz-configure.sh
src/util-coredump-config.c
src/util-decode-mime.c
src/util-dpdk-bonding.c
src/util-ebpf.c
src/util-hash-lookup3.c
src/util-print.c
src/util-sysfs.c

index 49744252de25ad458f09a6927abf708752511403..9ee0d16cbfb6d4b520d11c8ebf5456299ce7e549 100644 (file)
@@ -169,7 +169,7 @@ jobs:
           git -c advice.detachedHead=false checkout FETCH_HEAD
 
       - run: ./autogen.sh
-      - run: ./configure
+      - run: ./configure --enable-warnings
       - run: make -j ${{ env.CPUS }}
       - run: python3 ./suricata-verify/run.py -q --debug-failed
       - run: make install-full
index 9aec8ff51bb8d3638a2ee4ba7a3bb8d08c12132e..916fb70feb1468969886fa83170900edd95e14f4 100644 (file)
@@ -263,7 +263,7 @@ jobs:
       - name: Configuring
         run: |
           ./autogen.sh
-          CFLAGS="${DEFAULT_CFLAGS}" ./configure
+          CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings
       - run: make -j ${{ env.CPUS }} distcheck
         env:
           DISTCHECK_CONFIGURE_FLAGS: "--enable-unittests --enable-debug --enable-lua --enable-geoip --enable-profiling --enable-profiling-locks --enable-dpdk"
@@ -778,7 +778,7 @@ jobs:
       - run: tar xf prep/libhtp.tar.gz
       - run: tar xf prep/suricata-update.tar.gz
       - run: ./autogen.sh
-      - run: ./configure --disable-shared
+      - run: ./configure --enable-warnings --disable-shared
         env:
           CC: "clang"
           RUSTFLAGS: "-C instrument-coverage"
@@ -877,7 +877,7 @@ jobs:
       - run: CC="clang" CFLAGS="$DEFAULT_CFLAGS -Wshadow" ./configure --disable-shared
       - run: make check
       - run: make distclean
-      - run: CC="clang" CFLAGS="$DEFAULT_CFLAGS -Wshadow -fsanitize=address -fno-omit-frame-pointer" ./configure --enable-debug --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue --enable-lua
+      - run: CC="clang" CFLAGS="$DEFAULT_CFLAGS -Wshadow -fsanitize=address -fno-omit-frame-pointer" ./configure --enable-warnings --enable-debug --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue --enable-lua
         env:
           LDFLAGS: "-fsanitize=address"
           ac_cv_func_realloc_0_nonnull: "yes"
@@ -968,7 +968,7 @@ jobs:
       - run: tar xf prep/libhtp.tar.gz
       - run: tar xf prep/suricata-update.tar.gz
       - run: ./autogen.sh
-      - run: ./configure --enable-debug --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue
+      - run: ./configure --enable-warnings --enable-debug --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue
         env:
           CFLAGS: "${{ env.DEFAULT_CFLAGS }} -Wshadow -fsanitize=address -fno-omit-frame-pointer"
           LDFLAGS: "-fsanitize=address"
@@ -1252,7 +1252,7 @@ jobs:
       - run: sudo -u suricata -s ./autogen.sh
         working-directory: /home/suricata/suricata
 
-      - run: sudo -u suricata -s env PATH="/home/suricata/.cargo/bin:$PATH" ./configure --enable-debug --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue
+      - run: sudo -u suricata -s env PATH="/home/suricata/.cargo/bin:$PATH" ./configure --enable-warnings --enable-debug --enable-unittests --disable-shared --enable-rust-strict --enable-hiredis --enable-nfqueue
         working-directory: /home/suricata/suricata
         env:
           ac_cv_func_realloc_0_nonnull: "yes"
@@ -1497,7 +1497,7 @@ jobs:
           chmod 755 $HOME/.cargo/bin/cbindgen
           echo "$HOME/.cargo/bin" >> $GITHUB_PATH
       - run: ./autogen.sh
-      - run: ./configure --disable-shared --enable-unittests
+      - run: ./configure --enable-warnings --disable-shared --enable-unittests
         env:
           CC: "clang-14"
           CXX: "clang++-14"
@@ -2086,7 +2086,7 @@ jobs:
       # using leading to random crashes: https://github.com/actions/runner-images/issues/9491
         run: sudo sysctl vm.mmap_rnd_bits=28
       - run: ./autogen.sh
-      - run: ./configure --with-gnu-ld --enable-fuzztargets --disable-shared --enable-gccprotect
+      - run: ./configure --enable-warnings --with-gnu-ld --enable-fuzztargets --disable-shared --enable-gccprotect
         env:
           LIB_FUZZING_ENGINE: "fail_to_onefile_driver"
           CC: "clang-14"
@@ -2182,7 +2182,7 @@ jobs:
           chmod 755 $HOME/.cargo/bin/cbindgen
           echo "$HOME/.cargo/bin" >> $GITHUB_PATH
       - run: ./autogen.sh
-      - run: CFLAGS="$DEFAULT_CFLAGS -DNDEBUG" ./configure --enable-unittests
+      - run: CFLAGS="$DEFAULT_CFLAGS -DNDEBUG" ./configure --enable-warnings --enable-unittests
       - run: make -j ${{ env.CPUS }}
       - run: make check
       - run: make dist
@@ -2345,7 +2345,7 @@ jobs:
       # using leading to random crashes: https://github.com/actions/runner-images/issues/9491
         run: sudo sysctl vm.mmap_rnd_bits=28
       - run: ./autogen.sh
-      - run: ./configure --enable-debug-validation
+      - run: ./configure --enable-warnings --enable-debug-validation
         env:
           CFLAGS: "${{ env.DEFAULT_CFLAGS }} -Wshadow -fsanitize=address -fno-omit-frame-pointer"
           LDFLAGS: "-fsanitize=address" 
@@ -2427,7 +2427,7 @@ jobs:
           chmod 755 $HOME/.cargo/bin/cbindgen
           echo "$HOME/.cargo/bin" >> $GITHUB_PATH
       - run: ./autogen.sh
-      - run: AFL_HARDEN=1 ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes CFLAGS="-fsanitize=address -fno-omit-frame-pointer" CXXFLAGS=$CFLAGS CC=afl-clang-fast CXX=afl-clang-fast++ LDFLAGS="-fsanitize=address" ./configure --enable-fuzztargets --disable-shared
+      - run: AFL_HARDEN=1 ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes CFLAGS="-fsanitize=address -fno-omit-frame-pointer" CXXFLAGS=$CFLAGS CC=afl-clang-fast CXX=afl-clang-fast++ LDFLAGS="-fsanitize=address" ./configure --enable-warnings --enable-fuzztargets --disable-shared
       - run: AFL_HARDEN=1 make -j ${{ env.CPUS }}
 
   ubuntu-22-04-netmap-build:
@@ -2521,7 +2521,7 @@ jobs:
           chmod 755 $HOME/.cargo/bin/cbindgen
           echo "$HOME/.cargo/bin" >> $GITHUB_PATH
       - run: ./autogen.sh
-      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-netmap
+      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings --enable-netmap
       - run: make -j ${{ env.CPUS }}
       - run: ./src/suricata --build-info | grep -E "Netmap support:\s+yes"
 
@@ -2626,7 +2626,7 @@ jobs:
           chmod 755 $HOME/.cargo/bin/cbindgen
           echo "$HOME/.cargo/bin" >> $GITHUB_PATH
       - run: ./autogen.sh
-      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-dpdk
+      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings --enable-dpdk
       - run: make -j ${{ env.CPUS }}
       - run: make check
       # IDS config
@@ -2708,7 +2708,7 @@ jobs:
       - run: tar xf prep/suricata-update.tar.gz
       - run: tar xf prep/suricata-verify.tar.gz
       - run: ./autogen.sh
-      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests
+      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings --enable-unittests
       - run: make -j ${{ env.CPUS }}
       - run: make check
         # -j2 caused random failures during cargo vendor
@@ -2888,7 +2888,7 @@ jobs:
       - run: tar xf prep/suricata-update.tar.gz
       - run: tar xf prep/suricata-verify.tar.gz
       - run: ./autogen.sh
-      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests --enable-debug --enable-lua --enable-geoip --enable-profiling --enable-profiling-locks --enable-dpdk
+      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings --enable-unittests --enable-debug --enable-lua --enable-geoip --enable-profiling --enable-profiling-locks --enable-dpdk
       - run: make -j ${{ env.CPUS }}
       - run: make check
       - name: Building Rust documentation
@@ -2974,7 +2974,7 @@ jobs:
           cp prep/cbindgen $HOME/.cargo/bin
           chmod 755 $HOME/.cargo/bin/cbindgen
       - run: ./autogen.sh
-      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests --enable-fuzztargets --enable-ebpf --enable-ebpf-build
+      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings --enable-unittests --enable-fuzztargets --enable-ebpf --enable-ebpf-build
       - run: make -j ${{ env.CPUS }}
       - run: make check
       - run: tar xf prep/suricata-verify.tar.gz
@@ -3055,7 +3055,7 @@ jobs:
           cp prep/cbindgen $HOME/.cargo/bin
           chmod 755 $HOME/.cargo/bin/cbindgen
       - run: ./autogen.sh
-      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests --enable-fuzztargets
+      - run: CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-warnings --enable-unittests --enable-fuzztargets
       - run: make -j ${{ env.CPUS }}
       - run: make check
       - run: tar xf prep/suricata-verify.tar.gz
@@ -3108,7 +3108,7 @@ jobs:
       - run: tar xvf prep/libhtp.tar.gz
       - run: tar xvf prep/suricata-update.tar.gz
       - run: ./autogen.sh
-      - run: CPATH="$HOMEBREW_PREFIX/include:$CPATH" LIBRARY_PATH="$HOMEBREW_PREFIX/lib:$LIBRARY_PATH" PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" CFLAGS="${DEFAULT_CFLAGS}" ./configure --enable-unittests --prefix="$HOME/.local/"
+      - run: CPATH="$HOMEBREW_PREFIX/include:$CPATH" LIBRARY_PATH="$HOMEBREW_PREFIX/lib:$LIBRARY_PATH" PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" CFLAGS="${DEFAULT_CFLAGS}" ./configure  --enable-warnings --enable-unittests --prefix="$HOME/.local/"
       - run: CPATH="$HOMEBREW_PREFIX/include:$CPATH" LIBRARY_PATH="$HOMEBREW_PREFIX/lib:$LIBRARY_PATH" PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" CFLAGS="${DEFAULT_CFLAGS}" make -j2
       # somehow it gets included by some C++ stdlib header (case unsensitive)
       - run: rm libhtp/VERSION && make check
@@ -3164,7 +3164,7 @@ jobs:
       - name: Build
         run: |
           ./autogen.sh
-          CFLAGS="-ggdb -Werror" ./configure --enable-unittests --enable-gccprotect --disable-gccmarch-native --disable-shared --with-libpcap-includes=/npcap/Include --with-libpcap-libraries=/npcap/Lib/x64
+          CFLAGS="-ggdb -Werror" ./configure --enable-warnings --enable-unittests --enable-gccprotect --disable-gccmarch-native --disable-shared --with-libpcap-includes=/npcap/Include --with-libpcap-libraries=/npcap/Lib/x64
           make -j3
       - name: Run
         run: |
@@ -3209,7 +3209,7 @@ jobs:
       - name: Build
         run: |
           ./autogen.sh
-          CFLAGS="-ggdb -Werror" ./configure --enable-unittests --enable-gccprotect --disable-gccmarch-native --disable-shared --with-libpcap-includes=/npcap/Include --with-libpcap-libraries=/npcap/Lib/x64
+          CFLAGS="-ggdb -Werror" ./configure --enable-warnings --enable-unittests --enable-gccprotect --disable-gccmarch-native --disable-shared --with-libpcap-includes=/npcap/Include --with-libpcap-libraries=/npcap/Lib/x64
           make -j3
       - name: Run
         run: |
@@ -3258,7 +3258,7 @@ jobs:
       - name: Build
         run: |
           ./autogen.sh
-          CFLAGS="-ggdb -Werror" ./configure --enable-gccprotect --disable-gccmarch-native --disable-shared --enable-windivert --with-windivert-include=/windivert/WinDivert-1.4.3-A/include --with-windivert-libraries=/windivert/WinDivert-1.4.3-A/x86_64
+          CFLAGS="-ggdb -Werror" ./configure --enable-warnings --enable-gccprotect --disable-gccmarch-native --disable-shared --enable-windivert --with-windivert-include=/windivert/WinDivert-1.4.3-A/include --with-windivert-libraries=/windivert/WinDivert-1.4.3-A/x86_64
           make -j3
       - name: Run
         run: |
index 693cea99729840bb0e68233e10426ae4f930a360..b7db5b86dd96b4e69cdf644fb8f7c330a900eea9 100644 (file)
@@ -59,7 +59,7 @@ jobs:
        export PATH=/opt/work/.cargo/bin:$PATH
         chmod +x autogen.sh
        ./autogen.sh
-       ./configure
+       ./configure --enable-warnings
        make
     - name: Perform CodeQL Analysis
       uses: github/codeql-action/analyze@v3.25.3
index 036bd3adceb858e3d718cba2b5c6870775935840..6ef42507e3896006b8d437aa52673752a6a99e04 100644 (file)
@@ -88,7 +88,7 @@ jobs:
               git checkout $rev
               echo "Building rev ${rev}" | tee -a build_log.txt
               ./autogen.sh >> build_log.txt 2>&1
-              CC="sccache gcc" ./configure --enable-unittests >> build_log.txt 2>&1
+              CC="sccache gcc" ./configure --enable-warnings --enable-unittests >> build_log.txt 2>&1
               if ! make -j2 >> build_log.txt 2>&1; then
                   echo "::error ::Failed to build rev ${rev}"
                   tail -n 50 build_log.txt
index 5adf1dd86f2e9fec614fc363943383263d2e1d8c..4758b1af4413ee1f8ba86cc2faa44b53cbdbc355 100644 (file)
@@ -130,7 +130,7 @@ jobs:
         shell: bash {0}
       - run: git clone https://github.com/OISF/libhtp -b 0.5.x
       - run: ./autogen.sh
-      - run: ./configure --enable-unittests
+      - run: ./configure --enable-warnings --enable-unittests
       - name: Check formatting
         run: |
           ./scripts/clang-format.sh check-branch --diffstat --show-commits  >> check_formatting_log.txt 2>&1
index 5ac2739bf3d79517be8c066d46a430f758a8bbe6..56c74273b3acbda30e72e63752aabc857afe47a4 100644 (file)
@@ -88,7 +88,7 @@ jobs:
         run: |
           ./scripts/bundle.sh libhtp
           ./autogen.sh
-          ./configure
+          ./configure --enable-warnings
       - name: Run Cargo Audit
         working-directory: rust
         run: |
@@ -171,7 +171,7 @@ jobs:
         run: |
           ./scripts/bundle.sh libhtp
           ./autogen.sh
-          ./configure
+          ./configure --enable-warnings
       - name: Cargo Update and Build
         working-directory: rust
         run: |
index eebf43c13eb8e3a59bf2b299446ede94b1b41285..e3bd82d12d6ed1e304867edb6e233cfea494486f 100644 (file)
@@ -76,7 +76,7 @@ jobs:
       - run: git config --global --add safe.directory /__w/suricata/suricata
       - run: ./scripts/bundle.sh
       - run: ./autogen.sh
-      - run: ./configure
+      - run: ./configure --enable-warnings
       - run: cargo clippy --all-features --fix --allow-no-vcs
         working-directory: rust
       - run: |
index 6910f508af4998a91dfc1cf9354f7c9e40be5f68..69ccc48f32300fea5f63e5151a3cebc601062e26 100644 (file)
@@ -72,7 +72,7 @@ jobs:
       - run: git config --global --add safe.directory /__w/suricata/suricata
       - run: ./scripts/bundle.sh
       - run: ./autogen.sh
-      - run: scan-build-16 ./configure --enable-dpdk --enable-nfqueue --enable-nflog
+      - run: scan-build-16 ./configure --enable-warnings --enable-dpdk --enable-nfqueue --enable-nflog
         env:
           CC: clang-16
       # exclude libhtp from the analysis
index de8fd2687d5e96e74590c5fa0e1a55edf7eaf9f8..ea8d5c88b827b4d3386e2288406a243dde140cda 100644 (file)
@@ -2460,6 +2460,20 @@ fi
     ])
     AC_SUBST(RUST_FEATURES)
 
+    AC_ARG_ENABLE(enable_warnings,
+           AS_HELP_STRING([--enable-warnings], [Enable supported C compiler warnings]),[enable_warnings=$enableval],[enable_warnings=no])
+    AS_IF([test "x$enable_warnings" = "xyes"], [
+        # check if our compiler supports -Wunused-macros
+        AC_MSG_CHECKING(for -Wunused-macros support)
+        OCFLAGS=$CFLAGS
+        CFLAGS="$CFLAGS -Wunused-macros"
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
+                    [[]])],
+                AC_MSG_RESULT([yes]),
+                [AC_MSG_RESULT([no])
+                CFLAGS="$OCFLAGS"])
+    ])
+
     AC_CHECK_LIB(fuzzpcap, FPC_IsFuzzPacketCapture, HAS_FUZZPCAP="yes")
     AM_CONDITIONAL([HAS_FUZZPCAP], [test "x$HAS_FUZZPCAP" = "xyes"])
     AC_ARG_ENABLE(fuzztargets,
index 9501b9f5ea578f877486a6136815027ecb06d7a2..0e18a4fc5fba12d080ef9b258638c2bc11699397 100644 (file)
@@ -63,7 +63,7 @@
 #define DNP3_MAX_TRAN_SEQNO 64
 
 /* Maximum application layer sequence number. */
-#define DNP3_MAX_APP_SEQNO  16
+// unused #define DNP3_MAX_APP_SEQNO  16
 
 /* The number of bytes in the header that are counted as part of the
  * header length field. */
@@ -76,16 +76,11 @@ enum {
 };
 
 /* Reserved addresses. */
-#define DNP3_RESERVED_ADDR_MIN 0xfff0
-#define DNP3_RESERVED_ADDR_MAX 0xfffb
+// unused #define DNP3_RESERVED_ADDR_MIN 0xfff0
+// unused #define DNP3_RESERVED_ADDR_MAX 0xfffb
 
 /* Source addresses must be < 0xfff0. */
-#define DNP3_SRC_ADDR_MAX 0xfff0
-
-#define DNP3_OBJ_TIME_SIZE   6  /* AKA UINT48. */
-#define DNP3_OBJ_G12_V1_SIZE 11
-#define DNP3_OBJ_G12_V2_SIZE 11
-#define DNP3_OBJ_G12_V3_SIZE 1
+// unused #define DNP3_SRC_ADDR_MAX 0xfff0
 
 /* Extract the prefix code from the object qualifier. */
 #define DNP3_OBJ_PREFIX(x) ((x >> 4) & 0x7)
@@ -107,9 +102,6 @@ SCEnumCharMap dnp3_decoder_event_table[] = {
 /* Calculate the next transport sequence number. */
 #define NEXT_TH_SEQNO(current) ((current + 1) % DNP3_MAX_TRAN_SEQNO)
 
-/* Calculate the next application sequence number. */
-#define NEXT_APP_SEQNO(current)  ((current + 1) % DNP3_MAX_APP_SEQNO)
-
 /* CRC table generated by pycrc - http://github.com/tpircher/pycrc.
  * - Polynomial: 0x3d65. */
 static const uint16_t crc_table[256] = {
index 90923d0c9d4d904c5e6a0277fb488ab249845964..a1f000f90c2586e7329d363b249ea1226894775c 100644 (file)
@@ -1660,7 +1660,6 @@ static void ValidateParserProtoDump(AppProto alproto, uint8_t ipproto)
 
 #define BOTH_SET(a, b) ((a) != NULL && (b) != NULL)
 #define BOTH_SET_OR_BOTH_UNSET(a, b) (((a) == NULL && (b) == NULL) || ((a) != NULL && (b) != NULL))
-#define THREE_SET_OR_THREE_UNSET(a, b, c) (((a) == NULL && (b) == NULL && (c) == NULL) || ((a) != NULL && (b) != NULL && (c) != NULL))
 #define THREE_SET(a, b, c) ((a) != NULL && (b) != NULL && (c) != NULL)
 
 static void ValidateParserProto(AppProto alproto, uint8_t ipproto)
index 5a4fc0c7a2c90de5c383dc9649c18f5b86b3b0e9..944187aa4df7f29cc712e68c38af3af3e379b109 100644 (file)
 #define FILEDATA_CONTENT_INSPECT_WINDOW 4096
 
 /* raw extraction default value */
-#define SMTP_RAW_EXTRACTION_DEFAULT_VALUE      false
-#define SMTP_MAX_REQUEST_AND_REPLY_LINE_LENGTH 510
+#define SMTP_RAW_EXTRACTION_DEFAULT_VALUE false
 
 #define SMTP_COMMAND_BUFFER_STEPS 5
 
 /* we are in process of parsing a fresh command.  Just a placeholder.  If we
  * are not in STATE_COMMAND_DATA_MODE, we have to be in this mode */
-#define SMTP_PARSER_STATE_COMMAND_MODE            0x00
+// unused #define SMTP_PARSER_STATE_COMMAND_MODE            0x00
 /* we are in mode of parsing a command's data.  Used when we are parsing tls
  * or accepting the rfc 2822 mail after DATA command */
-#define SMTP_PARSER_STATE_COMMAND_DATA_MODE       0x01
-/* Used when we are still in the process of parsing a server command.  Used
- * with multi-line replies and the stream is fragmented before all the lines
- * for a response is seen */
-#define SMTP_PARSER_STATE_PARSING_SERVER_RESPONSE 0x02
+#define SMTP_PARSER_STATE_COMMAND_DATA_MODE 0x01
 /* Used to indicate that the parser has seen the first reply */
 #define SMTP_PARSER_STATE_FIRST_REPLY_SEEN        0x04
 /* Used to indicate that the parser is parsing a multiline reply */
 #define SMTP_COMMAND_OTHER_CMD 5
 #define SMTP_COMMAND_RSET      6
 
-/* Different EHLO extensions.  Not used now. */
-#define SMTP_EHLO_EXTENSION_PIPELINING
-#define SMTP_EHLO_EXTENSION_SIZE
-#define SMTP_EHLO_EXTENSION_DSN
-#define SMTP_EHLO_EXTENSION_STARTTLS
-#define SMTP_EHLO_EXTENSION_8BITMIME
-
 #define SMTP_DEFAULT_MAX_TX 256
 
 typedef struct SMTPInput_ {
index 139c8c3beb899510ab07f9a70b979494c845ff17..1cf81b8a52a40e928ff913a4c5002f2a85fd13a6 100644 (file)
@@ -200,8 +200,7 @@ SslConfig ssl_config;
 #define SSLV2_MT_REQUEST_CERTIFICATE    7
 #define SSLV2_MT_CLIENT_CERTIFICATE     8
 
-#define SSLV3_RECORD_HDR_LEN            5
-#define SSLV3_MESSAGE_HDR_LEN           4
+#define SSLV3_RECORD_HDR_LEN 5
 /** max length according to RFC 5246 6.2.2 is 2^14 + 1024 */
 #define SSLV3_RECORD_MAX_LEN ((1 << 14) + 1024)
 
index 49c2989f7dc934175c4465821e9820023a0af924..a1dfc7e9851450380870a34ec05245e7b3c7c406 100644 (file)
 
 static int DetectByteMathSetup(DetectEngineCtx *, Signature *, const char *);
 #ifdef UNITTESTS
+#define DETECT_BYTEMATH_ENDIAN_DEFAULT (uint8_t) BigEndian
+#define DETECT_BYTEMATH_BASE_DEFAULT   (uint8_t) BaseDec
+
 static void DetectByteMathRegisterTests(void);
 #endif
 static void DetectByteMathFree(DetectEngineCtx *, void *);
 
-#define DETECT_BYTEMATH_ENDIAN_DEFAULT (uint8_t) BigEndian
-#define DETECT_BYTEMATH_BASE_DEFAULT   (uint8_t) BaseDec
 /**
  * \brief Registers the keyword handlers for the "byte_math" keyword.
  */
index 5d919e084e643c186b678aeb5a1427f4adb08af7..b0ee0459058373bec4118f97ccc1ef42e7a277d4 100644 (file)
@@ -58,7 +58,6 @@
 #include "rust.h"
 
 #define BUFFER_NAME "dce_stub_data"
-#define KEYWORD_NAME "dce_stub_data"
 
 static int DetectDceStubDataSetup(DetectEngineCtx *, Signature *, const char *);
 #ifdef UNITTESTS
index 74f87ff938f10eddc94b2bbddfbac93a89e032b2..aead3547e87e78ab1edfd5fb90c927db99c3b793 100644 (file)
@@ -64,9 +64,6 @@
 
 #include "flow-util.h"
 
-/** convert enum to string */
-#define CASE_CODE(E)  case E: return #E
-
 static inline int StateIsValid(uint16_t alproto, void *alstate)
 {
     if (alstate != NULL) {
index 028943920072d0b516f844584eb64cf39bd75aec..fc5e4f6579f23eef4d59aae4793971d155e64d22 100644 (file)
@@ -145,17 +145,6 @@ typedef struct SigDuplWrapper_ {
     Signature *s_prev;
 } SigDuplWrapper;
 
-#define CONFIG_PARTS 8
-
-#define CONFIG_ACTION 0
-#define CONFIG_PROTO  1
-#define CONFIG_SRC    2
-#define CONFIG_SP     3
-#define CONFIG_DIREC  4
-#define CONFIG_DST    5
-#define CONFIG_DP     6
-#define CONFIG_OPTS   7
-
 /** helper structure for sig parsing */
 typedef struct SignatureParser_ {
     char action[DETECT_MAX_RULE_SIZE];
index 4515baa6a7ec7e32add4de108be1ea29db54c2af..0e4bf2d0910136dc0a0d8cb9941836ff04b6a211 100644 (file)
@@ -40,7 +40,6 @@ static void DetectQuicSniRegisterTests(void);
 
 #define BUFFER_NAME  "quic_sni"
 #define KEYWORD_NAME "quic.sni"
-#define KEYWORD_ID   DETECT_AL_QUIC_SNI
 
 static int quic_sni_id = 0;
 
index 4f4e9fd7d2e7751846666e5a3d3dad38d2e105f2..0e72770cb068eafad0229939e06233ae30566884 100644 (file)
@@ -40,7 +40,6 @@ static void DetectQuicUaRegisterTests(void);
 
 #define BUFFER_NAME  "quic_ua"
 #define KEYWORD_NAME "quic.ua"
-#define KEYWORD_ID   DETECT_AL_QUIC_UA
 
 static int quic_ua_id = 0;
 
index 58257d143ba4d02407d1be493976d4c5a9931ed3..08bf80c0022cf9d80e211412072a88ec06edd547 100644 (file)
@@ -40,7 +40,6 @@ static void DetectQuicVersionRegisterTests(void);
 
 #define BUFFER_NAME  "quic_version"
 #define KEYWORD_NAME "quic.version"
-#define KEYWORD_ID   DETECT_AL_QUIC_VERSION
 
 static int quic_version_id = 0;
 
index c8a4230386894d352cf71fecf875545b273d7952..0284566ff361c8cb7632eaa69aff356f5d7a212b 100644 (file)
@@ -40,7 +40,6 @@
 
 #define BUFFER_NAME  "smb_version"
 #define KEYWORD_NAME "smb.version"
-#define KEYWORD_ID   DETECT_SMB_VERSION
 
 static int g_smb_version_list_id = 0;
 
@@ -152,4 +151,4 @@ void DetectSmbVersionRegister(void)
     g_smb_version_list_id = DetectBufferTypeRegister(BUFFER_NAME);
 
     SCLogDebug("registering " BUFFER_NAME " rule option");
-}
\ No newline at end of file
+}
index 1568dc708a400c4f377a805e0e724e9aa56d006e..b1d073029cd0beba7f6ccff37ec45ef7d09430e1 100644 (file)
@@ -101,14 +101,6 @@ void FlowTimeoutsEmergency(void)
     SC_ATOMIC_SET(flow_timeouts, flow_timeouts_emerg);
 }
 
-/* 1 seconds */
-#define FLOW_NORMAL_MODE_UPDATE_DELAY_SEC 1
-#define FLOW_NORMAL_MODE_UPDATE_DELAY_NSEC 0
-/* 0.3 seconds */
-#define FLOW_EMERG_MODE_UPDATE_DELAY_SEC 0
-#define FLOW_EMERG_MODE_UPDATE_DELAY_NSEC 300000
-#define NEW_FLOW_COUNT_COND 10
-
 typedef struct FlowTimeoutCounters_ {
     uint32_t rows_checked;
     uint32_t rows_skipped;
index 17a01442dab31ef805055f5db071f10045cb4ad7..93b6e0da9179b7ad49422cf439dc5854e80bed20 100644 (file)
@@ -71,8 +71,7 @@ void LogHttpLogRegister (void)
 #define LOG_HTTP_CF_REQUEST_HOST 'h'
 #define LOG_HTTP_CF_REQUEST_PROTOCOL 'H'
 #define LOG_HTTP_CF_REQUEST_METHOD 'm'
-#define LOG_HTTP_CF_REQUEST_URI 'u'
-#define LOG_HTTP_CF_REQUEST_TIME 't'
+#define LOG_HTTP_CF_REQUEST_URI      'u'
 #define LOG_HTTP_CF_REQUEST_HEADER 'i'
 #define LOG_HTTP_CF_REQUEST_COOKIE 'C'
 #define LOG_HTTP_CF_REQUEST_LEN 'b'
index 2c0c862756f2cbd12272724447df63261895088e..db886f7b131606135287638d8d4089875a457f66 100644 (file)
@@ -58,8 +58,7 @@
 
 #define PRINT_BUF_LEN 46
 
-#define OUTPUT_BUFFER_SIZE   65535
-#define CERT_ENC_BUFFER_SIZE 2048
+#define OUTPUT_BUFFER_SIZE 65535
 
 #define LOG_TLS_DEFAULT  0
 #define LOG_TLS_EXTENDED 1
index a9fe09ce904a288af4645be8a42e736afad89614..f05aa6b38cfe4f084c920e93e6aa3c888369a2e8 100644 (file)
@@ -57,8 +57,6 @@
 
 #define MODULE_NAME "EveStreamLog"
 
-#define LOG_DROP_ALERTS 1
-
 typedef struct EveStreamOutputCtx_ {
     uint16_t trigger_flags; /**< presence of flags in packet trigger logging. 0xffff for all. */
     OutputJsonCtx *eve_ctx;
index 40a6c17011811a565cda77e407e11ab57462d0ab..ae2a7fc6207f1368bde22bb4bde9aa6b0e40a487 100644 (file)
@@ -860,8 +860,6 @@ static void SetFlag(const ConfNode *conf, const char *name, uint16_t flag, uint1
     }
 }
 
-#define DEFAULT_LOG_FILENAME "alert.json"
-
 static void JsonAlertLogSetupMetadata(AlertJsonOutputCtx *json_output_ctx,
         ConfNode *conf)
 {
index ffe931a73ed67372788686e96b278603aebb40cf..c1d9cc65c0eda6088bb3ce36ecae90548ed8773d 100644 (file)
@@ -350,7 +350,6 @@ static void JsonAnomalyLogDeInitCtxSub(OutputCtx *output_ctx)
     JsonAnomalyLogDeInitCtxSubHelper(output_ctx);
 }
 
-#define DEFAULT_LOG_FILENAME "anomaly.json"
 static void SetFlag(const ConfNode *conf, const char *name, uint16_t flag, uint16_t *out_flags)
 {
     DEBUG_VALIDATE_BUG_ON(conf == NULL);
index 1387d62136320782f8363728009c40ae73c211c0..7bf4ecc8602ee50ae17e3fc40dd525ae9f48f0ba 100644 (file)
@@ -294,8 +294,6 @@ static void OutputDNP3LogDeInitCtxSub(OutputCtx *output_ctx)
     SCFree(output_ctx);
 }
 
-#define DEFAULT_LOG_FILENAME "dnp3.json"
-
 static OutputInitResult OutputDNP3LogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
 {
     OutputInitResult result = { NULL, false };
index 973c777fdd3bedd90fe0680ed631cb218098ceff..be3767e2eaf7393dee607af1e494567882c4df0e 100644 (file)
 #include "output-json-dns.h"
 #include "rust.h"
 
-/* we can do query logging as well, but it's disabled for now as the
- * TX id handling doesn't expect it */
-#define QUERY 0
-
 #define LOG_QUERIES    BIT_U64(0)
 #define LOG_ANSWERS    BIT_U64(1)
 
index 9c051c15d69c6d0bd040cd733af5310c813264c8..4e0ec5b2b24ca9ad4d8d37120348c20d757627fa 100644 (file)
@@ -67,8 +67,6 @@
 
 #define MODULE_NAME "JsonFrameLog"
 
-#define JSON_STREAM_BUFFER_SIZE 4096
-
 typedef struct FrameJsonOutputCtx_ {
     LogFileCtx *file_ctx;
     uint16_t flags;
index 53ceda6ff560e12673761191ae5a5ab6959d6399..821e76553936c2abb49a264a256ce1ee6206f36e 100644 (file)
@@ -53,9 +53,6 @@
 
 SC_ATOMIC_EXTERN(unsigned int, cert_id);
 
-#define MODULE_NAME "LogTlsLog"
-#define DEFAULT_LOG_FILENAME "tls.json"
-
 #define LOG_TLS_DEFAULT                 0
 #define LOG_TLS_EXTENDED                (1 << 0)
 #define LOG_TLS_CUSTOM                  (1 << 1)
index 33a47d167aee1294034b14158b854fbd7176061a..75f098eadbee107137ecc9f84044e8616861e662 100644 (file)
@@ -29,7 +29,6 @@
  * AF_XDP socket runmode
  *
  */
-#define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
 #define SC_PCAP_DONT_INCLUDE_PCAP_H  1
 #include "suricata-common.h"
 #include "tm-threads.h"
index 9b02b8748fc5c60d201f9565eed424c8cb684339..9c5f65c1b640dc5451b40d2f1beee7c6f603248a 100644 (file)
 #include "runmode-napatech.h"
 #include "source-napatech.h" // need NapatechStreamDevConf structure
 
-#define NT_RUNMODE_AUTOFP  1
-#define NT_RUNMODE_WORKERS 2
-
 static const char *default_mode = "workers";
 
 #ifdef HAVE_NAPATECH
 
+#define NT_RUNMODE_AUTOFP  1
+#define NT_RUNMODE_WORKERS 2
+
 #define MAX_STREAMS 256
 static uint16_t num_configured_streams = 0;
 static uint16_t first_stream = 0xffff;
index 7f1f74f40fdaba2074425ed52f5db0afde5a9c1e..584a409e85ee9f14ba9a3aa9876f15fd85b61602 100644 (file)
 
 #ifdef HAVE_PFRING
 #include <pfring.h>
-#endif
 
 #define PFRING_CONF_V1 1
 #define PFRING_CONF_V2 2
+#endif
 
 const char *RunModeIdsPfringGetDefaultMode(void)
 {
index 3a32c5818f272b21156f84ebd1baa3e925e9cf54..09cb554e10eaa40536aea3264ab4fd912baf9e4e 100644 (file)
@@ -30,7 +30,6 @@
  *
  */
 
-#define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
 #define SC_PCAP_DONT_INCLUDE_PCAP_H 1
 #include "suricata-common.h"
 #include "suricata.h"
 #endif
 
 #ifdef HAVE_PACKET_EBPF
+#define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
 #include <bpf/libbpf.h>
 #include <bpf/bpf.h>
-#endif
 
 struct bpf_program {
     unsigned int bf_len;
     struct bpf_insn *bf_insns;
 };
+#endif
 
 #ifdef HAVE_PCAP_H
 #include <pcap.h>
index 013769a06d5a033a36988dc40162f078e8248e29..0f6c9b39bf8add94709a4fd570af21225dc970d3 100644 (file)
@@ -29,7 +29,6 @@
  * AF_XDP socket acquisition support
  *
  */
-#define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
 #define SC_PCAP_DONT_INCLUDE_PCAP_H  1
 #include "suricata-common.h"
 #include "suricata.h"
@@ -968,4 +967,4 @@ static TmEcode DecodeAFXDPThreadDeinit(ThreadVars *tv, void *data)
 /* eof */
 /**
  * @}
- */
\ No newline at end of file
+ */
index ecae507c41f3158b1be5b18c12e69bbfdf17ba36..db9609d4630c5ddf0eb56417fd639dfdf3f2166d 100644 (file)
 #include "util-device.h"
 #include "runmodes.h"
 
-#define IPFW_ACCEPT 0
-#define IPFW_DROP 1
-
-#define IPFW_SOCKET_POLL_MSEC 300
-
-#ifndef IP_MAXPACKET
-#define IP_MAXPACKET 65535
-#endif
-
 #ifndef IPFW
 /* Handle the case if --enable-ipfw was not used
  *
@@ -102,6 +93,11 @@ TmEcode NoIPFWSupportExit(ThreadVars *tv, const void *initdata, void **data)
 
 #include "action-globals.h"
 
+#define IPFW_ACCEPT 0
+#define IPFW_DROP   1
+
+#define IPFW_SOCKET_POLL_MSEC 300
+
 extern uint16_t max_pending_packets;
 
 /**
@@ -223,6 +219,10 @@ static inline void IPFWMutexUnlock(IPFWQueueVars *nq)
         SCMutexUnlock(&nq->socket_lock);
 }
 
+#ifndef IP_MAXPACKET
+#define IP_MAXPACKET 65535
+#endif
+
 TmEcode ReceiveIPFWLoop(ThreadVars *tv, void *data, void *slot)
 {
     SCEnter();
index 0b17edf88691ceeb4385d474dea2424e6658295f..f12f814fd3f65b2fccd290e3637dbe37caf350a9 100644 (file)
@@ -66,9 +66,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
     return 0;
 }
 
-// arbitrary value
-#define ALPROTO_MAXTX 4096
-
 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
 {
     Flow * f;
index 9088f762caf49bd35d3b9d64614936f19f7903f5..77ec80442d8edccb568b60c865da5431d5ee90fa 100755 (executable)
@@ -1,2 +1,2 @@
 #!/bin/sh
-./configure --disable-shared --enable-fuzztargets --disable-gccmarch-native --enable-debug-validation
+./configure --enable-warnings --disable-shared --enable-fuzztargets --disable-gccmarch-native --enable-debug-validation
index 09485cb7957199292d6cdd83faeb59b5ec37f818..4fa43579cc346c356da5c6da47912c1fbdfcdea0 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include "suricata-common.h"
-#define _FILE_OFFSET_BITS 64
 #include "util-coredump-config.h"
 #include "conf.h"
 #ifdef HAVE_SYS_RESOURCE_H
index 4b9cd23f34e7fce75ba065f160c52535d35745d1..4d5b8c1da5eb0619c9ef5dfc0d87976bf6465d5b 100644 (file)
 #define COLON             58
 #define DASH              45
 #define PRINTABLE_START   33
-#define PRINTABLE_END    126
-#define UC_START          65
-#define UC_END            90
-#define LC_START          97
-#define LC_END           122
-#define UC_LC_DIFF        32
+#define PRINTABLE_END      126
 #define EOL_LEN            2
 
 /* Base-64 constants */
index 59b92ba8294acb103323e82ae0d27ae2ac8bec96..ad9b4fef1226569376db45546c28b6ca02bf46b6 100644 (file)
@@ -21,9 +21,6 @@
  * \author Lukas Sismis <lukas.sismis@gmail.com>
  */
 
-#ifndef UTIL_DPDK_BONDING_C
-#define UTIL_DPDK_BONDING_C
-
 #include "suricata-common.h"
 #include "util-dpdk-bonding.h"
 
@@ -121,5 +118,3 @@ const char *BondingDeviceDriverGet(uint16_t bond_pid)
 }
 
 #endif /* HAVE_DPDK */
-
-#endif /* UTIL_DPDK_BONDING_C */
index 13eaea828d9ba36ad02816e38e5894c9f51556ba..9029335301d4f10cdac1c8f28b8feab0a59cc2cd 100644 (file)
@@ -30,7 +30,6 @@
  *
  */
 
-#define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
 #define SC_PCAP_DONT_INCLUDE_PCAP_H 1
 
 #include "suricata-common.h"
index 5d1146152bf2acdd6e7749e226e6fb44448fbffc..2354c183d219dab570c054f50fd455b0eee49a93 100644 (file)
@@ -64,8 +64,6 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
 # define HASH_BIG_ENDIAN 0
 #endif
 
-#define hashsize(n) ((uint32_t)1<<(n))
-#define hashmask(n) (hashsize(n)-1)
 #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
 
 /*
index 8fa2cba5969fea0c35a1d863adb8665cf5cced5a..4ca901fa0c2a40df01b0e7542aa8939d37fd4c0e 100644 (file)
@@ -212,10 +212,6 @@ void PrintStringsToBuffer(uint8_t *dst_buf, uint32_t *dst_buf_offset_ptr, uint32
     return;
 }
 
-#ifndef s6_addr16
-# define s6_addr16 __u6_addr.__u6_addr16
-#endif
-
 static const char *PrintInetIPv6(const void *src, char *dst, socklen_t size)
 {
     char s_part[6];
index 11f1854a8c45c52d4af93b23c61b8785cce6ed5c..f1e21dd9beae3532f0ec8e77b3df9124a2df3a95 100644 (file)
 
 #include "util-sysfs.h"
 
-#define SYSFS_MAX_FILENAME_LEN (SYSFS_MAX_FILENAME_SIZE + 5)
-
 TmEcode SysFsWriteValue(const char *path, int64_t value)
 {
 #if defined(__linux__)
+#define SYSFS_MAX_FILENAME_LEN (SYSFS_MAX_FILENAME_SIZE + 5)
     char fname[SYSFS_MAX_FILENAME_LEN] = "/sys/";
     char sentence[64];