GH-779: Add "udp-state" signature condition

It accepts "originator" or "responder" states as a way to enforce that
the signature only matches packets in the associated direction.
The "established" state is rejected as an error since it doesn't
have a useful meaning like it does for the "tcp-state" condition.
This commit is contained in:
Jon Siwek 2020-10-09 13:43:17 -07:00
parent 7556beac20
commit 5904d0708f
7 changed files with 97 additions and 0 deletions

View file

@ -46,6 +46,20 @@ private:
int tcpstates;
};
// Implements the "udp-state" keyword.
class RuleConditionUDPState : public RuleCondition {
public:
explicit RuleConditionUDPState(int arg_states)
{ states = arg_states; }
bool DoMatch(Rule* rule, RuleEndpointState* state, const u_char* data,
int len) override;
void PrintDebug() override;
private:
int states;
};
// Implements "ip-options".
class RuleConditionIPOptions : public RuleCondition {