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

ftp: begin conversion process to Rust #12629

Closed
wants to merge 3 commits into from
Closed

Conversation

jlucovsky
Copy link
Contributor

Continuation of #12586

ftp: Partial conversion of the FTP protocol parser to Rust.

This PR represents partial completion of issue 4082.

Link to ticket: https://redmine.openinfosecfoundation.org/issues/4082

Describe changes:

  • FTP enumerations moved to Rust
  • FTP command handling moved to Rust (FtpTransferCmd, FtpRequestCommand)
  • FTP configuration file interaction moved to Rust (note behavioral change below)
  • ftp.command sticky buffer and FTP output logic updated

Updates:

  • Address review comments (Rust improvements, refactoring).

Behavioral change

Previous versions of Suricata terminated execution if ftp.memcap contained an invalid value. An error message was displayed before exiting. The changes in this PR continue to print the error message in this case; instead of terminating Suricata, Suricata will continue execution and use a value of 0 for ftp.memcap. This is noted in the upgrade notes.

Provide values to any of the below to override the defaults.

  • To use an LibHTP, Suricata-Verify or Suricata-Update pull request,
    link to the pull request in the respective _BRANCH variable.
  • Leave unused overrides blank or remove.

SV_REPO=
SV_BRANCH=OISF/suricata-verify#2273
SU_REPO=
SU_BRANCH=
LIBHTP_REPO=
LIBHTP_BRANCH=

As part of the effort to convert the FTP/FTPDATA parser to rust, move
the enums from C to rust.

Issue: 4082
Issue: 4082

This command moves the FtpTransferCmd and FtpCommand to Rust.

Due to the way commands are noted in the transactions, the logic in the
sticky buffer ftp.command and the ftp json output functions was updated.
Issue: 4082

Move the configuration file handling to Rust.

These changes will no longer terminate Suricata when there's an invalid
value for ftp.memcap. Like earlier Suricata releases, an error message
is logged "Invalid value <value> for ftp.memcap" but Suricata will no
longer terminate execution. It will use a default value of "0" instead.
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

Attention: Patch coverage is 86.86131% with 18 lines in your changes missing coverage. Please review.

Project coverage is 80.75%. Comparing base (10ede91) to head (be70aa8).
Report is 19 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12629      +/-   ##
==========================================
+ Coverage   80.74%   80.75%   +0.01%     
==========================================
  Files         931      933       +2     
  Lines      259144   259212      +68     
==========================================
+ Hits       209242   209334      +92     
+ Misses      49902    49878      -24     
Flag Coverage Δ
fuzzcorpus 56.98% <73.84%> (+0.02%) ⬆️
livemode 19.38% <20.76%> (+<0.01%) ⬆️
pcap 44.16% <74.61%> (+<0.01%) ⬆️
suricata-verify 63.46% <93.70%> (+0.02%) ⬆️
unittests 58.33% <21.64%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24792

@jlucovsky
Copy link
Contributor Author

Continued in #12639

@jlucovsky jlucovsky closed this Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants