From: Philippe Antoine Date: Thu, 2 Dec 2021 09:29:40 +0000 (+0100) Subject: mqtt: fix transaction completion X-Git-Tag: suricata-7.0.0-beta1~1134 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b10848d84f6417a4030e5814db246b369b77593;p=thirdparty%2Fsuricata.git mqtt: fix transaction completion Ticket: 4862 A transaction to client is always considered complete in the direction to server and vice versa. Otherwise, transactions are never complete for AppLayerParserTransactionsCleanup --- diff --git a/rust/src/mqtt/mqtt.rs b/rust/src/mqtt/mqtt.rs index 700ba77f16..f377afab23 100644 --- a/rust/src/mqtt/mqtt.rs +++ b/rust/src/mqtt/mqtt.rs @@ -627,13 +627,14 @@ pub unsafe extern "C" fn rs_mqtt_tx_get_alstate_progress( direction: u8, ) -> std::os::raw::c_int { let tx = cast_pointer!(tx, MQTTTransaction); - if tx.complete { - if direction == Direction::ToServer.into() { - if tx.toserver { + match direction.into() { + Direction::ToServer => { + if tx.complete || tx.toclient { return 1; } - } else if direction == Direction::ToClient.into() { - if tx.toclient { + } + Direction::ToClient => { + if tx.complete || tx.toserver { return 1; } }