Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next/20220727/v2 #7650

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ jobs:
texlive-upquote \
texlive-capt-of \
texlive-needspace \
- name: Setup cppclean
run: |
git clone --depth 1 --branch suricata https://github.com/catenacyber/cppclean
cd cppclean
python3 setup.py install
- name: Configuring
run: |
./autogen.sh
Expand All @@ -242,6 +247,9 @@ jobs:
env:
DISTCHECK_CONFIGURE_FLAGS: "--enable-unittests --enable-debug --enable-lua --enable-geoip --enable-profiling --enable-profiling-locks --enable-dpdk"
- run: test -e doc/userguide/suricata.1
- name: Checking includes
run: |
cppclean src/*.h | grep "does not need to be #included" | python3 scripts/cppclean_check.py
- name: Building Rust documentation
run: make doc
working-directory: rust
Expand Down
30 changes: 30 additions & 0 deletions scripts/cppclean_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sys

#cppclean src/*.h | grep "does not need to be #included"
retcode = 0
for l in sys.stdin:
includer = l.split(':')[0]
included = l.split("'")[1]

if included == "rust.h" or included == "suricata-common.h":
continue
if includer == "src/suricata-common.h" or includer == "src/rust-context.h" or includer == "src/rust.h" or includer == "src/threads.h":
continue

if included == "util-file.h" and includer == "src/detect.h":
# SigTableElmt structure field FileMatch being a function pointer using a parameter File defined in util-file.h
continue
if included == "conf.h" and includer == "src/suricata-plugin.h":
# SCEveFileType structure field Init being a function pointer using a parameter ConfNode defined in conf.h
continue
if included == "util-debug-filters.h" and includer == "src/util-debug.h":
# Macro SCEnter using SCLogCheckFDFilterEntry defined in util-debug-filters.h
continue
if included == "util-spm-bs.h" and includer == "src/util-spm.h":
# Macro SpmSearch using BasicSearch defined in util-spm-bs.h
continue

print("Unnecessary include from %s for %s" % (includer, included))
retcode = 1

sys.exit(retcode)
3 changes: 0 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ noinst_HEADERS = \
app-layer-modbus.h \
app-layer-quic.h \
app-layer-mqtt.h \
app-layer-nbss.h \
app-layer-nfs-tcp.h \
app-layer-nfs-udp.h \
app-layer-ntp.h \
Expand Down Expand Up @@ -81,7 +80,6 @@ noinst_HEADERS = \
decode-ipv6.h \
decode-mpls.h \
decode-nsh.h \
decode-null.h \
decode-ppp.h \
decode-pppoe.h \
decode-raw.h \
Expand Down Expand Up @@ -607,7 +605,6 @@ noinst_HEADERS = \
util-validate.h \
util-var.h \
util-var-name.h \
util-vector.h \
win32-misc.h \
win32-service.h \
win32-syscall.h \
Expand Down
1 change: 1 addition & 0 deletions src/alert-fastlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include "detect-parse.h"
#include "detect-engine.h"
#include "detect-engine-build.h"
#include "detect-engine-mpm.h"
#include "detect-reference.h"
#include "util-classification-config.h"
Expand Down
5 changes: 0 additions & 5 deletions src/app-layer-dcerpc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
#ifndef __APP_LAYER_DCERPC_COMMON_H__
#define __APP_LAYER_DCERPC_COMMON_H__

#include "app-layer-protos.h"
#include "app-layer-parser.h"
#include "flow.h"
#include "queue.h"
#include "util-byte.h"

void RegisterDCERPCParsers(void);
void DCERPCParserTests(void);
Expand Down
1 change: 1 addition & 0 deletions src/app-layer-detect-proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "detect.h"
#include "detect-engine-port.h"
#include "detect-engine-build.h"
#include "detect-parse.h"
#include "detect-engine.h"
#include "detect-content.h"
Expand Down
3 changes: 3 additions & 0 deletions src/app-layer-dnp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
*/

#include "suricata-common.h"
#include "suricata.h"
#include "stream.h"
#include "util-byte.h"
#include "util-unittest.h"
#include "util-hashlist.h"

#include "util-print.h"
#include "util-spm-bs.h"
#include "util-enum.h"

#include "app-layer.h"
#include "app-layer-protos.h"
Expand Down
3 changes: 0 additions & 3 deletions src/app-layer-dnp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#ifndef __APP_LAYER_DNP3_H__
#define __APP_LAYER_DNP3_H__

#include "detect-engine-state.h"
#include "util-hashlist.h"
#include "util-byte.h"
#include "rust.h"

