MEDIUM: counters: add support for tracking a third counter
We're often missin a third counter to track base, src and base+src at
the same time. Here we introduce track_sc3 to have this third counter.
It would be wise not to add much more counters because that slightly
increases the session size and processing time though the real issue
is more the declaration of the keywords in the code and in the doc.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 86a67c4..e1b5d8b 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -901,7 +901,7 @@
s->flags |= SN_FINST_R;
return 0;
}
- else if ((rule->action >= TCP_ACT_TRK_SC1 && rule->action <= TCP_ACT_TRK_SC2) &&
+ else if ((rule->action >= TCP_ACT_TRK_SC1 && rule->action <= TCP_ACT_TRK_SC3) &&
!s->stkctr[tcp_trk_idx(rule->action)].entry) {
/* Note: only the first valid tracking parameter of each
* applies.
@@ -1055,7 +1055,7 @@
result = 0;
break;
}
- else if ((rule->action >= TCP_ACT_TRK_SC1 && rule->action <= TCP_ACT_TRK_SC2) &&
+ else if ((rule->action >= TCP_ACT_TRK_SC1 && rule->action <= TCP_ACT_TRK_SC3) &&
!s->stkctr[tcp_trk_idx(rule->action)].entry) {
/* Note: only the first valid tracking parameter of each
* applies.
@@ -1143,7 +1143,7 @@
arg++;
rule->action = TCP_ACT_REJECT;
}
- else if (strcmp(args[arg], "track-sc1") == 0 || strcmp(args[arg], "track-sc2") == 0) {
+ else if (strcmp(args[arg], "track-sc1") == 0 || strcmp(args[arg], "track-sc2") == 0 || strcmp(args[arg], "track-sc3") == 0) {
struct sample_expr *expr;
int kw = arg;
@@ -1187,8 +1187,8 @@
}
else {
memprintf(err,
- "'%s %s' expects 'accept', 'reject', 'track-sc1' "
- "or 'track-sc2' in %s '%s' (got '%s')",
+ "'%s %s' expects 'accept', 'reject', 'track-sc1', 'track-sc2' "
+ " or 'track-sc3' in %s '%s' (got '%s')",
args[0], args[1], proxy_type_str(curpx), curpx->id, args[arg]);
return -1;
}