From 3aea5ad6f59d9778025025b8ec85fcf862d84869 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 28 Jun 2024 21:27:54 +0530 Subject: [PATCH 1/2] applayer: remove truncation logic --- rust/src/applayer.rs | 2 -- src/app-layer-parser.c | 34 +++++----------------------------- src/app-layer-parser.h | 3 +-- src/output-tx.c | 6 ++---- 4 files changed, 8 insertions(+), 37 deletions(-) diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 9814143ba5ef..46fbbd55604f 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -502,8 +502,6 @@ pub const APP_LAYER_PARSER_NO_INSPECTION_PAYLOAD : u16 = BIT_U16!(3); pub const APP_LAYER_PARSER_BYPASS_READY : u16 = BIT_U16!(4); pub const APP_LAYER_PARSER_EOF_TS : u16 = BIT_U16!(5); pub const APP_LAYER_PARSER_EOF_TC : u16 = BIT_U16!(6); -pub const APP_LAYER_PARSER_TRUNC_TS : u16 = BIT_U16!(7); -pub const APP_LAYER_PARSER_TRUNC_TC : u16 = BIT_U16!(8); pub const APP_LAYER_PARSER_OPT_ACCEPT_GAPS: u32 = BIT_U32!(0); diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index 70e4d2af2086..fc87ea17fe6c 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -201,9 +201,6 @@ FramesContainer *AppLayerFramesSetupContainer(Flow *f) return f->alparser->frames; } -static inline void AppLayerParserStreamTruncated(AppLayerParserState *pstate, const uint8_t ipproto, - const AppProto alproto, void *alstate, const uint8_t direction); - #ifdef UNITTESTS void UTHAppLayerParserStateGetIds(void *ptr, uint64_t *i1, uint64_t *i2, uint64_t *log, uint64_t *min) { @@ -947,11 +944,8 @@ void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir) AppLayerTxData *txd = AppLayerParserGetTxData(ipproto, alproto, tx); if (txd != NULL && AppLayerParserHasFilesInDir(txd, pkt_dir)) { if (pkt_dir_trunc == -1) - pkt_dir_trunc = - AppLayerParserStateIssetFlag(f->alparser, - (pkt_dir == STREAM_TOSERVER) ? APP_LAYER_PARSER_TRUNC_TS - : APP_LAYER_PARSER_TRUNC_TC) != 0; - + pkt_dir_trunc = IS_DISRUPTED( + (pkt_dir == STREAM_TOSERVER) ? ts_disrupt_flags : tc_disrupt_flags); AppLayerParserFileTxHousekeeping(f, tx, pkt_dir, (bool)pkt_dir_trunc); } @@ -1308,7 +1302,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow if (!(p->option_flags & APP_LAYER_PARSER_OPT_ACCEPT_GAPS)) { SCLogDebug("app-layer parser does not accept gaps"); if (f->alstate != NULL && !FlowChangeProto(f)) { - AppLayerParserStreamTruncated(pstate, f->proto, alproto, f->alstate, flags); + AppLayerParserTriggerRawStreamReassembly(f, direction); } AppLayerIncGapErrorCounter(tv, f); goto error; @@ -1468,9 +1462,9 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow AppLayerIncTxCounter(tv, f, cur_tx_cnt - p_tx_cnt); } - /* stream truncated, inform app layer */ + /* stream truncated, trigger raw stream reassembly */ if (flags & STREAM_DEPTH) - AppLayerParserStreamTruncated(pstate, f->proto, alproto, f->alstate, flags); + AppLayerParserTriggerRawStreamReassembly(f, direction); end: /* update app progress */ @@ -1796,24 +1790,6 @@ uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag SCReturnUInt(pstate->flags & flag); } -static inline void AppLayerParserStreamTruncated(AppLayerParserState *pstate, const uint8_t ipproto, - const AppProto alproto, void *alstate, const uint8_t direction) -{ - SCEnter(); - - if (direction & STREAM_TOSERVER) { - AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_TRUNC_TS); - } else { - AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_TRUNC_TC); - } - - if (alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate != NULL) { - alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate(alstate, direction); - } - - SCReturn; -} - /***** Unittests *****/ #ifdef UNITTESTS diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 9dbab6701d60..540d4a2b06ff 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -38,8 +38,7 @@ #define APP_LAYER_PARSER_BYPASS_READY BIT_U16(4) #define APP_LAYER_PARSER_EOF_TS BIT_U16(5) #define APP_LAYER_PARSER_EOF_TC BIT_U16(6) -#define APP_LAYER_PARSER_TRUNC_TS BIT_U16(7) -#define APP_LAYER_PARSER_TRUNC_TC BIT_U16(8) +/* 2x vacancy */ #define APP_LAYER_PARSER_SFRAME_TS BIT_U16(9) #define APP_LAYER_PARSER_SFRAME_TC BIT_U16(10) diff --git a/src/output-tx.c b/src/output-tx.c index 7bc569ef9016..582477c16408 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -377,10 +377,8 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data) SCLogDebug("pcap_cnt %" PRIu64, p->pcap_cnt); const bool last_pseudo = (p->flowflags & FLOW_PKT_LAST_PSEUDO) != 0; - const bool ts_eof = AppLayerParserStateIssetFlag(f->alparser, - (APP_LAYER_PARSER_EOF_TS | APP_LAYER_PARSER_TRUNC_TS)) != 0; - const bool tc_eof = AppLayerParserStateIssetFlag(f->alparser, - (APP_LAYER_PARSER_EOF_TC | APP_LAYER_PARSER_TRUNC_TC)) != 0; + const bool ts_eof = AppLayerParserStateIssetFlag(f->alparser, APP_LAYER_PARSER_EOF_TS) != 0; + const bool tc_eof = AppLayerParserStateIssetFlag(f->alparser, APP_LAYER_PARSER_EOF_TC) != 0; const bool eof = last_pseudo || (ts_eof && tc_eof); SCLogDebug("eof %d last_pseudo %d ts_eof %d tc_eof %d", eof, last_pseudo, ts_eof, tc_eof); From d62cab31e2f7bfe3b56a572a30a3a12f26214e62 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Wed, 3 Jul 2024 17:45:28 +0530 Subject: [PATCH 2/2] src: remove truncate fn and glue code truncate fn is only active and used by dcerpc and smb parsers. In case stream depth is reached for any side, truncate fn is supposed to set the tx entity (request/response) in the same direction as complete so the other side is not forever waiting for data. However, whether the stream depth is reached is already checked by AppLayerParserGetStateProgress fn which is called by: - DetectTx - DetectEngineInspectBufferGeneric - AppLayerParserSetTransactionInspectId - OutputTxLog - AppLayerParserTransactionsCleanup and, in such a case, StateGetProgressCompletionStatus is returned for the respective direction. This fn following efc9a7a3, always returns 1 as long as the direction is valid meaning that the progress for the current direction is marked complete. So, there is no need for the additional callback to mark the entities as done in case of depth or a gap. Remove all such glue code and callbacks for truncate fns. Bug 7044 --- rust/src/applayer.rs | 5 ---- rust/src/applayertemplate/template.rs | 1 - rust/src/bittorrent_dht/bittorrent_dht.rs | 1 - rust/src/dcerpc/dcerpc.rs | 32 ----------------------- rust/src/dcerpc/dcerpc_udp.rs | 1 - rust/src/dhcp/dhcp.rs | 1 - rust/src/dns/dns.rs | 2 -- rust/src/enip/enip.rs | 1 - rust/src/http2/http2.rs | 1 - rust/src/ike/ike.rs | 1 - rust/src/krb/krb5.rs | 1 - rust/src/modbus/modbus.rs | 1 - rust/src/mqtt/mqtt.rs | 1 - rust/src/nfs/nfs.rs | 2 -- rust/src/ntp/ntp.rs | 1 - rust/src/pgsql/pgsql.rs | 1 - rust/src/quic/quic.rs | 1 - rust/src/rdp/rdp.rs | 1 - rust/src/rfb/rfb.rs | 1 - rust/src/sip/sip.rs | 1 - rust/src/smb/smb.rs | 1 - rust/src/snmp/snmp.rs | 1 - rust/src/ssh/ssh.rs | 1 - rust/src/telnet/telnet.rs | 1 - rust/src/websocket/websocket.rs | 1 - src/app-layer-parser.c | 12 --------- src/app-layer-parser.h | 2 -- src/app-layer-register.c | 4 --- src/app-layer-register.h | 2 -- 29 files changed, 82 deletions(-) diff --git a/rust/src/applayer.rs b/rust/src/applayer.rs index 46fbbd55604f..187245917ab6 100644 --- a/rust/src/applayer.rs +++ b/rust/src/applayer.rs @@ -394,10 +394,6 @@ pub struct RustParser { pub flags: u32, - /// Function to handle the end of data coming on one of the sides - /// due to the stream reaching its 'depth' limit. - pub truncate: Option, - pub get_frame_id_by_name: Option, pub get_frame_name_by_id: Option, } @@ -458,7 +454,6 @@ pub type GetTxIteratorFn = unsafe extern "C" fn (ipproto: u8, alproto: AppPro pub type GetTxDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerTxData; pub type GetStateDataFn = unsafe extern "C" fn(*mut c_void) -> *mut AppLayerStateData; pub type ApplyTxConfigFn = unsafe extern "C" fn (*mut c_void, *mut c_void, c_int, AppLayerTxConfig); -pub type TruncateFn = unsafe extern "C" fn (*mut c_void, u8); pub type GetFrameIdByName = unsafe extern "C" fn(*const c_char) -> c_int; pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char; diff --git a/rust/src/applayertemplate/template.rs b/rust/src/applayertemplate/template.rs index e8cdc27dfe91..43a8bf940006 100644 --- a/rust/src/applayertemplate/template.rs +++ b/rust/src/applayertemplate/template.rs @@ -427,7 +427,6 @@ pub unsafe extern "C" fn rs_template_register_parser() { get_state_data: rs_template_get_state_data, apply_tx_config: None, flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/bittorrent_dht/bittorrent_dht.rs b/rust/src/bittorrent_dht/bittorrent_dht.rs index 61eefb9e29af..f48cb3d2bf28 100644 --- a/rust/src/bittorrent_dht/bittorrent_dht.rs +++ b/rust/src/bittorrent_dht/bittorrent_dht.rs @@ -282,7 +282,6 @@ pub unsafe extern "C" fn rs_bittorrent_dht_udp_register_parser() { get_state_data: rs_bittorrent_dht_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index 3a1af7df5316..bb82ad33be43 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -322,8 +322,6 @@ pub struct DCERPCState { pub tc_gap: bool, pub ts_ssn_gap: bool, pub tc_ssn_gap: bool, - pub ts_ssn_trunc: bool, /// true if Truncated in this direction - pub tc_ssn_trunc: bool, pub flow: Option<*const core::Flow>, state_data: AppLayerStateData, } @@ -354,8 +352,6 @@ impl DCERPCState { tx.call_id = call_id; tx.endianness = endianness; self.tx_id += 1; - tx.req_done = self.ts_ssn_trunc; - tx.resp_done = self.tc_ssn_trunc; if self.transactions.len() > unsafe { DCERPC_MAX_TX } { let mut index = self.tx_index_completed; for tx_old in &mut self.transactions.range_mut(self.tx_index_completed..) { @@ -1187,33 +1183,6 @@ pub unsafe extern "C" fn rs_dcerpc_state_transaction_free(state: *mut std::os::r dce_state.free_tx(tx_id); } -#[no_mangle] -pub unsafe extern "C" fn rs_dcerpc_state_trunc(state: *mut std::os::raw::c_void, direction: u8) { - let dce_state = cast_pointer!(state, DCERPCState); - match direction.into() { - Direction::ToServer => { - dce_state.ts_ssn_trunc = true; - for tx in &mut dce_state.transactions { - tx.req_done = true; - if let Some(flow) = dce_state.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToServer as i32); - } - } - SCLogDebug!("dce_state.ts_ssn_trunc = true; txs {}", dce_state.transactions.len()); - } - Direction::ToClient => { - dce_state.tc_ssn_trunc = true; - for tx in &mut dce_state.transactions { - tx.resp_done = true; - if let Some(flow) = dce_state.flow { - sc_app_layer_parser_trigger_raw_stream_reassembly(flow, Direction::ToClient as i32); - } - } - SCLogDebug!("dce_state.tc_ssn_trunc = true; txs {}", dce_state.transactions.len()); - } - } -} - #[no_mangle] pub unsafe extern "C" fn rs_dcerpc_get_tx( vtx: *mut std::os::raw::c_void, tx_id: u64, @@ -1367,7 +1336,6 @@ pub unsafe extern "C" fn rs_dcerpc_register_parser() { get_state_data: rs_dcerpc_get_state_data, apply_tx_config: None, flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/dcerpc/dcerpc_udp.rs b/rust/src/dcerpc/dcerpc_udp.rs index 2007c867bfae..ab7f65cafbad 100644 --- a/rust/src/dcerpc/dcerpc_udp.rs +++ b/rust/src/dcerpc/dcerpc_udp.rs @@ -374,7 +374,6 @@ pub unsafe extern "C" fn rs_dcerpc_udp_register_parser() { get_state_data: rs_dcerpc_udp_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/dhcp/dhcp.rs b/rust/src/dhcp/dhcp.rs index e43d4e863a60..5b6f4b4a085a 100644 --- a/rust/src/dhcp/dhcp.rs +++ b/rust/src/dhcp/dhcp.rs @@ -298,7 +298,6 @@ pub unsafe extern "C" fn rs_dhcp_register_parser() { get_state_data : rs_dhcp_get_state_data, apply_tx_config : None, flags : 0, - truncate : None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index a293a028e142..1bd84038869d 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -985,7 +985,6 @@ pub unsafe extern "C" fn SCRegisterDnsUdpParser() { get_state_data: rs_dns_get_state_data, apply_tx_config: Some(apply_tx_config), flags: 0, - truncate: None, get_frame_id_by_name: Some(DnsFrameType::ffi_id_from_name), get_frame_name_by_id: Some(DnsFrameType::ffi_name_from_id), }; @@ -1031,7 +1030,6 @@ pub unsafe extern "C" fn SCRegisterDnsTcpParser() { get_state_data: rs_dns_get_state_data, apply_tx_config: Some(apply_tx_config), flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: None, get_frame_id_by_name: Some(DnsFrameType::ffi_id_from_name), get_frame_name_by_id: Some(DnsFrameType::ffi_name_from_id), }; diff --git a/rust/src/enip/enip.rs b/rust/src/enip/enip.rs index 26f11140dc3a..05ec13a670d9 100644 --- a/rust/src/enip/enip.rs +++ b/rust/src/enip/enip.rs @@ -612,7 +612,6 @@ pub unsafe extern "C" fn SCEnipRegisterParsers() { get_state_data: SCEnipTxGetState_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: Some(EnipFrameType::ffi_id_from_name), get_frame_name_by_id: Some(EnipFrameType::ffi_name_from_id), }; diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index 6a5b3936c981..2e41c2967aa7 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -1366,7 +1366,6 @@ pub unsafe extern "C" fn rs_http2_register_parser() { get_state_data: rs_http2_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/ike/ike.rs b/rust/src/ike/ike.rs index 2a5448ab27cf..df62c19cb4ff 100644 --- a/rust/src/ike/ike.rs +++ b/rust/src/ike/ike.rs @@ -424,7 +424,6 @@ pub unsafe extern "C" fn rs_ike_register_parser() { get_state_data: rs_ike_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/krb/krb5.rs b/rust/src/krb/krb5.rs index aceeb86d2b47..51b215ca30d1 100644 --- a/rust/src/krb/krb5.rs +++ b/rust/src/krb/krb5.rs @@ -609,7 +609,6 @@ pub unsafe extern "C" fn rs_register_krb5_parser() { get_state_data : rs_krb5_get_state_data, apply_tx_config : None, flags : 0, - truncate : None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/modbus/modbus.rs b/rust/src/modbus/modbus.rs index 02e2bcfd035d..0d0c73371ef0 100644 --- a/rust/src/modbus/modbus.rs +++ b/rust/src/modbus/modbus.rs @@ -407,7 +407,6 @@ pub unsafe extern "C" fn rs_modbus_register_parser() { get_state_data: rs_modbus_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/mqtt/mqtt.rs b/rust/src/mqtt/mqtt.rs index b33069f7094c..aed47adb011a 100644 --- a/rust/src/mqtt/mqtt.rs +++ b/rust/src/mqtt/mqtt.rs @@ -783,7 +783,6 @@ pub unsafe extern "C" fn SCMqttRegisterParser() { get_state_data: rs_mqtt_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: Some(MQTTFrameType::ffi_id_from_name), get_frame_name_by_id: Some(MQTTFrameType::ffi_name_from_id), }; diff --git a/rust/src/nfs/nfs.rs b/rust/src/nfs/nfs.rs index 19d8d93cecce..d4b472e1f69c 100644 --- a/rust/src/nfs/nfs.rs +++ b/rust/src/nfs/nfs.rs @@ -1989,7 +1989,6 @@ pub unsafe extern "C" fn rs_nfs_register_parser() { get_state_data: rs_nfs_get_state_data, apply_tx_config: None, flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: None, get_frame_id_by_name: Some(NFSFrameType::ffi_id_from_name), get_frame_name_by_id: Some(NFSFrameType::ffi_name_from_id), }; @@ -2067,7 +2066,6 @@ pub unsafe extern "C" fn rs_nfs_udp_register_parser() { get_state_data: rs_nfs_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: Some(NFSFrameType::ffi_id_from_name), get_frame_name_by_id: Some(NFSFrameType::ffi_name_from_id), }; diff --git a/rust/src/ntp/ntp.rs b/rust/src/ntp/ntp.rs index 3a06cfb8b14a..ae723bbb21cd 100644 --- a/rust/src/ntp/ntp.rs +++ b/rust/src/ntp/ntp.rs @@ -300,7 +300,6 @@ pub unsafe extern "C" fn rs_register_ntp_parser() { get_state_data : rs_ntp_get_state_data, apply_tx_config : None, flags : 0, - truncate : None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/pgsql/pgsql.rs b/rust/src/pgsql/pgsql.rs index bd76346f80ec..1873be5a7532 100644 --- a/rust/src/pgsql/pgsql.rs +++ b/rust/src/pgsql/pgsql.rs @@ -761,7 +761,6 @@ pub unsafe extern "C" fn rs_pgsql_register_parser() { get_state_data: rs_pgsql_get_state_data, apply_tx_config: None, flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/quic/quic.rs b/rust/src/quic/quic.rs index 330b0f8d379d..bc58afe21974 100644 --- a/rust/src/quic/quic.rs +++ b/rust/src/quic/quic.rs @@ -508,7 +508,6 @@ pub unsafe extern "C" fn rs_quic_register_parser() { get_state_data: rs_quic_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/rdp/rdp.rs b/rust/src/rdp/rdp.rs index 2899f99c1824..25b5ee381a63 100644 --- a/rust/src/rdp/rdp.rs +++ b/rust/src/rdp/rdp.rs @@ -493,7 +493,6 @@ pub unsafe extern "C" fn rs_rdp_register_parser() { get_state_data: rs_rdp_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/rfb/rfb.rs b/rust/src/rfb/rfb.rs index c17455bc0654..6e923cab55ce 100644 --- a/rust/src/rfb/rfb.rs +++ b/rust/src/rfb/rfb.rs @@ -860,7 +860,6 @@ pub unsafe extern "C" fn rs_rfb_register_parser() { get_state_data: rs_rfb_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: Some(RFBFrameType::ffi_id_from_name), get_frame_name_by_id: Some(RFBFrameType::ffi_name_from_id), }; diff --git a/rust/src/sip/sip.rs b/rust/src/sip/sip.rs index 6d38c8fd7e4f..38f76fb277ac 100755 --- a/rust/src/sip/sip.rs +++ b/rust/src/sip/sip.rs @@ -570,7 +570,6 @@ pub unsafe extern "C" fn rs_sip_register_parser() { get_state_data: rs_sip_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: Some(SIPFrameType::ffi_id_from_name), get_frame_name_by_id: Some(SIPFrameType::ffi_name_from_id), }; diff --git a/rust/src/smb/smb.rs b/rust/src/smb/smb.rs index 56e1685e3079..de81cfa64a6a 100644 --- a/rust/src/smb/smb.rs +++ b/rust/src/smb/smb.rs @@ -2327,7 +2327,6 @@ pub unsafe extern "C" fn rs_smb_register_parser() { get_state_data: rs_smb_get_state_data, apply_tx_config: None, flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: Some(rs_smb_state_truncate), get_frame_id_by_name: Some(SMBFrameType::ffi_id_from_name), get_frame_name_by_id: Some(SMBFrameType::ffi_name_from_id), }; diff --git a/rust/src/snmp/snmp.rs b/rust/src/snmp/snmp.rs index b4bb6321a3ec..4e1afd0566e3 100644 --- a/rust/src/snmp/snmp.rs +++ b/rust/src/snmp/snmp.rs @@ -406,7 +406,6 @@ pub unsafe extern "C" fn rs_register_snmp_parser() { get_state_data : rs_snmp_get_state_data, apply_tx_config : None, flags : 0, - truncate : None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/ssh/ssh.rs b/rust/src/ssh/ssh.rs index c1f08a904c4d..d5341a2cfb19 100644 --- a/rust/src/ssh/ssh.rs +++ b/rust/src/ssh/ssh.rs @@ -464,7 +464,6 @@ pub unsafe extern "C" fn rs_ssh_register_parser() { get_state_data: rs_ssh_get_state_data, apply_tx_config: None, flags: 0, - truncate: None, get_frame_id_by_name: None, get_frame_name_by_id: None, }; diff --git a/rust/src/telnet/telnet.rs b/rust/src/telnet/telnet.rs index 2a63b7332135..29b02a9b7f41 100644 --- a/rust/src/telnet/telnet.rs +++ b/rust/src/telnet/telnet.rs @@ -537,7 +537,6 @@ pub unsafe extern "C" fn rs_telnet_register_parser() { get_state_data: rs_telnet_get_state_data, apply_tx_config: None, flags: APP_LAYER_PARSER_OPT_ACCEPT_GAPS, - truncate: None, get_frame_id_by_name: Some(TelnetFrameType::ffi_id_from_name), get_frame_name_by_id: Some(TelnetFrameType::ffi_name_from_id), diff --git a/rust/src/websocket/websocket.rs b/rust/src/websocket/websocket.rs index 26747525fbb2..ebbe901a53b0 100644 --- a/rust/src/websocket/websocket.rs +++ b/rust/src/websocket/websocket.rs @@ -366,7 +366,6 @@ pub unsafe extern "C" fn rs_websocket_register_parser() { get_state_data: rs_websocket_get_state_data, apply_tx_config: None, flags: 0, // do not accept gaps as there is no good way to resync - truncate: None, get_frame_id_by_name: Some(WebSocketFrameType::ffi_id_from_name), get_frame_name_by_id: Some(WebSocketFrameType::ffi_name_from_id), }; diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index fc87ea17fe6c..bea5dbe526e2 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -83,8 +83,6 @@ typedef struct AppLayerParserProtoCtx_ void *(*LocalStorageAlloc)(void); void (*LocalStorageFree)(void *); - void (*Truncate)(void *, uint8_t); - /** get FileContainer reference from the TX. MUST return a non-NULL reference if the TX * has or may have files in the requested direction at some point. */ AppLayerGetFileState (*GetTxFiles)(void *, uint8_t); @@ -465,16 +463,6 @@ void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto) SCReturn; } -void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto, - void (*Truncate)(void *, uint8_t)) -{ - SCEnter(); - - alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].Truncate = Truncate; - - SCReturn; -} - void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int (*StateGetProgress)(void *alstate, uint8_t direction)) { diff --git a/src/app-layer-parser.h b/src/app-layer-parser.h index 540d4a2b06ff..18f5cce70f58 100644 --- a/src/app-layer-parser.h +++ b/src/app-layer-parser.h @@ -182,8 +182,6 @@ void AppLayerParserRegisterGetTxFilesFunc( uint8_t ipproto, AppProto alproto, AppLayerGetFileState (*GetTxFiles)(void *, uint8_t)); void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto); void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits); -void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto, - void (*Truncate)(void *, uint8_t)); void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto, int (*StateGetStateProgress)(void *alstate, uint8_t direction)); void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto, diff --git a/src/app-layer-register.c b/src/app-layer-register.c index c4441d9f7c5b..1e4986b361ea 100644 --- a/src/app-layer-register.c +++ b/src/app-layer-register.c @@ -183,10 +183,6 @@ int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto) } - if (p->Truncate) { - AppLayerParserRegisterTruncateFunc(p->ip_proto, alproto, p->Truncate); - } - if (p->GetFrameIdByName && p->GetFrameNameById) { AppLayerParserRegisterGetFrameFuncs( p->ip_proto, alproto, p->GetFrameIdByName, p->GetFrameNameById); diff --git a/src/app-layer-register.h b/src/app-layer-register.h index eda9628f9890..78eff7d8e4ce 100644 --- a/src/app-layer-register.h +++ b/src/app-layer-register.h @@ -71,8 +71,6 @@ typedef struct AppLayerParser { uint32_t flags; - void (*Truncate)(void *state, uint8_t direction); - AppLayerParserGetFrameIdByNameFn GetFrameIdByName; AppLayerParserGetFrameNameByIdFn GetFrameNameById;