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

rust/sip: register parser for tcp v8 #9880

Closed
wants to merge 6 commits into from
Closed

Conversation

glongo
Copy link
Contributor

@glongo glongo commented Nov 24, 2023

Make sure these boxes are signed before submitting your Pull Request -- thank you.

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

Describe changes:

  • Documentation added

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

To use a pull request use a branch name like pr/N where N is the
pull request number.

Alternatively, SV_BRANCH may also be a link to an
OISF/suricata-verify pull-request.

SV_REPO=
SV_BRANCH=pr/1386
SU_REPO=
SU_BRANCH=
LIBHTP_REPO=
LIBHTP_BRANCH=

Accepts valid characters as defined in RFC3261.
This patch lets the parser to work over tcp protocol, taking care of handling
data before calling the request/response parsers.

Ticket OISF#3351.
This patch permits to set a direction when a new transaction is created in order
to avoid 'signature shadowing' as reported by Eric Leblond in commit
5aaf507
Copy link
Member

@victorjulien victorjulien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failure needs to be addressed, otherwise see inline

@@ -34,6 +34,10 @@ also check all the new features that have been added but are not covered by
this guide. Those features are either not enabled by default or require
dedicated new configuration.

Upgrading 7.0 to 8.0
--------------------
- SIP over TCP is detected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"detected" seems to miss represent the features. SIP/TCP is detected, tracked, logged and available to rules through the sip keywords?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc updated.

@@ -3800,7 +3800,10 @@
"rfb": {
"$ref": "#/$defs/stats_applayer_error"
},
"sip": {
"sip_udp": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change that should be mentioned in the upgrade guide

@@ -112,6 +109,15 @@ impl SIPState {
}
}

fn append_request(&mut self, input: &[u8], request: Request) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming is a bit weird. I would expect something to be appended to an existing request, but we're actually setting up a TX. Please reword

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed append_request and append_response to build_tx_request and build_tx_response.

pub unsafe extern "C" fn rs_sip_probing_parser_tcp_tc(
_flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8,
) -> AppProto {
if input_len >= 3 && !input.is_null() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to already send 3 bytes of data? It seems the parser will need quite a few more to be able to succeed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, it doesn't make much sense. Removed it.

}

// register TCP parser
parser.ipproto = core::IPPROTO_TCP;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use pattern based detection too, esp since this is a http like proto. We can use AppLayerProtoDetectPMRegisterPatternCSwPP to register patterns with a probing parser to validate it. See smb.rs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giuseppe already answered me in a previous PR that this was tracked as a separate redmine ticket https://redmine.openinfosecfoundation.org/issues/5047

@glongo
Copy link
Contributor Author

glongo commented Nov 25, 2023

Replaced by #9893

@glongo glongo closed this Nov 25, 2023
@jufajardini jufajardini changed the title rust/sip: register parser for tcp v7 rust/sip: register parser for tcp v8 Nov 27, 2023
@glongo glongo deleted the dev-sip-tcp-v8 branch February 28, 2024 14:11
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