-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
config/mt: Add vlan-tuple MT selector #10015
Conversation
Issue: 6237 The VLAN tuple selector uses a tuple of values to select a tenant. - [ vlan-outermost, vlan-innermost] The tuple can contain as many VLAN values as supported by Suricata - currently 3. Each of these can accept a wild-card value (0). The tenant is selected by matching packet VLAN values with the selector values.
Show the default value used for the unix control socket instead of a generic name that's not used: custom.socket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tough work writing documentation! From my end, things are looking good :)
Information: QA ran without warnings. Pipeline 16965 |
the selector ``vlan`` (default); the selector ``vlan-tuple`` should be used if QinQ is deployed and requires both | ||
the inner and outer VLAN id values to match to determine the tenant. | ||
Multiple VLANs can have the same tenant id. VLAN id values must be between 1 and 4094 with the ``vlan`` selector. | ||
A wildcard value of ``00`` can be used with the ``vlan-tuple`` selector. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why double 0 here ?
"type": int, | ||
"variable": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this file for ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this variable
be a bool ?
SCLogError("vlan value %s is invalid; must be 0-4094", field->val); | ||
goto bad_mapping; | ||
} | ||
traffic_id.vlan.tuple[idx++] = vlan_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can overflow by specifying a bad config with too many clans ? (we should bounds check on idx)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks -- will protect this.
} else { | ||
args.vlan.tuple[count++] = (uint16_t)json_integer_value(hargs); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return early, should we not ?
We are not expecting hargs_tuple
if we got hargs
answer, "message", json_string("hargs_tuple invalid vlan id")); | ||
return false; | ||
} | ||
args.vlan.tuple[count++] = (uint16_t)vlan; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overflow on evil socket message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and not checking that there is at least one non-zero vlan
} | ||
} else if (json_is_integer(hargs)) { | ||
int vlan = json_integer_value(hargs); | ||
if (vlan < 0 || vlan > 4094) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 should not be accepted, right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"0" is a wildcard value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But only for vlan_tuple, not for a single vlan, right ?
if (tenant_val.vlan.count == traffic_id.vlan.count) { \ | ||
match = true; \ | ||
for (int i = 0; i < tenant_val.vlan.count; i++) { \ | ||
if (tenant_val.vlan.tuple[i] != traffic_id.vlan.tuple[i]) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not use special case 0 ?
} | ||
|
||
/* Match if the configured vlan match is a wildcard or the vlan ids match */ | ||
#define VLAN_TUPLE_MATCH(tenant_val, traffic_val) ((tenant_val == 0) || (tenant_val == traffic_val)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this macro used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some overflows to avoid at least
Information: QA ran without warnings. Pipeline 16965 |
Closed for further evaluation. |
Continuation of #10005
Add a new MT selector type to support use cases where a VLAN tuple should be used to determine the MT tenant.
Packets with one VLAN id will never match as
vlan-tuple
requires at least QinQ.The tuple can hold up to 3 values -- this is the max supported by Suricata atm.
Tenants are selected by specifying a VLAN tuple, e.g.,
[1010, 5]
. A packet matches when:1015
5
Wild card values are supported; values of 0 match 'any VLAN' value in the same position as expressed in the tuple:
Tenants are selected by specifying a VLAN tuple, e.g.,
[1010, 0]
. A packet matches when:1015
Link to redmine ticket: 6237
Describe changes:
vlan-tuple
-- for use cases where a VLAN pair should determines the tenant.Updates
Provide values to any of the below to override the defaults.
To use a pull request use a branch name like
pr/N
whereN
is thepull request number.
Alternatively,
SV_BRANCH
may also be a link to anOISF/suricata-verify pull-request.