Skip to content

Commit d189f7a

Browse files
committed
flowbits: add deprecation notice for toggle command
Task 8638
1 parent 6e7907e commit d189f7a

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

doc/userguide/rules/flow-keywords.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ flowbits: isset, name
2727
flowbits: toggle, name
2828
Reverses the present setting. So for example if a condition is set,
2929
it will be unset and vice-versa.
30+
31+
.. deprecated:: 7.0.17
32+
The ``toggle`` command is deprecated and will be removed in Suricata 9.0.
3033
flowbits: unset, name
3134
Can be used to unset the condition in the flow.
3235
flowbits: isnotset, name
@@ -305,4 +308,4 @@ Signature example::
305308

306309
alert tcp any any -> any any (msg:"Flow longer than one hour"; flow.age:>3600; flowbits: isnotset, onehourflow; flowbits: onehourflow, name; sid:1; rev:1;)
307310

308-
In this example, we combine `flow.age` and `flowbits` to get an alert on the first packet after the flow's age is older than one hour.
311+
In this example, we combine `flow.age` and `flowbits` to get an alert on the first packet after the flow's age is older than one hour.

doc/userguide/upgrade.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ also check all the new features that have been added but are not covered by
3434
this guide. Those features are either not enabled by default or require
3535
dedicated new configuration.
3636

37+
Upgrading to 7.0.17
38+
-------------------
39+
40+
Deprecations
41+
~~~~~~~~~~~~~
42+
43+
- The ``flowbits`` ``toggle`` command is now deprecated and will be removed in
44+
Suricata 9.0.
45+
3746
Upgrading to 7.0.14
3847
-------------------
3948

src/detect-flowbits.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ int DetectFlowbitSetup (DetectEngineCtx *de_ctx, Signature *s, const char *rawst
301301
fb_cmd = DETECT_FLOWBITS_CMD_UNSET;
302302
} else if (strcmp(fb_cmd_str,"toggle") == 0) {
303303
fb_cmd = DETECT_FLOWBITS_CMD_TOGGLE;
304+
if ((de_ctx->flags & DE_WARN_FLOWBITS_TOGGLE_DEPRECATION) == 0) {
305+
de_ctx->flags |= DE_WARN_FLOWBITS_TOGGLE_DEPRECATION;
306+
SCLogWarning("flowbits \"toggle\" command is deprecated and will be removed in "
307+
"Suricata 9 (see ticket #8595)");
308+
}
304309
} else {
305310
SCLogError("ERROR: flowbits action \"%s\" is not supported.", fb_cmd_str);
306311
goto error;

src/detect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ typedef struct DetectPort_ {
323323

324324
/* Detection Engine flags */
325325
#define DE_QUIET 0x01 /**< DE is quiet (esp for unittests) */
326+
#define DE_WARN_FLOWBITS_TOGGLE_DEPRECATION 0x02
326327

327328
typedef struct IPOnlyCIDRItem_ {
328329
/* address data for this item */

0 commit comments

Comments
 (0)