From: Victor Julien Date: Thu, 1 May 2025 21:47:00 +0000 (+0200) Subject: ftp: per direction tx progress X-Git-Tag: suricata-8.0.0-rc1~386 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c5ce91cbbe1a880ebe342fd4231eaa318f6e4b0;p=thirdparty%2Fsuricata.git ftp: per direction tx progress For request side, having a tx means the request is done. For response, wait for tx to be marked complete. Remove unused states. --- diff --git a/rust/src/ftp/constant.rs b/rust/src/ftp/constant.rs index f9ea4fde8f..94bea4f5c8 100644 --- a/rust/src/ftp/constant.rs +++ b/rust/src/ftp/constant.rs @@ -19,9 +19,7 @@ #[repr(u8)] #[allow(non_camel_case_types)] pub enum FtpStateValues { - FTP_STATE_NONE, FTP_STATE_IN_PROGRESS, - FTP_STATE_PORT_DONE, FTP_STATE_FINISHED, } // FTP Data progress values diff --git a/src/app-layer-ftp.c b/src/app-layer-ftp.c index 4823b5a2d6..1265355ed8 100644 --- a/src/app-layer-ftp.c +++ b/src/app-layer-ftp.c @@ -889,11 +889,11 @@ static int FTPGetAlstateProgress(void *vtx, uint8_t direction) SCLogDebug("tx %p", vtx); FTPTransaction *tx = vtx; + /* having a tx implies request side is done */ + if (direction == STREAM_TOSERVER) { + return FTP_STATE_FINISHED; + } if (!tx->done) { - if (direction == STREAM_TOSERVER && - tx->command_descriptor.command_code == FTP_COMMAND_PORT) { - return FTP_STATE_PORT_DONE; - } return FTP_STATE_IN_PROGRESS; }