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

Flow bytes pkts either support/v4 #11897

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

inashivb
Copy link
Member

@inashivb inashivb commented Oct 8, 2024

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

SV_BRANCH=OISF/suricata-verify#2082

Previous PR: #11889

Changes since v3:

  • Kept the old syntax as that is more in line w schema as per internal discussion
  • rebased on top of latest master

Add an extension to keywords flow.bytes.. and flow.pkts.. to allow
matching on bytes or pkts in either direction. The syntax for this
operation would look like the following:

flow.bytes_either:1000
flow.pkts_either:20

These are implemented as generic uint types and thus allow all basic ops
in the syntax like greater than, less than, etc alongwith the exact
match.

Feature 5646
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 69.33333% with 23 lines in your changes missing coverage. Please review.

Project coverage is 82.61%. Comparing base (6ae5ae7) to head (f4bc8c7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11897   +/-   ##
=======================================
  Coverage   82.60%   82.61%           
=======================================
  Files         912      912           
  Lines      249342   249417   +75     
=======================================
+ Hits       205968   206046   +78     
+ Misses      43374    43371    -3     
Flag Coverage Δ
fuzzcorpus 60.66% <25.33%> (+0.02%) ⬆️
livemode 18.72% <25.33%> (+<0.01%) ⬆️
pcap 44.08% <25.33%> (+0.01%) ⬆️
suricata-verify 62.01% <69.33%> (-0.02%) ⬇️
unittests 58.93% <25.33%> (-0.01%) ⬇️

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

@inashivb inashivb changed the title Flow bytes pkts syntax/v4 Flow bytes pkts either support/v4 Oct 8, 2024
@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 23041

if (p->flow == NULL) {
return 0;
}
uint32_t nb = p->flow->tosrcpktcnt;
Copy link
Member

Choose a reason for hiding this comment

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

can avoid using nb and just use p->flow->tosrcpkt_cnt directly?

if (p->flow == NULL) {
return 0;
}
uint64_t nb = p->flow->tosrcbytecnt;
Copy link
Member

Choose a reason for hiding this comment

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

same as with pkts

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.

See inline comments.

@victorjulien
Copy link
Member

Still not entirely fan of the keyword itself, as I feel it is better to have it as an option somehow. But since the existing keywords map to eve, and adding the option there doesn't make sense, I don't know a better way right now.

Or we'd have change eve to do something like:

flow.pkts.toserver
flow.pkts.toclient

then keywords could be

flow.pkts:toserver
flow.pkts:toclient
flow.pkts:either

Hmmm... not a perfect match either. So, I remain undecided...

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