From d0d65aeab61b8338cc9afb51babb0c8b795a1a11 Mon Sep 17 00:00:00 2001 From: Thierry FOURNIER Date: Tue, 4 Aug 2015 08:21:12 +0200 Subject: [PATCH] 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. --- include/types/action.h | 13 ++----------- src/cfgparse.c | 2 +- src/proto_tcp.c | 8 ++++---- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/include/types/action.h b/include/types/action.h index 570710b1be..84454e41e3 100644 --- a/include/types/action.h +++ b/include/types/action.h @@ -24,11 +24,6 @@ #include -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 @@ struct act_rule { 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 @@ struct act_rule { 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 8e7830ef12..cacbccb28f 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -8226,7 +8226,7 @@ out_uri_auth_compat: 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 e95ca8cd5b..42f5619978 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -1205,11 +1205,11 @@ resume_execution: } 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 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type, /* 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 && -- 2.39.5