From 3c5ce91cbbe1a880ebe342fd4231eaa318f6e4b0 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 1 May 2025 23:47:00 +0200 Subject: [PATCH] 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. --- rust/src/ftp/constant.rs | 2 -- src/app-layer-ftp.c | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) 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; }