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

Cleanup nits : unused macros, better depency in makefile, remove unnecesarry field out of SuricataContext #12456

Closed
wants to merge 4 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
2 changes: 1 addition & 1 deletion rust/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ vendor:
$(CARGO_ENV) $(CARGO) vendor

if HAVE_CBINDGEN
gen/rust-bindings.h: $(RUST_SURICATA_LIB)
gen/rust-bindings.h: $(RUST_SURICATA_LIB) cbindgen.toml
cd $(abs_top_srcdir)/rust && \
cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
--quiet --verify --output $(abs_top_builddir)/rust/gen/rust-bindings.h || true
Expand Down
6 changes: 1 addition & 5 deletions rust/src/applayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::direction::Direction;
use crate::filecontainer::FileContainer;
use crate::flow::Flow;
use std::os::raw::{c_void,c_char,c_int};
use crate::core::SC;
use std::ffi::CStr;
use crate::core::StreamingBufferConfig;

Expand Down Expand Up @@ -480,12 +479,9 @@ pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char;
extern {
pub fn AppLayerRegisterProtocolDetection(parser: *const RustParser, enable_default: c_int) -> AppProto;
pub fn AppLayerRegisterParserAlias(parser_name: *const c_char, alias_name: *const c_char);
pub fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProto) -> c_int;
}

#[allow(non_snake_case)]
pub unsafe fn AppLayerRegisterParser(parser: *const RustParser, alproto: AppProto) -> c_int {
(SC.unwrap().AppLayerRegisterParser)(parser, alproto)
}

// Defined in app-layer-detect-proto.h
/// cbindgen:ignore
Expand Down
2 changes: 0 additions & 2 deletions rust/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ pub struct SuricataContext {
pub FileAppendData: SCFileAppendDataById,
pub FileAppendGAP: SCFileAppendGAPById,
pub FileContainerRecycle: SCFileContainerRecycle,

pub AppLayerRegisterParser: extern fn(parser: *const crate::applayer::RustParser, alproto: AppProto) -> std::os::raw::c_int,
}

#[allow(non_snake_case)]
Expand Down
3 changes: 1 addition & 2 deletions src/detect-transform-base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@
static int DetectTransformFromBase64DecodeSetup(DetectEngineCtx *, Signature *, const char *);
static void DetectTransformFromBase64DecodeFree(DetectEngineCtx *, void *);
#ifdef UNITTESTS
#define DETECT_TRANSFORM_FROM_BASE64_MODE_DEFAULT (uint8_t) Base64ModeRFC4648
static void DetectTransformFromBase64DecodeRegisterTests(void);
#endif
static void TransformFromBase64Decode(InspectionBuffer *buffer, void *options);

#define DETECT_TRANSFORM_FROM_BASE64_MODE_DEFAULT (uint8_t) Base64ModeRFC4648

void DetectTransformFromBase64DecodeRegister(void)
{
sigmatch_table[DETECT_TRANSFORM_FROM_BASE64].name = "from_base64";
Expand Down
2 changes: 0 additions & 2 deletions src/rust-context.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const SuricataContext suricata_context = {
FileAppendDataById,
FileAppendGAPById,
FileContainerRecycle,

AppLayerRegisterParser,
};

const SuricataContext *SCGetContext(void)
Expand Down
3 changes: 0 additions & 3 deletions src/rust-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ typedef struct SuricataContext_ {
int (*FileAppendGAPById)(FileContainer *, const StreamingBufferConfig *, uint32_t track_id,
const uint8_t *data, uint32_t data_len);
void (*FileContainerRecycle)(FileContainer *ffc, const StreamingBufferConfig *);

int (*AppLayerRegisterParser)(const struct AppLayerParser *p, AppProto alproto);

} SuricataContext;

extern const SuricataContext suricata_context;
Expand Down
2 changes: 2 additions & 0 deletions src/source-pcap-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ void TmModuleDecodePcapFileRegister (void)
tmm_modules[TMM_DECODEPCAPFILE].flags = TM_FLAG_DECODE_TM;
}

#if defined(HAVE_SETVBUF) && defined(OS_LINUX)
#define PCAP_FILE_BUFFER_SIZE_DEFAULT 131072U // 128 KiB
#define PCAP_FILE_BUFFER_SIZE_MIN 4096U // 4 KiB
#define PCAP_FILE_BUFFER_SIZE_MAX 67108864U // 64MiB
#endif

void PcapFileGlobalInit(void)
{
Expand Down
Loading