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/v7 #7652

Closed
wants to merge 18 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 19 additions & 11 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache ~/.cargo
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo
key: cargo
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache ~/.cargo
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo
key: cbindgen
Expand All @@ -150,7 +150,7 @@ jobs:
steps:
# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down 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 Expand Up @@ -328,7 +336,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -415,7 +423,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -502,7 +510,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -940,7 +948,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -1012,7 +1020,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -1105,7 +1113,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -1168,7 +1176,7 @@ jobs:
steps:
# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down Expand Up @@ -1300,7 +1308,7 @@ jobs:
steps:
# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
container: ubuntu:20.04
steps:
- name: Caching ~/.cargo
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo
key: commit-check-cargo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

# Cache Rust stuff.
- name: Cache cargo registry
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
uses: actions/cache@0865c47f36e68161719c5b124609996bb5c40129
with:
path: ~/.cargo/registry
key: cargo-registry
Expand Down
Binary file modified doc/userguide/configuration/suricata-yaml/inline_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions rust/src/ike/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,14 @@ fn log_ikev2(tx: &IKETransaction, jb: &mut JsonBuilder) -> Result<(), JsonError>
jb.open_object("ikev2")?;

jb.set_uint("errors", tx.errors as u64)?;
jb.open_array("notify")?;
for notify in tx.notify_types.iter() {
jb.append_string(&format!("{:?}", notify))?;
if !tx.notify_types.is_empty() {
jb.open_array("notify")?;
for notify in tx.notify_types.iter() {
jb.append_string(&format!("{:?}", notify))?;
}
jb.close()?;
}
jb.close()?;
jb.close()?;
Ok(())
}

Expand Down
10 changes: 6 additions & 4 deletions rust/src/mqtt/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,13 @@ fn log_mqtt(tx: &MQTTTransaction, flags: u32, js: &mut JsonBuilder) -> Result<()
log_mqtt_header(js, &msg.header)?;
js.set_uint("message_id", unsuback.message_id as u64)?;
if let Some(codes) = &unsuback.reason_codes {
js.open_array("reason_codes")?;
for t in codes {
js.append_uint(*t as u64)?;
if codes.len() > 0 {
js.open_array("reason_codes")?;
for t in codes {
js.append_uint(*t as u64)?;
}
js.close()?; // reason_codes
}
js.close()?; // reason_codes
}
js.close()?; // unsuback
}
Expand Down
14 changes: 8 additions & 6 deletions rust/src/quic/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ fn log_template(tx: &QuicTransaction, js: &mut JsonBuilder) -> Result<(), JsonEr
js.set_string("ua", &String::from_utf8_lossy(&ua))?;
}
}
js.open_array("cyu")?;
for cyu in &tx.cyu {
js.start_object()?;
js.set_string("hash", &cyu.hash)?;
js.set_string("string", &cyu.string)?;
if tx.cyu.len() > 0 {
js.open_array("cyu")?;
for cyu in &tx.cyu {
js.start_object()?;
js.set_string("hash", &cyu.hash)?;
js.set_string("string", &cyu.string)?;
js.close()?;
}
js.close()?;
}
js.close()?;

js.close()?;
Ok(())
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
Loading