/**
Expand Down
5 changes: 1 addition & 4 deletions src/app-layer-enip-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
#ifndef __APP_LAYER_ENIP_COMMON_H__
#define __APP_LAYER_ENIP_COMMON_H__

#include "app-layer-protos.h"
#include "app-layer-parser.h"
#include "flow.h"
#include "queue.h"
#include "rust.h"

// EtherNet/IP commands
#define NOP 0x0000
Expand Down
3 changes: 0 additions & 3 deletions src/app-layer-enip.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#ifndef __APP_LAYER_ENIP_H__
#define __APP_LAYER_ENIP_H__

#include "decode.h"
#include "detect-engine-state.h"
#include "queue.h"

void RegisterENIPUDPParsers(void);
void RegisterENIPTCPParsers(void);
Expand Down
1 change: 1 addition & 0 deletions src/app-layer-frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "stream-tcp.h"
#include "app-layer-frames.h"
#include "app-layer-parser.h"

static void FrameDebug(const char *prefix, const Frames *frames, const Frame *frame)
{
Expand Down
5 changes: 0 additions & 5 deletions src/app-layer-frames.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
#ifndef __APP_LAYER_FRAMES_H__
#define __APP_LAYER_FRAMES_H__

#include "app-layer-events.h"
#include "detect-engine-state.h"
#include "util-file.h"
#include "stream-tcp-private.h"
#include "rust.h"
#include "app-layer-parser.h"

typedef int64_t FrameId;

Expand Down
1 change: 1 addition & 0 deletions src/app-layer-ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "app-layer-parser.h"
#include "app-layer-ftp.h"
#include "app-layer-expectation.h"
#include "app-layer-detect-proto.h"

#include "util-spm.h"
#include "util-mpm.h"
Expand Down
1 change: 1 addition & 0 deletions src/app-layer-htp-body.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "app-layer-parser.h"
#include "app-layer-htp.h"
#include "app-layer-htp-body.h"
#include "app-layer-htp-mem.h"

#include "util-spm.h"
#include "util-debug.h"
Expand Down
1 change: 1 addition & 0 deletions src/app-layer-htp-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "app-layer-parser.h"
#include "app-layer-htp.h"
#include "app-layer-htp-file.h"
#include "app-layer-htp-range.h"

#include "util-spm.h"
#include "util-debug.h"
Expand Down
1 change: 0 additions & 1 deletion src/app-layer-htp-libhtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#ifndef __APP_LAYER_HTP_LIBHTP__H__
#define __APP_LAYER_HTP_LIBHTP__H__

#include "suricata.h"
#include "suricata-common.h"

bstr *SCHTPGenerateNormalizedUri(htp_tx_t *tx, htp_uri_t *uri, int uri_include_all);
Expand Down
1 change: 0 additions & 1 deletion src/app-layer-htp-mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* 02110-1301, USA.
*/

#include "stream-tcp-reassemble.h"

void HTPParseMemcap(void);
void *HTPMalloc(size_t size);
Expand Down
3 changes: 1 addition & 2 deletions src/app-layer-htp-range.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
#define __APP_LAYER_HTP_RANGE_H__

#include "suricata-common.h"
#include "app-layer-parser.h"

#include "util-thash.h"
#include "rust-bindings.h"
#include "rust.h"

void HttpRangeContainersInit(void);
void HttpRangeContainersDestroy(void);
Expand Down
5 changes: 5 additions & 0 deletions src/app-layer-htp.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,28 @@
#include "app-layer-parser.h"

#include "app-layer.h"
#include "app-layer-detect-proto.h"
#include "app-layer-frames.h"
#include "app-layer-htp.h"
#include "app-layer-htp-body.h"
#include "app-layer-htp-file.h"
#include "app-layer-htp-libhtp.h"
#include "app-layer-htp-xff.h"
#include "app-layer-htp-range.h"
#include "app-layer-htp-mem.h"

#include "util-spm.h"
#include "util-debug.h"
#include "util-time.h"
#include "util-misc.h"
#include "util-enum.h"

#include "util-unittest.h"
#include "util-unittest-helper.h"
#include "flow-util.h"

#include "detect-engine.h"
#include "detect-engine-build.h"
#include "detect-engine-state.h"
#include "detect-parse.h"

Expand Down
5 changes: 1 addition & 4 deletions src/app-layer-htp.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@
#ifndef __APP_LAYER_HTP_H__
#define __APP_LAYER_HTP_H__

#include "util-radix-tree.h"
#include "util-file.h"
#include "app-layer-htp-mem.h"
#include "detect-engine-state.h"
#include "util-streaming-buffer.h"
#include "app-layer-htp-range.h"
#include "rust.h"
#include "app-layer-frames.h"

#include <htp/htp.h>

Expand Down
1 change: 1 addition & 0 deletions src/app-layer-modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include "app-layer-parser.h"
#include "app-layer-modbus.h"
#include "detect-engine-build.h"

void ModbusParserRegisterTests(void);

Expand Down
66 changes: 0 additions & 66 deletions src/app-layer-nbss.h

This file was deleted.

1 change: 1 addition & 0 deletions src/app-layer-nfs-udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "app-layer-parser.h"

#include "app-layer-nfs-udp.h"
#include "util-enum.h"

#include "rust.h"

Expand Down
1 change: 1 addition & 0 deletions src/app-layer-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "stream-tcp-reassemble.h"

#include "app-layer.h"
#include "app-layer-detect-proto.h"
#include "app-layer-protos.h"
#include "app-layer-parser.h"
#include "app-layer-smb.h"
Expand Down
3 changes: 0 additions & 3 deletions src/app-layer-parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
#define __APP_LAYER_PARSER_H__

#include "app-layer-events.h"
#include "app-layer-frames.h"
#include "detect-engine-state.h"
#include "util-file.h"
#include "stream-tcp-private.h"
#include "rust.h"
#include "util-config.h"

Expand Down
1 change: 1 addition & 0 deletions src/app-layer-register.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include "suricata-common.h"
#include "suricata.h"
#include "stream.h"
#include "conf.h"

Expand Down
2 changes: 2 additions & 0 deletions src/app-layer-smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "app-layer-parser.h"
#include "app-layer-smtp.h"

#include "util-enum.h"
#include "util-mpm.h"
#include "util-debug.h"
#include "util-print.h"
Expand All @@ -49,6 +50,7 @@

#include "detect-engine.h"
#include "detect-engine-state.h"
#include "detect-engine-build.h"
#include "detect-parse.h"

#include "decode-events.h"
Expand Down
Loading