MEDIUM: capture: Move the capture configuration storage in the union
This patch moves the capture configuration struct (capture_prm) in the main
"arg" union. This reduce the size of the struct.
diff --git a/include/types/action.h b/include/types/action.h
index 570710b..84454e4 100644
--- a/include/types/action.h
+++ b/include/types/action.h
@@ -24,11 +24,6 @@
#include <types/stick_table.h>
-struct capture_prm {
- struct sample_expr *expr; /* expression used as the key */
- struct cap_hdr *hdr; /* the capture storage */
-};
-
struct act_rule {
struct list list;
struct acl_cond *cond; /* acl condition to meet */
@@ -62,8 +57,8 @@
int action;
} http;
struct {
- struct sample_expr *expr;
- struct cap_hdr *hdr;
+ struct sample_expr *expr; /* expression used as the key */
+ struct cap_hdr *hdr; /* the capture storage */
} cap;
struct {
struct sample_expr *expr;
@@ -80,10 +75,6 @@
void *p[4];
} act; /* generic pointers to be used by custom actions */
} arg; /* arguments used by some actions */
-
- union {
- struct capture_prm cap;
- } act_prm;
};
#endif /* _TYPES_ACTION_H */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 8e7830e..cacbccb 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -8226,7 +8226,7 @@
if ((curproxy->cap & PR_CAP_FE) && !curproxy->tcp_req.inspect_delay) {
list_for_each_entry(trule, &curproxy->tcp_req.inspect_rules, list) {
if (trule->action == TCP_ACT_CAPTURE &&
- !(trule->act_prm.cap.expr->fetch->val & SMP_VAL_FE_SES_ACC))
+ !(trule->arg.cap.expr->fetch->val & SMP_VAL_FE_SES_ACC))
break;
if ((trule->action >= TCP_ACT_TRK_SC0 && trule->action <= TCP_ACT_TRK_SCMAX) &&
!(trule->arg.trk_ctr.expr->fetch->val & SMP_VAL_FE_SES_ACC))
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index e95ca8c..42f5619 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1205,11 +1205,11 @@
}
else if (rule->action == TCP_ACT_CAPTURE) {
struct sample *key;
- struct cap_hdr *h = rule->act_prm.cap.hdr;
+ struct cap_hdr *h = rule->arg.cap.hdr;
char **cap = s->req_cap;
int len;
- key = sample_fetch_as_type(s->be, sess, s, SMP_OPT_DIR_REQ | partial, rule->act_prm.cap.expr, SMP_T_STR);
+ key = sample_fetch_as_type(s->be, sess, s, SMP_OPT_DIR_REQ | partial, rule->arg.cap.expr, SMP_T_STR);
if (!key)
continue;
@@ -1615,8 +1615,8 @@
/* check if we need to allocate an hdr_idx struct for HTTP parsing */
curpx->http_needed |= !!(expr->fetch->use & SMP_USE_HTTP_ANY);
- rule->act_prm.cap.expr = expr;
- rule->act_prm.cap.hdr = hdr;
+ rule->arg.cap.expr = expr;
+ rule->arg.cap.hdr = hdr;
rule->action = TCP_ACT_CAPTURE;
}
else if (strncmp(args[arg], "track-sc", 8) == 0 &&