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

detect: add vlan keyword - v11 #12386

Closed
wants to merge 2 commits into from

Conversation

AkakiAlice
Copy link
Contributor

@AkakiAlice AkakiAlice commented Jan 13, 2025

Ticket: #1065

Contribution style:

Our Contribution agreements:

Changes (if applicable):

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

Description:

  • introduce vlan.id and vlan.layers keywords

Changes:

SV_BRANCH=OISF/suricata-verify#2222
Previous PR: #12374

vlan.id matches on Virtual Local Area Network IDs
It is an unsigned 16-bit integer
Valid range = [0-4095]
Supports prefiltering

Ticket: OISF#1065
vlan.layers matches on the number of VLAN layers per packet
It is an unsigned 8-bit integer
Valid range = [0-3]
Supports prefiltering

Ticket: OISF#1065
Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

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

Approved previous PR and the diff looks good to fix the nit by Victor

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 88.66397% with 28 lines in your changes missing coverage. Please review.

Project coverage is 82.49%. Comparing base (05853fb) to head (b315022).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12386      +/-   ##
==========================================
+ Coverage   82.46%   82.49%   +0.02%     
==========================================
  Files         914      916       +2     
  Lines      258316   258563     +247     
==========================================
+ Hits       213030   213295     +265     
+ Misses      45286    45268      -18     
Flag Coverage Δ
fuzzcorpus 60.33% <13.42%> (-0.05%) ⬇️
livemode 19.39% <13.42%> (-0.01%) ⬇️
pcap 44.28% <13.42%> (-0.06%) ⬇️
suricata-verify 63.29% <78.37%> (+0.02%) ⬆️
unittests 58.05% <55.46%> (-0.02%) ⬇️

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

@suricata-qa
Copy link

WARNING:

field baseline test %
SURI_TLPR1_stats_chk
.uptime 651 624 95.85%

Pipeline 24188

@victorjulien victorjulien added this to the 8.0 milestone Jan 14, 2025
@victorjulien
Copy link
Member

Haven't looked at why, but in my FreeBSD 13 builder, this fails to build:

  CC       detect-vlan.o
detect-vlan.c:33:14: error: use of undeclared identifier 'DETECT_VLAN_ID_ANY'; did you mean 'DETECT_VLAN_ID'?
   33 |         case DETECT_VLAN_ID_ANY:
      |              ^~~~~~~~~~~~~~~~~~
      |              DETECT_VLAN_ID
./detect-engine-register.h:336:5: note: 'DETECT_VLAN_ID' declared here
  336 |     DETECT_VLAN_ID,
      |     ^
detect-vlan.c:40:14: error: use of undeclared identifier 'DETECT_VLAN_ID_ALL'; did you mean 'DETECT_VLAN_ID'?
   40 |         case DETECT_VLAN_ID_ALL:
      |              ^~~~~~~~~~~~~~~~~~
      |              DETECT_VLAN_ID
./detect-engine-register.h:336:5: note: 'DETECT_VLAN_ID' declared here
  336 |     DETECT_VLAN_ID,
      |     ^
detect-vlan.c:40:14: error: overflow converting case value to switch condition type (269 to 13) [-Werror,-Wswitch]
   40 |         case DETECT_VLAN_ID_ALL:
      |              ^
detect-vlan.c:33:14: error: overflow converting case value to switch condition type (269 to 13) [-Werror,-Wswitch]
   33 |         case DETECT_VLAN_ID_ANY:
      |              ^
detect-vlan.c:40:14: error: duplicate case value 'DETECT_VLAN_ID'
   40 |         case DETECT_VLAN_ID_ALL:
      |              ^
detect-vlan.c:33:14: note: previous case defined here
   33 |         case DETECT_VLAN_ID_ANY:
      |              ^
5 errors generated.

@victorjulien
Copy link
Member

Hmm the rust/gen/rust-bindings.h file doesn't have the definitions, it seems:

$ grep VLAN rust/gen/rust-bindings.h 
     * Layer can be DETECT_VLAN_ID_ANY to match with any vlan layer
     * DETECT_VLAN_ID_ALL to match if all layers match, or an integer
     * within the range -VLAN_MAX_LAYERS to VLAN_MAX_LAYERS-1 for indexing.

@victorjulien
Copy link
Member

It seems it is using a local cbindgen, which appears to be out of date. Trying again after updating it.

@victorjulien
Copy link
Member

Ok, it works now. Sorry for the noise.

@victorjulien
Copy link
Member

Merged in #12393, thanks!

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.

4 participants